From de341580a6003944f1ae4b01c56bf483ead857d1 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Fri, 20 Aug 2010 16:27:44 -0400 Subject: [PATCH] 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 --- src/des/quad_cksum.c | 66 +++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/des/quad_cksum.c b/src/des/quad_cksum.c index c982d1d658..8f6fe1cd4b 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