]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Little endian machines were not converted properly.
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 10 Jan 2011 22:39:31 +0000 (22:39 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 10 Jan 2011 22:39:31 +0000 (22:39 +0000)
(closes issue #18583)
Reported by: jcovert
Patches:
      20110110__issue18583.diff.txt uploaded by tilghman (license 14)
Tested by: jcovert

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@301263 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/strcompat.c

index e718cc6287362b78e64693c1b4b73d10e5ada1cd..97faae73f4ffa3288216d23f5c9729045b1c3088 100644 (file)
@@ -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