[sr-dev] git:master:87fa15aa: xmpp: use in tree portable endianness macros

Spencer Thomason spencer at whiteskycommunications.com
Wed Aug 10 09:07:49 CEST 2016


Module: kamailio
Branch: master
Commit: 87fa15aa293b00d614a9a97bf1c3f46e3239161c
URL: https://github.com/kamailio/kamailio/commit/87fa15aa293b00d614a9a97bf1c3f46e3239161c

Author: Spencer Thomason <spencer at whiteskycommunications.com>
Committer: Spencer Thomason <spencer at whiteskycommunications.com>
Date: 2016-08-09T15:14:32-07:00

xmpp: use in tree portable endianness macros

- replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN
- not all platforms define WORDS_BIGENDIAN on big endian archs

---

Modified: modules/xmpp/sha.c

---

Diff:  https://github.com/kamailio/kamailio/commit/87fa15aa293b00d614a9a97bf1c3f46e3239161c.diff
Patch: https://github.com/kamailio/kamailio/commit/87fa15aa293b00d614a9a97bf1c3f46e3239161c.patch

---

diff --git a/modules/xmpp/sha.c b/modules/xmpp/sha.c
index e1ca80f..fcdc313 100644
--- a/modules/xmpp/sha.c
+++ b/modules/xmpp/sha.c
@@ -49,6 +49,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <string.h>
+#include "../../endianness.h"
 
 #ifndef MACOS
 #  include <sys/stat.h>
@@ -104,7 +105,7 @@ sha_hash(int *data, int *hash)
 
   for (t=0; t<16; t++) 
     {
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
       W[t]=switch_endianness(data[t]);
 #else 
       W[t]=data[t];
@@ -244,7 +245,7 @@ char *shahash(const char *str)
 				for (i=0; i<14; i++) 
 					((int*)read_buffer)[i]=0;
 			}      
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
 			for (i=0; i<8; i++) 
 			{
 				read_buffer[56+i]=(char)(length>>(56-(i*8))) & 0xff;




More information about the sr-dev mailing list