Skip to content

Commit

Permalink
xmpp: use in tree portable endianness macros
Browse files Browse the repository at this point in the history
- replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN
- not all platforms define WORDS_BIGENDIAN on big endian archs
  • Loading branch information
sjthomason committed Aug 9, 2016
1 parent a91ca63 commit 87fa15a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/xmpp/sha.c
Expand Up @@ -49,6 +49,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "../../endianness.h"

#ifndef MACOS
# include <sys/stat.h>
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 87fa15a

Please sign in to comment.