[sr-dev] git:master:2dff64ce: Merge pull request #742 from sjthomason/use-portable-endian-macros

GitHub noreply at github.com
Wed Aug 10 09:07:53 CEST 2016


Module: kamailio
Branch: master
Commit: 2dff64ce9c09a7e991af023f25282f269abe83b2
URL: https://github.com/kamailio/kamailio/commit/2dff64ce9c09a7e991af023f25282f269abe83b2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2016-08-10T09:07:45+02:00

Merge pull request #742 from sjthomason/use-portable-endian-macros

Use portable endian macros

---

Modified: md5.c
Modified: modules/acc/diam_message.h
Modified: modules/auth_diameter/diameter_msg.h
Modified: modules/cdp/diameter.h
Modified: modules/xmpp/sha.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2dff64ce9c09a7e991af023f25282f269abe83b2.diff
Patch: https://github.com/kamailio/kamailio/commit/2dff64ce9c09a7e991af023f25282f269abe83b2.patch

---

diff --git a/md5.c b/md5.c
index d675dd1..fdb166a 100644
--- a/md5.c
+++ b/md5.c
@@ -20,6 +20,7 @@
 #include <sys/types.h>
 #include <string.h>
 
+#include "endianness.h"
 #include "md5.h"
 
 #ifndef __OS_solaris
@@ -159,7 +160,7 @@ MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH])
 {
 	u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
 
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
 	memcpy(in, block, sizeof(in));
 #else
 	for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {
diff --git a/modules/acc/diam_message.h b/modules/acc/diam_message.h
index d5e3535..b1d81cb 100644
--- a/modules/acc/diam_message.h
+++ b/modules/acc/diam_message.h
@@ -38,6 +38,7 @@
 
 #include "../../str.h"
 #include "../../mem/mem.h"
+#include "../../endianness.h"
 
 #define ad_malloc	pkg_malloc
 #define ad_free		pkg_free
@@ -68,7 +69,7 @@
 
 /* message codes
  */
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
 	#define AS_MSG_CODE      0x12010000
 	#define AC_MSG_CODE      0x0f010000
 	#define CE_MSG_CODE      0x01010000
diff --git a/modules/auth_diameter/diameter_msg.h b/modules/auth_diameter/diameter_msg.h
index e0b9551..ebe2ce2 100644
--- a/modules/auth_diameter/diameter_msg.h
+++ b/modules/auth_diameter/diameter_msg.h
@@ -29,6 +29,7 @@
 
 #include "../../str.h"
 #include "../../mem/mem.h"
+#include "../../endianness.h"
 
 #define ad_malloc	pkg_malloc
 #define ad_free		pkg_free
@@ -59,7 +60,7 @@
 
 /* message codes
  */
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
 	#define AS_MSG_CODE      0x12010000
 	#define AC_MSG_CODE      0x0f010000
 	#define CE_MSG_CODE      0x01010000
@@ -69,7 +70,6 @@
 	#define ST_MSG_CODE      0x13010000
 	#define MASK_MSG_CODE    0xffffff00
 #else
-	#error BIG endian detected!!
 	#define AS_MSG_CODE      0x00000112
 	#define AC_MSG_CODE      0x0000010f
 	#define CE_MSG_CODE      0x00000101
diff --git a/modules/cdp/diameter.h b/modules/cdp/diameter.h
index f5ce410..df1b450 100644
--- a/modules/cdp/diameter.h
+++ b/modules/cdp/diameter.h
@@ -47,6 +47,7 @@
 
 #include "utils.h"
 #include <ctype.h>
+#include "../../endianness.h"
 
 #include "diameter_code_result.h"
 #include "diameter_code_avp.h"
@@ -104,7 +105,7 @@
 	AVP_VENDOR_ID_SIZE*(((_flags_)&AAA_AVP_FLAG_VENDOR_SPECIFIC)!=0) )
 
 /* mesage codes */
-#ifndef WORDS_BIGENDIAN
+#ifndef __IS_BIG_ENDIAN
 	#define AS_MSG_CODE      0x12010000
 	#define AC_MSG_CODE      0x0f010000
 	#define CE_MSG_CODE      0x01010000
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