From: Marc Dionne Date: Fri, 20 Aug 2010 20:27:44 +0000 (-0400) Subject: Prototype warning cleanup - big endian X-Git-Tag: openafs-devel-1_5_77~44 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ac173619059525e4a40c9787ccb2910c6a46de95;p=packages%2Fo%2Fopenafs.git Prototype warning cleanup - big endian Move function definitions above their use in quad_cksum.c and remove the (incomplete) prototypes. Clears up a few warnings on big endian systems. Change-Id: Id860f904fff9fb033ee4b2032162304a4af7423a Reviewed-on: http://gerrit.openafs.org/2601 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit de341580a6003944f1ae4b01c56bf483ead857d1) Reviewed-on: http://gerrit.openafs.org/2669 --- diff --git a/src/des/quad_cksum.c b/src/des/quad_cksum.c index c982d1d65..8f6fe1cd4 100644 --- a/src/des/quad_cksum.c +++ b/src/des/quad_cksum.c @@ -87,14 +87,44 @@ #define vaxtohl(x) (*((afs_uint32 *)(x))) #define vaxtohs(x) (*((unsigned short *)(x))) #else -static afs_uint32 four_bytes_vax_to_nets(); #define vaxtohl(x) four_bytes_vax_to_nets((char *)(x)) -static unsigned short two_bytes_vax_to_nets(); #define vaxtohs(x) two_bytes_vax_to_nets((char *)(x)) #endif /*** Routines ***************************************************** */ +#ifdef MSBFIRST + +static unsigned short +two_bytes_vax_to_nets(char *p) +{ + union { + char pieces[2]; + unsigned short result; + } short_conv; + + short_conv.pieces[0] = p[1]; + short_conv.pieces[1] = p[0]; + return (short_conv.result); +} + +static afs_uint32 +four_bytes_vax_to_nets(char *p) +{ + union { + char pieces[4]; + afs_uint32 result; + } long_conv; + + long_conv.pieces[0] = p[3]; + long_conv.pieces[1] = p[2]; + long_conv.pieces[2] = p[1]; + long_conv.pieces[3] = p[0]; + return (long_conv.result); +} + +#endif + /* des_cblock *c_seed; * secret seed, 8 bytes * unsigned char *in; * input block * @@ -159,35 +189,3 @@ des_quad_cksum(unsigned char *in, afs_uint32 * out, afs_int32 length, /* return final z value as 32 bit version of checksum */ return z; } - -#ifdef MSBFIRST - -static unsigned short -two_bytes_vax_to_nets(char *p) -{ - union { - char pieces[2]; - unsigned short result; - } short_conv; - - short_conv.pieces[0] = p[1]; - short_conv.pieces[1] = p[0]; - return (short_conv.result); -} - -static afs_uint32 -four_bytes_vax_to_nets(char *p) -{ - union { - char pieces[4]; - afs_uint32 result; - } long_conv; - - long_conv.pieces[0] = p[3]; - long_conv.pieces[1] = p[2]; - long_conv.pieces[2] = p[1]; - long_conv.pieces[3] = p[0]; - return (long_conv.result); -} - -#endif