Skip to contentSkip to conversation

Fix libdvbv5 endianess function for embedded toolchains

PATCH New Gregor Jasny 2 participants 3 messages Aug 21, 2012 – Aug 22, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix libdvbv5 endianess function for embedded toolchains

Hello,

the following patch fixes compilation of libdvbv5 with the Code Sourcery ARM toolchain. It replaces the missing be16toh and be32toh with the available ntohs and ntohl.

IMHO the bswap16/32 macro names should be replaced because the current name suggests unconditional swap regardless of the host architecture.

Thanks,
Gregor

Gregor Jasny (1):
libdvbv5: Fix byte swapping for embedded toolchains

 lib/include/descriptors.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 libdvbv5: Fix byte swapping for embedded toolchains

---
 lib/include/descriptors.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/include/descriptors.h +3 -3
index 9039014..a64370c 100644
@@ -25,7 +25,7 @@
 #ifndef _DESCRIPTORS_H
 #define _DESCRIPTORS_H
 
-#include <endian.h>
+#include <arpa/inet.h>
 #include <unistd.h>
 #include <stdint.h>
 
@@ -46,11 +46,11 @@ extern char *default_charset;
 extern char *output_charset;
 
 #define bswap16(b) do {\
-	b = be16toh(b); \
+	b = ntohs(b); \
 } while (0)
 
 #define bswap32(b) do {\
-	b = be32toh(b); \
+	b = ntohl(b); \
 } while (0)
 
 struct dvb_desc {
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] libdvbv5: Fix byte swapping for embedded toolchains

Hi Gregor,

Thanks for the patch.

Quoted 2 lines · Gregor Jasny

Thx,
--Prabhakar

Quoted 32 lines
---
 lib/include/descriptors.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/include/descriptors.h +3 -3
index 9039014..a64370c 100644
@@ -25,7 +25,7 @@
 #ifndef _DESCRIPTORS_H
 #define _DESCRIPTORS_H
 
-#include <endian.h>
+#include <arpa/inet.h>
 #include <unistd.h>
 #include <stdint.h>
 
@@ -46,11 +46,11 @@ extern char *default_charset;
 extern char *output_charset;
 
 #define bswap16(b) do {\
-	b = be16toh(b); \
+	b = ntohs(b); \
 } while (0)
 
 #define bswap32(b) do {\
-	b = be32toh(b); \
+	b = ntohl(b); \
 } while (0)
 
 struct dvb_desc {