Cherrypicked diff from svn; fix the internal implementation of htonll/ntohll

which was incorrect and would cause IAX interoperation to break. ok jasper@
This commit is contained in:
sthen 2011-01-20 16:26:26 +00:00
parent 84291d928e
commit 9412bacbc5
2 changed files with 54 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.98 2011/01/19 11:25:16 sthen Exp $
# $OpenBSD: Makefile,v 1.99 2011/01/20 16:26:26 sthen Exp $
SHARED_ONLY= Yes
COMMENT-main= open source multi-protocol PBX and telephony toolkit
VER= 1.8.2.1
REVISION= 0
DISTNAME= asterisk-${VER:S/beta/-beta/:S/rc/-rc/}
PKGNAME-main= asterisk-${VER}

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-main_strcompat_c,v 1.1 2011/01/20 16:26:26 sthen Exp $
r301263 from svn; fix byte-order conversions for little-endian machines.
--- main/strcompat.c.orig Thu Jan 20 09:07:25 2011
+++ main/strcompat.c Thu Jan 20 09:09:42 2011
@@ -367,14 +367,14 @@ uint64_t ntohll(uint64_t net64)
} number;
number.u = net64;
return
- (((uint64_t) number.c[0]) << 0) |
- (((uint64_t) number.c[1]) << 8) |
- (((uint64_t) number.c[2]) << 16) |
- (((uint64_t) number.c[3]) << 24) |
- (((uint64_t) number.c[4]) << 32) |
- (((uint64_t) number.c[5]) << 40) |
- (((uint64_t) number.c[6]) << 48) |
- (((uint64_t) number.c[7]) << 56);
+ (((uint64_t) number.c[0]) << 56) |
+ (((uint64_t) number.c[1]) << 48) |
+ (((uint64_t) number.c[2]) << 40) |
+ (((uint64_t) number.c[3]) << 32) |
+ (((uint64_t) number.c[4]) << 24) |
+ (((uint64_t) number.c[5]) << 16) |
+ (((uint64_t) number.c[6]) << 8) |
+ (((uint64_t) number.c[7]) << 0);
#else
#error "Unknown byte order"
#endif
@@ -393,14 +393,14 @@ uint64_t htonll(uint64_t host64)
} number;
number.u = host64;
return
- (((uint64_t) number.c[0]) << 0) |
- (((uint64_t) number.c[1]) << 8) |
- (((uint64_t) number.c[2]) << 16) |
- (((uint64_t) number.c[3]) << 24) |
- (((uint64_t) number.c[4]) << 32) |
- (((uint64_t) number.c[5]) << 40) |
- (((uint64_t) number.c[6]) << 48) |
- (((uint64_t) number.c[7]) << 56);
+ (((uint64_t) number.c[0]) << 56) |
+ (((uint64_t) number.c[1]) << 48) |
+ (((uint64_t) number.c[2]) << 40) |
+ (((uint64_t) number.c[3]) << 32) |
+ (((uint64_t) number.c[4]) << 24) |
+ (((uint64_t) number.c[5]) << 16) |
+ (((uint64_t) number.c[6]) << 8) |
+ (((uint64_t) number.c[7]) << 0);
#else
#error "Unknown byte order"
#endif