[dovecot-cvs] dovecot/src/lib printf-upper-bound.c, 1.5, 1.6 sha1.c, 1.4, 1.5

cras at dovecot.org cras at dovecot.org
Fri Jul 1 00:36:03 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv11028/src/lib

Modified Files:
	printf-upper-bound.c sha1.c 
Log Message:
Bad endianess fix. It required that LITTLE_ENDIAN and BIG_ENDIAN were
already defined. Rather use WORDS_BIGENDIAN which configure already sets.



Index: printf-upper-bound.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/printf-upper-bound.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- printf-upper-bound.c	30 Jun 2005 20:55:34 -0000	1.5
+++ printf-upper-bound.c	30 Jun 2005 21:36:01 -0000	1.6
@@ -25,7 +25,8 @@
 #define G_IEEE754_DOUBLE_BIAS   (1023)
 /* multiply with base2 exponent to get base10 exponent (nomal numbers) */
 #define G_LOG_2_BASE_10         (0.30102999566398119521)
-#if I_BYTE_ORDER == LITTLE_ENDIAN
+
+#ifndef WORDS_BIGENDIAN
 union _GDoubleIEEE754
 {
   double v_double;
@@ -36,7 +37,7 @@
     unsigned int sign : 1;
   } mpn;
 };
-#elif I_BYTE_ORDER == BIG_ENDIAN
+#else
 union _GDoubleIEEE754
 {
   double v_double;
@@ -47,9 +48,7 @@
     unsigned int mantissa_low : 32;
   } mpn;
 };
-#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
-#error unknown ENDIAN type
-#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+#endif
 
 typedef struct
 {

Index: sha1.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/sha1.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sha1.c	30 Jun 2005 20:55:34 -0000	1.4
+++ sha1.c	30 Jun 2005 21:36:01 -0000	1.5
@@ -38,10 +38,6 @@
 #include "sha1.h"
 #include "safe-memset.h"
 
-#if I_BYTE_ORDER != LITTLE_ENDIAN && I_BYTE_ORDER != BIG_ENDIAN
-#  error unknown endian
-#endif
-
 /* constant table */
 static uint32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
 #define	K(t)	_K[(t) / 20]
@@ -84,7 +80,7 @@
 	size_t t, s;
 	uint32_t	tmp;
 
-#if I_BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
 	struct sha1_ctxt tctxt;
 	memmove(&tctxt.m.b8[0], &ctxt->m.b8[0], 64);
 	ctxt->m.b8[0] = tctxt.m.b8[3]; ctxt->m.b8[1] = tctxt.m.b8[2];
@@ -193,7 +189,7 @@
 	memset(&ctxt->m.b8[padstart], 0, padlen - 8);
 	COUNT += (padlen - 8);
 	COUNT %= 64;
-#if I_BYTE_ORDER == BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 	PUTPAD(ctxt->c.b8[0]); PUTPAD(ctxt->c.b8[1]);
 	PUTPAD(ctxt->c.b8[2]); PUTPAD(ctxt->c.b8[3]);
 	PUTPAD(ctxt->c.b8[4]); PUTPAD(ctxt->c.b8[5]);
@@ -239,7 +235,7 @@
 
 	digest = (uint8_t *)digest0;
 	sha1_pad(ctxt);
-#if I_BYTE_ORDER == BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 	memmove(digest, &ctxt->h.b8[0], 20);
 #else
 	digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2];



More information about the dovecot-cvs mailing list