You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by ma...@apache.org on 2010/03/04 03:38:22 UTC

svn commit: r918822 - in /hadoop/avro/trunk: CHANGES.txt lang/c/configure.in lang/c/src/encoding_binary.c

Author: massie
Date: Thu Mar  4 02:38:22 2010
New Revision: 918822

URL: http://svn.apache.org/viewvc?rev=918822&view=rev
Log:
AVRO-443. Endianness is determined at configure time rather than compile time. Contributed by Bruce Mitchener.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/c/configure.in
    hadoop/avro/trunk/lang/c/src/encoding_binary.c

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=918822&r1=918821&r2=918822&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Thu Mar  4 02:38:22 2010
@@ -19,6 +19,9 @@
     AVRO-445. avro_size_data() to pre-calculate the size of an 
     avro_datum_t in serialized form (Bruce Mitchener via massie)
 
+    AVRO-443. Endianness is determined at configure time rather 
+    than compile time (Bruce Mitchener via massie)
+
   BUG FIXES
 
     AVRO-424. Fix the specification of the deflate codec.

Modified: hadoop/avro/trunk/lang/c/configure.in
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c/configure.in?rev=918822&r1=918821&r2=918822&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c/configure.in (original)
+++ hadoop/avro/trunk/lang/c/configure.in Thu Mar  4 02:38:22 2010
@@ -23,7 +23,6 @@
 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
-AC_C_BIGENDIAN
 AC_C_CONST
 AC_TYPE_SIZE_T
 AC_CHECK_SIZEOF(void *)

Modified: hadoop/avro/trunk/lang/c/src/encoding_binary.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c/src/encoding_binary.c?rev=918822&r1=918821&r2=918822&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c/src/encoding_binary.c (original)
+++ hadoop/avro/trunk/lang/c/src/encoding_binary.c Thu Mar  4 02:38:22 2010
@@ -19,6 +19,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <string.h>
+#include <sys/types.h>
 
 #define MAX_VARINT_BUF_SIZE 10
 
@@ -187,14 +188,14 @@
 
 static int read_float(avro_reader_t reader, float *f)
 {
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	uint8_t buf[4];
 #endif
 	union {
 		float f;
 		int32_t i;
 	} v;
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	AVRO_READ(avro, buf, 4);
 	v.i = ((int32_t) buf[0] << 0)
 	    | ((int32_t) buf[1] << 8)
@@ -214,7 +215,7 @@
 
 static int write_float(avro_writer_t writer, const float f)
 {
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	uint8_t buf[4];
 #endif
 	union {
@@ -223,7 +224,7 @@
 	} v;
 
 	v.f = f;
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	buf[0] = (uint8_t) (v.i >> 0);
 	buf[1] = (uint8_t) (v.i >> 8);
 	buf[2] = (uint8_t) (v.i >> 16);
@@ -242,7 +243,7 @@
 
 static int read_double(avro_reader_t reader, double *d)
 {
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	uint8_t buf[8];
 #endif
 	union {
@@ -250,7 +251,7 @@
 		int64_t l;
 	} v;
 
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	AVRO_READ(avro, buf, 8);
 	v.l = ((int64_t) buf[0] << 0)
 	    | ((int64_t) buf[1] << 8)
@@ -274,7 +275,7 @@
 
 static int write_double(avro_writer_t writer, const double d)
 {
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	uint8_t buf[8];
 #endif
 	union {
@@ -283,7 +284,7 @@
 	} v;
 
 	v.d = d;
-#if WORDS_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 	buf[0] = (uint8_t) (v.l >> 0);
 	buf[1] = (uint8_t) (v.l >> 8);
 	buf[2] = (uint8_t) (v.l >> 16);