From f159f8034a902dfddaabd2761782b9caeacf2b7c Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 4 Apr 2014 12:41:09 +0200 Subject: [PATCH] BITCOUNT/BITPOS fixed to work with LZF encoded objects. --- src/bitops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bitops.c b/src/bitops.c index 9ce463445..894e154ed 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -458,6 +458,7 @@ void bitcountCommand(redisClient *c) { /* Set the 'p' pointer to the string, that can be just a stack allocated * array if our string was integer encoded. */ + if (lzfEncodedObject(o)) o = dbUnshareStringValue(c->db,c->argv[1],o); if (o->encoding == REDIS_ENCODING_INT) { p = (unsigned char*) llbuf; strlen = ll2string(llbuf,sizeof(llbuf),(long)o->ptr); @@ -527,6 +528,7 @@ void bitposCommand(redisClient *c) { /* Set the 'p' pointer to the string, that can be just a stack allocated * array if our string was integer encoded. */ + if (lzfEncodedObject(o)) o = dbUnshareStringValue(c->db,c->argv[1],o); if (o->encoding == REDIS_ENCODING_INT) { p = (unsigned char*) llbuf; strlen = ll2string(llbuf,sizeof(llbuf),(long)o->ptr); -- GitLab