Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f159f803
Commit
f159f803
authored
Apr 04, 2014
by
antirez
Browse files
BITCOUNT/BITPOS fixed to work with LZF encoded objects.
parent
f7501fb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bitops.c
View file @
f159f803
...
@@ -458,6 +458,7 @@ void bitcountCommand(redisClient *c) {
...
@@ -458,6 +458,7 @@ void bitcountCommand(redisClient *c) {
/* Set the 'p' pointer to the string, that can be just a stack allocated
/* Set the 'p' pointer to the string, that can be just a stack allocated
* array if our string was integer encoded. */
* array if our string was integer encoded. */
if
(
lzfEncodedObject
(
o
))
o
=
dbUnshareStringValue
(
c
->
db
,
c
->
argv
[
1
],
o
);
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
p
=
(
unsigned
char
*
)
llbuf
;
p
=
(
unsigned
char
*
)
llbuf
;
strlen
=
ll2string
(
llbuf
,
sizeof
(
llbuf
),(
long
)
o
->
ptr
);
strlen
=
ll2string
(
llbuf
,
sizeof
(
llbuf
),(
long
)
o
->
ptr
);
...
@@ -527,6 +528,7 @@ void bitposCommand(redisClient *c) {
...
@@ -527,6 +528,7 @@ void bitposCommand(redisClient *c) {
/* Set the 'p' pointer to the string, that can be just a stack allocated
/* Set the 'p' pointer to the string, that can be just a stack allocated
* array if our string was integer encoded. */
* array if our string was integer encoded. */
if
(
lzfEncodedObject
(
o
))
o
=
dbUnshareStringValue
(
c
->
db
,
c
->
argv
[
1
],
o
);
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
p
=
(
unsigned
char
*
)
llbuf
;
p
=
(
unsigned
char
*
)
llbuf
;
strlen
=
ll2string
(
llbuf
,
sizeof
(
llbuf
),(
long
)
o
->
ptr
);
strlen
=
ll2string
(
llbuf
,
sizeof
(
llbuf
),(
long
)
o
->
ptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment