From d593c48869e1c815fd4b270a1820e71165dafba5 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Sat, 29 May 2010 16:22:24 +0200 Subject: [PATCH] modify compare function to check if the encoding is equal before comparing --- ziplist.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ziplist.c b/ziplist.c index 50b92514..08253f37 100644 --- a/ziplist.c +++ b/ziplist.c @@ -461,12 +461,12 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int sle return 0; } } else { + /* Try to compare encoded values */ if (zipTryEncoding(s,&sval,&sencoding)) { - /* Do integer compare */ - val = zipLoadInteger(p+entry.headersize,entry.encoding); - return val == sval; - } else { - /* Ziplist entry is integer encoded, but given entry is not. */ + if (entry.encoding == sencoding) { + val = zipLoadInteger(p+entry.headersize,entry.encoding); + return val == sval; + } } } return 0; -- 2.47.2