[SCM] libmms/master: Apply patch from upstream git to fixup bswap.h macros. This patch thus does not change anything functionally, but it does make the code read correctly (see #611791).

fabian-guest at users.alioth.debian.org fabian-guest at users.alioth.debian.org
Mon Feb 21 13:38:33 UTC 2011


The following commit has been merged in the master branch:
commit 959428e1e748183389f4efe06ce3e418190a6041
Author: Fabian Greffrath <fabian at greffrath.com>
Date:   Mon Feb 21 14:38:07 2011 +0100

    Apply patch from upstream git to fixup bswap.h macros. This patch thus does not change anything functionally, but it does make the code read correctly (see #611791).

diff --git a/debian/patches/0001-Fixup-bswap.h-macros.patch b/debian/patches/0001-Fixup-bswap.h-macros.patch
new file mode 100644
index 0000000..206a5ff
--- /dev/null
+++ b/debian/patches/0001-Fixup-bswap.h-macros.patch
@@ -0,0 +1,88 @@
+From 487d4dc7ea330d14d6e43e6cce092c4ffac926eb Mon Sep 17 00:00:00 2001
+From: Hans de Goede <j.w.r.degoede at hhs.nl>
+Date: Mon, 21 Feb 2011 10:28:55 +0100
+Subject: [PATCH] Fixup bswap.h macros
+
+The SWAP and SAME names used for the macros are named incorrectly, they should
+be called LITTLE_ENDIAN_TO_NATIVE resp. BIG_ENDIAN_TO_NATIVE. This also means
+that they will do the wrong thing on bigendian if used as intended in the
+previous version of bswap.h, but the WORDS_BIGENDIAN define which is checked
+for does not get defined by standard C headers, so we end up using the
+"/* Little endian */" block on big endian machines too, which makes things
+work with the old version there too. So this was a case were 2 wrongs make a
+right.
+
+This patch thus does not change anything functionally, but it does make the
+code read correctly.
+---
+ src/bswap.h |   45 ++++++++++++++-------------------------------
+ 1 files changed, 14 insertions(+), 31 deletions(-)
+
+--- libmms.orig/src/bswap.h
++++ libmms/src/bswap.h
+@@ -20,51 +20,34 @@
+  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+  */
+ 
++/* These macros are for converting an array of bytes containing a
++   <macro-name> integer to such an integer in the processors native format */
+ 
+ #include <inttypes.h>
+ 
+-#define SWAP_ENDIAN_16(val) \
++#define BE_16_TO_NATIVE(val) \
+ 	(val[1] | (val[0] << 8))
+-#define SWAP_ENDIAN_32(val) \
++#define BE_32_TO_NATIVE(val) \
+ 	(val[3] | (val[2] << 8) | (val[1] << 16) | (val[0] << 24))
+-#define SWAP_ENDIAN_64(val) \
++#define BE_64_TO_NATIVE(val) \
+ 	(val[7] | (val[6] << 8) | (val[5] << 16) | (val[4] << 24) | \
+ 	((uint64_t)val[3] << 32) | ((uint64_t)val[2] << 40) | \
+ 	((uint64_t)val[1] << 48) | ((uint64_t)val[0] << 56))
+ 
+-#define SAME_ENDIAN_16(val) \
++#define LE_16_TO_NATIVE(val) \
+ 	(val[0] | (val[1] << 8))
+-#define SAME_ENDIAN_32(val) \
++#define LE_32_TO_NATIVE(val) \
+ 	(val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 24))
+-#define SAME_ENDIAN_64(val) \
++#define LE_64_TO_NATIVE(val) \
+ 	(val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 24) | \
+ 	((uint64_t)val[4] << 32) | ((uint64_t)val[5] << 40) | \
+ 	((uint64_t)val[6] << 48) | ((uint64_t)val[7] << 56))
+ 
+-#ifndef WORDS_BIGENDIAN
++#define BE_16(val) BE_16_TO_NATIVE(((uint8_t *)(val)))
++#define BE_32(val) BE_32_TO_NATIVE(((uint8_t *)(val)))
++#define BE_64(val) BE_64_TO_NATIVE(((uint8_t *)(val)))
++#define LE_16(val) LE_16_TO_NATIVE(((uint8_t *)(val)))
++#define LE_32(val) LE_32_TO_NATIVE(((uint8_t *)(val)))
++#define LE_64(val) LE_64_TO_NATIVE(((uint8_t *)(val)))
+ 
+-/* Little endian */
+-
+-#define LE_16(val) SAME_ENDIAN_16(((uint8_t *)(val)))
+-#define LE_32(val) SAME_ENDIAN_32(((uint8_t *)(val)))
+-#define LE_64(val) SAME_ENDIAN_64(((uint8_t *)(val)))
+-#define BE_16(val) SWAP_ENDIAN_16(((uint8_t *)(val)))
+-#define BE_32(val) SWAP_ENDIAN_32(((uint8_t *)(val)))
+-#define BE_64(val) SWAP_ENDIAN_64(((uint8_t *)(val)))
+-
+-#elif WORDS_BIGENDIAN == 1
+-
+-/* Big endian */
+-
+-#define LE_16(val) SWAP_ENDIAN_16(((uint8_t *)(val)))
+-#define LE_32(val) SWAP_ENDIAN_32(((uint8_t *)(val)))
+-#define LE_64(val) SWAP_ENDIAN_64(((uint8_t *)(val)))
+-#define BE_16(val) SAME_ENDIAN_16(((uint8_t *)(val)))
+-#define BE_32(val) SAME_ENDIAN_32(((uint8_t *)(val)))
+-#define BE_64(val) SAME_ENDIAN_64(((uint8_t *)(val)))
+-
+-#else
+-#error Unknown endianness!
+ #endif
+-
+-#endif /* BSWAP_H_INCLUDED */
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d6f0074
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Fixup-bswap.h-macros.patch

-- 
libmms packaging



More information about the pkg-multimedia-commits mailing list