diff options
author | antirez <antirez@gmail.com> | 2011-03-09 17:31:02 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2011-03-09 17:31:02 +0100 |
commit | 336c82d58379205b789f3ca9cefc7c2090808fb8 (patch) | |
tree | 299189162a8780b29ebdf178ad0d6d5083caa523 /src/zipmap.c | |
parent | b5325132f1c8bc90e6c87392c54724ca33388ee8 (diff) | |
download | redis-336c82d58379205b789f3ca9cefc7c2090808fb8.tar.gz |
zipmaps are now endianess agnostic, needed for on disk serialization of zipmaps without convertions layers
Diffstat (limited to 'src/zipmap.c')
-rw-r--r-- | src/zipmap.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/zipmap.c b/src/zipmap.c index 693db7b93..9f0fc7181 100644 --- a/src/zipmap.c +++ b/src/zipmap.c @@ -80,6 +80,7 @@ #include <string.h> #include <assert.h> #include "zmalloc.h" +#include "endian.h" #define ZIPMAP_BIGLEN 254 #define ZIPMAP_END 255 @@ -108,6 +109,7 @@ static unsigned int zipmapDecodeLength(unsigned char *p) { if (len < ZIPMAP_BIGLEN) return len; memcpy(&len,p+1,sizeof(unsigned int)); + memrev32ifbe(&len); return len; } @@ -123,6 +125,7 @@ static unsigned int zipmapEncodeLength(unsigned char *p, unsigned int len) { } else { p[0] = ZIPMAP_BIGLEN; memcpy(p+1,&len,sizeof(len)); + memrev32ifbe(p+1); return 1+sizeof(len); } } |