[Pkg-ocaml-maint-commits] [SCM] bin-prot packaging branch, master, updated. debian/1.2.24-1-17-ga2c5a54
Stephane Glondu
steph at glondu.net
Wed Jul 13 21:17:49 UTC 2011
The following commit has been merged in the master branch:
commit 08cc68b4f09db35752a40d32d17f823e1f1487ea
Author: Stephane Glondu <steph at glondu.net>
Date: Wed Jul 13 23:02:57 2011 +0200
Fix endianness issues (e.g. mips)
diff --git a/debian/patches/0004-Fix-endianness.patch b/debian/patches/0004-Fix-endianness.patch
new file mode 100644
index 0000000..586cbd6
--- /dev/null
+++ b/debian/patches/0004-Fix-endianness.patch
@@ -0,0 +1,91 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Wed, 13 Jul 2011 22:58:36 +0200
+Subject: Fix endianness
+
+Use functions from <endian.h> to cope with big-endiannes. Fixes FTBFS
+on e.g. mips.
+
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631829
+---
+ lib/read_stubs.c | 7 ++++++-
+ lib/write_stubs.c | 13 ++++++++-----
+ 2 files changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/lib/read_stubs.c b/lib/read_stubs.c
+index c8dac01..2ac14cb 100644
+--- a/lib/read_stubs.c
++++ b/lib/read_stubs.c
+@@ -22,6 +22,11 @@
+ * *
+ ******************************************************************************/
+
++#define _BSD_SOURCE
++#include <endian.h>
++
++#define le8toh(x) (x)
++
+ /* Stubs for reading basic values in the binary protocol */
+
+ #include "common_stubs.h"
+@@ -90,7 +95,7 @@ static inline void raise_Read_error(int loc, unsigned long pos)
+ TYPE n; \
+ if (unlikely(next > eptr)) \
+ caml_raise_constant(*v_bin_prot_exc_Buffer_short); \
+- n = *(TYPE *) *sptr_ptr; \
++ n = le##SIZE##toh(*(TYPE *) *sptr_ptr); \
+ CHECK \
+ *sptr_ptr = next; \
+ return n; \
+diff --git a/lib/write_stubs.c b/lib/write_stubs.c
+index 1cd94c4..039e1b1 100644
+--- a/lib/write_stubs.c
++++ b/lib/write_stubs.c
+@@ -22,6 +22,9 @@
+ * *
+ ******************************************************************************/
+
++#define _BSD_SOURCE
++#include <endian.h>
++
+ /* Stubs for writing basic values in the binary protocol */
+
+ #include "common_stubs.h"
+@@ -73,7 +76,7 @@ static inline value write_neg_int8(char *sptr, char *eptr, char n)
+ static inline void do_write_int16(char *sptr, short n)
+ {
+ *sptr++ = CODE_INT16;
+- *(short *) sptr = n;
++ *(short *) sptr = htole16(n);
+ }
+
+ static inline value write_int16(char *sptr, char *eptr, short n)
+@@ -87,7 +90,7 @@ static inline value write_int16(char *sptr, char *eptr, short n)
+ static inline void do_write_int32(char *sptr, int n)
+ {
+ *sptr++ = CODE_INT32;
+- *(int *) sptr = n;
++ *(int *) sptr = htole32(n);
+ }
+
+ static inline value write_int32(char *sptr, char *eptr, int n)
+@@ -102,7 +105,7 @@ static inline value write_int32(char *sptr, char *eptr, int n)
+ static inline void do_write_int64(char *sptr, long n)
+ {
+ *sptr++ = CODE_INT64;
+- *(long *) sptr = n;
++ *(long *) sptr = htole64(n);
+ }
+
+ static inline value write_int64(char *sptr, char *eptr, long n)
+@@ -190,8 +193,8 @@ static inline value write_int64_type(char *sptr, char *eptr, int64 n)
+ if (unlikely(next > eptr)) caml_raise_constant(*v_bin_prot_exc_Buffer_short);
+ *sptr++ = CODE_INT64;
+ isptr = (int *) sptr;
+- *isptr++ = I64_to_int32(n);
+- *isptr = I64_to_int32(I64_lsr(n, 32));
++ *isptr++ = htole32(I64_to_int32(n));
++ *isptr = htole32(I64_to_int32(I64_lsr(n, 32)));
+ return (value) next;
+ }
+
+--
diff --git a/debian/patches/series b/debian/patches/series
index 4367494..7395b4e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-Fix-bigstring-layout-bug.patch
0002-Use-cpp-as-default-preprocessor-on-unknown-OS.patch
0003-Fix-alignment.patch
+0004-Fix-endianness.patch
--
bin-prot packaging
More information about the Pkg-ocaml-maint-commits
mailing list