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
949a2748
Commit
949a2748
authored
Oct 22, 2016
by
sunhe
Browse files
bitops.c/bitfieldCommand: update higest_write_offset with check
parent
f39e7d4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bitops.c
View file @
949a2748
...
@@ -907,7 +907,7 @@ void bitfieldCommand(client *c) {
...
@@ -907,7 +907,7 @@ void bitfieldCommand(client *c) {
struct
bitfieldOp
*
ops
=
NULL
;
/* Array of ops to execute at end. */
struct
bitfieldOp
*
ops
=
NULL
;
/* Array of ops to execute at end. */
int
owtype
=
BFOVERFLOW_WRAP
;
/* Overflow type. */
int
owtype
=
BFOVERFLOW_WRAP
;
/* Overflow type. */
int
readonly
=
1
;
int
readonly
=
1
;
long
higest_write_offset
=
0
;
size_t
higest_write_offset
=
0
;
for
(
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
for
(
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
int
remargs
=
c
->
argc
-
j
-
1
;
/* Remaining args other than current. */
int
remargs
=
c
->
argc
-
j
-
1
;
/* Remaining args other than current. */
...
@@ -957,7 +957,8 @@ void bitfieldCommand(client *c) {
...
@@ -957,7 +957,8 @@ void bitfieldCommand(client *c) {
if
(
opcode
!=
BITFIELDOP_GET
)
{
if
(
opcode
!=
BITFIELDOP_GET
)
{
readonly
=
0
;
readonly
=
0
;
higest_write_offset
=
bitoffset
+
bits
-
1
;
if
(
higest_write_offset
<
bitoffset
+
bits
-
1
)
higest_write_offset
=
bitoffset
+
bits
-
1
;
/* INCRBY and SET require another argument. */
/* INCRBY and SET require another argument. */
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
j
+
3
],
&
i64
,
NULL
)
!=
C_OK
){
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
j
+
3
],
&
i64
,
NULL
)
!=
C_OK
){
zfree
(
ops
);
zfree
(
ops
);
...
...
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