From 601390e5d9769133081e923da098991f529866ad Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 1 Mar 2009 17:42:24 +0000 Subject: [PATCH] Fixes for correct compilation with ZDS-II git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1556 42af7a65-404d-4744-a932-0658087f49c3 --- examples/nsh/nsh_ddcmd.c | 26 +++++++++++++++++--------- examples/nsh/nsh_netcmds.c | 2 +- fs/fat/fs_fat32.c | 10 +++++++--- fs/fat/fs_fat32.h | 36 ++++++++++++++++++------------------ fs/fat/fs_fat32util.c | 10 +++++++--- fs/fat/fs_writefat.c | 2 +- fs/fs_open.c | 6 ++++-- 7 files changed, 55 insertions(+), 37 deletions(-) diff --git a/examples/nsh/nsh_ddcmd.c b/examples/nsh/nsh_ddcmd.c index f822149a6f2..1fe3d54856c 100644 --- a/examples/nsh/nsh_ddcmd.c +++ b/examples/nsh/nsh_ddcmd.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nsh/nsh_ddcmd.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -224,7 +224,8 @@ static int dd_writeblk(struct dd_s *dd) } else { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "bshlib_write", NSH_ERRNO_OF(-nbytes)); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "bshlib_write", NSH_ERRNO_OF(-nbytes)); return ERROR; } } @@ -251,7 +252,8 @@ static int dd_writech(struct dd_s *dd) nbytes = write(DD_OUTFD, buffer, dd->sectsize - written); if (nbytes < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "write", NSH_ERRNO_OF(-nbytes)); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "write", NSH_ERRNO_OF(-nbytes)); return ERROR; } @@ -276,7 +278,8 @@ static int dd_readblk(struct dd_s *dd) nbytes = bchlib_read(DD_INHANDLE, (char*)dd->buffer, offset, dd->sectsize); if (nbytes < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "bshlib_read", NSH_ERRNO_OF(-nbytes)); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "bshlib_read", NSH_ERRNO_OF(-nbytes)); return ERROR; } @@ -303,7 +306,8 @@ static int dd_readch(struct dd_s *dd) nbytes = read(DD_INFD, buffer, dd->sectsize - dd->nbytes); if (nbytes < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO_OF(-nbytes)); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO_OF(-nbytes)); return ERROR; } @@ -345,6 +349,7 @@ static int dd_filetype(const char *filename) #ifndef CONFIG_DISABLE_MOUNTPOINT static inline int dd_infopen(const char *name, struct dd_s *dd) { + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; int ret; int type; @@ -353,7 +358,7 @@ static inline int dd_infopen(const char *name, struct dd_s *dd) type = dd_filetype(name); if (type < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "stat", NSH_ERRNO_OF(-type)); + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "stat", NSH_ERRNO_OF(-type)); return type; } @@ -364,7 +369,7 @@ static inline int dd_infopen(const char *name, struct dd_s *dd) DD_INFD = open(name, O_RDONLY); if (DD_INFD < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); return ERROR; } @@ -390,7 +395,8 @@ static inline int dd_infopen(const char *name, struct dd_s *dd) DD_INFD = open(name, O_RDONLY); if (DD_INFD < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); return ERROR; } return OK; @@ -432,7 +438,8 @@ static inline int dd_outfopen(const char *name, struct dd_s *dd) DD_OUTFD = open(name, O_WRONLY|O_CREAT|O_TRUNC, 0644); if (DD_OUTFD < 0) { - nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; + nsh_output(vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); return ERROR; } @@ -447,6 +454,7 @@ static inline int dd_outfopen(const char *name, struct dd_s *dd) DD_OUTFD = open(name, O_WRONLY|O_CREAT|O_TRUNC, 0644); if (DD_OUTFD < 0) { + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; nsh_output(dd->vtbl, g_fmtcmdfailed, g_dd, "open", NSH_ERRNO); return ERROR; } diff --git a/examples/nsh/nsh_netcmds.c b/examples/nsh/nsh_netcmds.c index 56dce7bd21b..f95e4501711 100644 --- a/examples/nsh/nsh_netcmds.c +++ b/examples/nsh/nsh_netcmds.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nsh/nsh_netcmds.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c index bd22a61e5c8..a0a2774754f 100644 --- a/fs/fat/fs_fat32.c +++ b/fs/fat/fs_fat32.c @@ -218,7 +218,7 @@ static int fat_open(FAR struct file *filep, const char *relpath, } #ifdef CONFIG_FILE_MODE -# warning "Missing check for privileges based on inode->i_mode" +# warning "Missing check for privileges based on inode->i_mode" #endif /* Check if the caller has sufficient privileges to open the file */ @@ -1672,7 +1672,9 @@ static int fat_unlink(struct inode *mountpt, const char *relpath) * open reference to the file is closed. */ -#warning "Need to defer deleting cluster chain if the file is open" +#ifdef CONFIG_CPP_HAVE_WARNING +# warning "Need to defer deleting cluster chain if the file is open" +#endif /* Remove the file */ @@ -1925,7 +1927,9 @@ int fat_rmdir(struct inode *mountpt, const char *relpath) * open reference to the directory is closed. */ -#warning "Need to defer deleting cluster chain if the directory is open" +#ifdef CONFIG_CPP_HAVE_WARNING +# warning "Need to defer deleting cluster chain if the directory is open" +#endif /* Remove the directory */ diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h index 89d2c575471..5bced51bc75 100644 --- a/fs/fat/fs_fat32.h +++ b/fs/fat/fs_fat32.h @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fat/fs_fat32.h * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 200, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -319,10 +319,10 @@ #define MBR_PUTVOLID16(p,v) fat_putuint32(UBYTE_PTR(p,BS16_VOLID),v) #define MBR_PUTVOLID32(p,v) fat_putuint32(UBYTE_PTR(p,BS32_VOLID),v) -#define PART1_PUTSTARTSECTOR(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY1+PART_STARTSECTOR,v)) -#define PART1_PUTSIZE(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY1+PART_SIZE,v)) -#define PART2_PUTSTARTSECTOR(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY2+PART_STARTSECTOR,v)) -#define PART2_PUTSIZE(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY2+PART_SIZE,v)) +#define PART1_PUTSTARTSECTOR(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY1+PART_STARTSECTOR),v) +#define PART1_PUTSIZE(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY1+PART_SIZE),v) +#define PART2_PUTSTARTSECTOR(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY2+PART_STARTSECTOR),v) +#define PART2_PUTSIZE(p,v) fat_putuint32(UBYTE_PTR(p,PART_ENTRY2+PART_SIZE),v) /* But for multi-byte values, the endian-ness of the target vs. the little * endian order of the byte stream or alignment of the data within the byte @@ -373,19 +373,19 @@ # define FAT_GETFAT16(p,i) fat_getuint16(UBYTE_PTR(p,i)) # define FAT_GETFAT32(p,i) fat_getuint32(UBYTE_PTR(p,i)) -# define MBR_PUTRESVDSECCOUNT(p,v) fat_putuint16(UBYTE_PTR(p,BS_RESVDSECCOUNT,v)) -# define MBR_PUTFATSZ16(p,v) fat_putuint16(UBYTE_PTR(p,BS_FATSZ16,v)) -# define MBR_PUTSECPERTRK(p,v) fat_putuint16(UBYTE_PTR(p,BS_SECPERTRK,v)) -# define MBR_PUTNUMHEADS(p,v) fat_putuint16(UBYTE_PTR(p,BS_NUMHEADS,v)) -# define MBR_PUTHIDSEC(p,v) fat_putuint32(UBYTE_PTR(p,BS_HIDSEC,v)) -# define MBR_PUTTOTSEC32(p,v) fat_putuint32(UBYTE_PTR(p,BS_TOTSEC32,v)) -# define MBR_PUTFATSZ32(p,v) fat_putuint32(UBYTE_PTR(p,BS32_FATSZ32,v)) -# define MBR_PUTEXTFLAGS(p,v) fat_putuint16(UBYTE_PTR(p,BS32_EXTFLAGS,v)) -# define MBR_PUTFSVER(p,v) fat_putuint16(UBYTE_PTR(p,BS32_FSVER,v)) -# define MBR_PUTROOTCLUS(p,v) fat_putuint32(UBYTE_PTR(p,BS32_ROOTCLUS,v)) -# define MBR_PUTFSINFO(p,v) fat_putuint16(UBYTE_PTR(p,BS32_FSINFO,v)) -# define MBR_PUTBKBOOTSEC(p,v) fat_putuint16(UBYTE_PTR(p,BS32_BKBOOTSEC,v)) -# define MBR_PUTSIGNATURE(p,v) fat_getuint16(UBYTE_PTR(p,BS_SIGNATURE),v) +# define MBR_PUTRESVDSECCOUNT(p,v) fat_putuint16(UBYTE_PTR(p,BS_RESVDSECCOUNT),v) +# define MBR_PUTFATSZ16(p,v) fat_putuint16(UBYTE_PTR(p,BS_FATSZ16),v) +# define MBR_PUTSECPERTRK(p,v) fat_putuint16(UBYTE_PTR(p,BS_SECPERTRK),v) +# define MBR_PUTNUMHEADS(p,v) fat_putuint16(UBYTE_PTR(p,BS_NUMHEADS),v) +# define MBR_PUTHIDSEC(p,v) fat_putuint32(UBYTE_PTR(p,BS_HIDSEC),v) +# define MBR_PUTTOTSEC32(p,v) fat_putuint32(UBYTE_PTR(p,BS_TOTSEC32),v) +# define MBR_PUTFATSZ32(p,v) fat_putuint32(UBYTE_PTR(p,BS32_FATSZ32),v) +# define MBR_PUTEXTFLAGS(p,v) fat_putuint16(UBYTE_PTR(p,BS32_EXTFLAGS),v) +# define MBR_PUTFSVER(p,v) fat_putuint16(UBYTE_PTR(p,BS32_FSVER),v) +# define MBR_PUTROOTCLUS(p,v) fat_putuint32(UBYTE_PTR(p,BS32_ROOTCLUS),v) +# define MBR_PUTFSINFO(p,v) fat_putuint16(UBYTE_PTR(p,BS32_FSINFO),v) +# define MBR_PUTBKBOOTSEC(p,v) fat_putuint16(UBYTE_PTR(p,BS32_BKBOOTSEC),v) +# define MBR_PUTSIGNATURE(p,v) fat_putuint16(UBYTE_PTR(p,BS_SIGNATURE),v) # define FSI_PUTLEADSIG(p,v) fat_putuint32(UBYTE_PTR(p,FSI_LEADSIG),v) # define FSI_PUTSTRUCTSIG(p,v) fat_putuint32(UBYTE_PTR(p,FSI_STRUCTSIG),v) diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c index dc1404f9e9b..16f47727bc2 100644 --- a/fs/fat/fs_fat32util.c +++ b/fs/fat/fs_fat32util.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs_fat32util.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -549,7 +549,9 @@ void fat_semgive(struct fat_mountpt_s *fs) uint32 fat_systime2fattime(void) { -#warning "Time not implemented" +#ifdef CONFIG_CPP_HAVE_WARNING +# warning "Time not implemented" +#endif return 0; } @@ -571,7 +573,9 @@ uint32 fat_systime2fattime(void) time_t fat_fattime2systime(uint16 fattime, uint16 fatdate) { -#warning "Time not implemented" +#ifdef CONFIG_CPP_HAVE_WARNING +# warning "Time not implemented" +#endif return 0; } diff --git a/fs/fat/fs_writefat.c b/fs/fat/fs_writefat.c index 0cffac044f7..401d023ba16 100644 --- a/fs/fat/fs_writefat.c +++ b/fs/fat/fs_writefat.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fat/fs_writefat.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/fs/fs_open.c b/fs/fs_open.c index 166471bfb59..8ab6503769d 100644 --- a/fs/fs_open.c +++ b/fs/fs_open.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs_open.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -90,7 +90,9 @@ int open(const char *path, int oflags, ...) } #ifdef CONFIG_FILE_MODE -# warning "File creation not implemented" +# ifdef CONFIG_CPP_HAVE_WARNING +# warning "File creation not implemented" +# endif /* If the file is opened for creation, then get the mode bits */