|
From: <kin...@us...> - 2004-02-09 06:51:01
|
Update of /cvsroot/teem/teem/src/air In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24515 Modified Files: air.h sane.c Log Message: added sanity check to make sure that unsigned char is really 8 bits Index: air.h =================================================================== RCS file: /cvsroot/teem/teem/src/air/air.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** air.h 7 Jan 2004 15:34:27 -0000 1.34 --- air.h 9 Feb 2004 06:47:50 -0000 1.35 *************** *** 367,374 **** airInsane_dio, /* 7: airMyDio set to something invalid */ airInsane_32Bit, /* 8: airMy32Bit is wrong */ ! airInsane_FISize, /* 9: sizeof(float), sizeof(int) not 4 */ ! airInsane_DLSize /* 10: sizeof(double), sizeof(airLLong) not 8 */ }; ! #define AIR_INSANE_MAX 10 extern const char *airInsaneErr(int insane); extern int airSanity(); --- 367,375 ---- airInsane_dio, /* 7: airMyDio set to something invalid */ airInsane_32Bit, /* 8: airMy32Bit is wrong */ ! airInsane_UCSize, /* 9: unsigned char isn't 8 bits */ ! airInsane_FISize, /* 10: sizeof(float), sizeof(int) not 4 */ ! airInsane_DLSize /* 11: sizeof(double), sizeof(airLLong) not 8 */ }; ! #define AIR_INSANE_MAX 11 extern const char *airInsaneErr(int insane); extern int airSanity(); Index: sane.c =================================================================== RCS file: /cvsroot/teem/teem/src/air/sane.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sane.c 7 Jan 2004 15:34:27 -0000 1.7 --- sane.c 9 Feb 2004 06:47:50 -0000 1.8 *************** *** 33,36 **** --- 33,37 ---- int tmpI, sign, exp, frac, size; char endian; + unsigned char uc0, uc1; static int _airSanity=0; *************** *** 54,58 **** } ! /* checks on sizes of float, int, double, airLLong */ /* these justify the AIR_EXISTS_F and AIR_EXISTS_D macros */ if (!( (sizeof(float) == sizeof(int)) && (4 == sizeof(int)) )) { --- 55,64 ---- } ! /* checks on sizes of uchar, float, int, double, airLLong */ ! uc0 = 255; ! uc1 = uc0 + 1; /* to avoid compiler warnings */ ! if (!( 255 == uc0 && 0 == uc1 )) { ! return airInsane_UCSize; ! } /* these justify the AIR_EXISTS_F and AIR_EXISTS_D macros */ if (!( (sizeof(float) == sizeof(int)) && (4 == sizeof(int)) )) { *************** *** 128,131 **** --- 134,138 ---- "TEEM_DIO has invalid value", "TEEM_32BIT is wrong", + "unsigned char isn't 8 bits", "sizeof(float), sizeof(int) not both == 4", "sizeof(double), sizeof(airLLong) not both == 8", |