[SCM] crtmpserver/master: Add patch which fixes big endian implementation

jet-guest at users.alioth.debian.org jet-guest at users.alioth.debian.org
Fri May 6 14:35:51 UTC 2011


The following commit has been merged in the master branch:
commit 911e8a68e8fbd4323827f2b51704c1b9dcb5bfb6
Author: Andriy Beregovenko <jet at jet.kiev.ua>
Date:   Fri May 6 17:33:20 2011 +0300

    Add patch which fixes big endian implementation

diff --git a/debian/patches/17_fix_bigendian_defines.diff b/debian/patches/17_fix_bigendian_defines.diff
new file mode 100644
index 0000000..1b4eb9f
--- /dev/null
+++ b/debian/patches/17_fix_bigendian_defines.diff
@@ -0,0 +1,82 @@
+Description: Fix endianess implementation for big endian platform
+ Reimplement endianess for big-endian architectures
+Author: Andriy Beregovenko <jet at jet.kiev.ua>
+Last-Update: 2011-04-06
+
+--- crtmpserver.orig/common/include/platform/endianess/big_endian_byte_aligned.h
++++ crtmpserver/common/include/platform/endianess/big_endian_byte_aligned.h
+@@ -17,27 +17,58 @@
+  *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ 
+-
+ #ifndef _BIG_ENDIAN_BYTE_ALIGNED_H
+ #define	_BIG_ENDIAN_BYTE_ALIGNED_H
+ 
+-#define htonll(x)   (x)
+-#define ntohll(x)   (x)
++//64 bit
++#ifndef DONT_DEFINE_HTONLL
++#define htonll(x)	(x)
++#define ntohll(x)	(x)
++#endif /* DONT_DEFINE_HTONLL */
+ 
+-//adobe shit. Sometimes, Adobe's reprezentation of 0x0a0b0c0d
+-//in "network-order" is like this: 0b 0c 0d 0a
+-#define htona(x)    (((x)<<8)|((x)>>24))
+-#define ntoha(x)    (((x)>>8)|((x)<<24))
++//64 bit
++#define EHTONLL(x) htonll(x)
++#define ENTOHLL(x) ntohll(x)
+ 
+-#define ntohsp(x) ntohs(*((uint16_t *)(x)))
+-#define ntohlp(x) ntohl(*((uint32_t *)(x)))
+-#define ntohap(x) ntoha(*((uint32_t *)(x)))
+-#define ntohllp(x) ntohll(*((uint64_t *)(x)))
++//double
++#define EHTOND(hostDoubleVal,networkUI64Val) networkUI64Val=EHTONLL((*((uint64_t *)(&(hostDoubleVal)))))
++#define ENTOHD(networkUI64Val,hostDoubleVal) \
++do {\
++	uint64_t ___tempHostENTOHD=ENTOHLL(networkUI64Val); \
++	hostDoubleVal=(double)(*((double *)&___tempHostENTOHD)); \
++} while(0)
+ 
+-#define put_htons(x,v) (*((uint16_t*)(x)) = htons(v))
+-#define put_htonl(x,v) (*((uint32_t*)(x)) = htonl(v))
+-#define put_htonll(x,v) (*((uint64_t*)(x)) = htonll(v))
+-/* TODO: Do we need put_value methods for aligned access when not swapping bytes */
+-/* TODO: Do we need put_htonll() or put_htona() */
++//32 bit
++#define EHTONL(x) htonl(x)
++#define ENTOHL(x) ntohl(x)
+ 
++//16 bit
++#define EHTONS(x) htons(x)
++#define ENTOHS(x) ntohs(x)
++
++//adobe
++#define EHTONA(x)    (((x)<<8)|((x)>>24))
++#define ENTOHA(x)    (((x)>>8)|((x)<<24))
++
++//64 bit pointer
++#define EHTONLLP(pNetworkPointer,hostLongLongValue) (*((uint64_t*)(pNetworkPointer)) = EHTONLL(hostLongLongValue))
++#define ENTOHLLP(pNetworkPointer) ENTOHLL(*((uint64_t *)(pNetworkPointer)))
++
++//double pointer
++#define EHTONDP(hostDoubleVal,pNetworkPointer) EHTOND(hostDoubleVal,(*((uint64_t *)(pNetworkPointer))))
++#define ENTOHDP(pNetworkPointer,hostDoubleVal) ENTOHD((*((uint64_t *)(pNetworkPointer))),hostDoubleVal)
++
++//32 bit pointer
++#define EHTONLP(pNetworkPointer,hostLongValue) (*((uint32_t*)(pNetworkPointer)) = EHTONL(hostLongValue))
++#define ENTOHLP(pNetworkPointer) ENTOHL(*((uint32_t *)(pNetworkPointer)))
++
++//16 bit pointer
++#define EHTONSP(pNetworkPointer,hostShortValue) (*((uint16_t*)(pNetworkPointer)) = EHTONS(hostShortValue))
++#define ENTOHSP(pNetworkPointer) ENTOHS(*((uint16_t *)(pNetworkPointer)))
++
++//adobe pointer
++#define EHTONAP(pNetworkPointer,hostAdobeValue) (*((uint32_t*)(pNetworkPointer)) = EHTONA(hostAdobeValue))
++#define ENTOHAP(pNetworkPointer) ENTOHA(*((uint32_t *)(pNetworkPointer)))
++
+ #endif	/* _BIG_ENDIAN_BYTE_ALIGNED_H */
++
diff --git a/debian/patches/series b/debian/patches/series
index 7fbef3a..981e222 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 13_disable_lua_config_install.diff
 15_use_system_lua.diff
 16_fix_rvalue_access.diff
+17_fix_bigendian_defines.diff

-- 
crtmpserver packaging



More information about the pkg-multimedia-commits mailing list