From: Simon Wilkinson Date: Mon, 28 Sep 2009 14:50:20 +0000 (+0200) Subject: Fix warnings in new dumptag code X-Git-Tag: openafs-devel-1_5_65~19 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4f65bec3fc4d0c1157aa80323c8d7ecc8a53d3a1;p=packages%2Fo%2Fopenafs.git Fix warnings in new dumptag code 3f2dd80697959f5922032f4d4a7c9ef0cfadf35c contained a number of new warnings. This patch fixes them. It also adds the AFS_UNUSED_FUNCTION macro which can be used to portably mark functions as unused. Reviewed-on: http://gerrit.openafs.org/543 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- diff --git a/src/config/stds.h b/src/config/stds.h index 69ef40a50..df331eca6 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -315,4 +315,10 @@ hdr_static_inline(long) afs_printable_int32_ld(afs_int32 d) { return (long) d; } hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; } +#if !defined(__GNUC__) || __GNUC__ < 2 +#define AFS_UNUSED_FUNCTION +#else +#define AFS_UNUSED_FUNCTION __attribute__((unused)) +#endif + #endif /* OPENAFS_CONFIG_AFS_STDS_H */ diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index cca8763df..5ed27b61f 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -115,7 +115,7 @@ RegisterTag(afs_int32 section, unsigned char tag) } static void -initNonStandardTags() +initNonStandardTags(void) { RegisterTag(0, 'n'); /* volume name */ RegisterTag(0, 't'); /* fromtime, V_backupDate */ @@ -313,7 +313,7 @@ ReadStandardTagLen(register struct iod *iodp, unsigned char tag, afs_int32 secti *length = len; else { len &= 0x7f; - if (code = iod_Read(iodp, buf, len) != len) + if ((code = iod_Read(iodp, (char *)buf, len)) != len) return VOLSERDUMPERROR; *length = 0; p = (unsigned char *)&buf; @@ -334,11 +334,11 @@ static afs_int32 SkipData(register struct iod *iodp, afs_size_t length) { while (length > 256) { - if (iod_Read(iodp, &skipbuf, 256) != 256) + if (iod_Read(iodp, (char *)&skipbuf, 256) != 256) return 0; length -= 256; } - if (iod_Read(iodp, &skipbuf, length) != length) + if (iod_Read(iodp, (char *)&skipbuf, length) != length) return 0; return 1; } @@ -346,10 +346,10 @@ SkipData(register struct iod *iodp, afs_size_t length) static char *secname[3] = {"ReadDumpHeader", "ReadVolumeHeader", "ReadVnodes"}; static int -HandleUnknownTag(struct iod *iodp, register tag, afs_int32 section, +HandleUnknownTag(struct iod *iodp, int tag, afs_int32 section, afs_int32 critical) { - afs_size_t taglen; + afs_size_t taglen = 0; afs_uint32 trash; if (critical) { @@ -667,6 +667,7 @@ DumpStandardTag(register struct iod *iodp, char tag, afs_uint32 section) return 0; } +AFS_UNUSED_FUNCTION static afs_int32 DumpStandardTagLen(register struct iod *iodp, char tag, afs_uint32 section, afs_size_t length)