Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d9f00941
Commit
d9f00941
authored
Sep 04, 2014
by
antirez
Browse files
Merge branch 'unstable' of github.com:/antirez/redis into unstable
parents
0a6cbabb
0019479f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_string.c
View file @
d9f00941
...
...
@@ -231,13 +231,13 @@ void setrangeCommand(redisClient *c) {
void
getrangeCommand
(
redisClient
*
c
)
{
robj
*
o
;
long
start
,
end
;
long
long
start
,
end
;
char
*
str
,
llbuf
[
32
];
size_t
strlen
;
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
start
,
NULL
)
!=
REDIS_OK
)
if
(
getLong
Long
FromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
start
,
NULL
)
!=
REDIS_OK
)
return
;
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
3
],
&
end
,
NULL
)
!=
REDIS_OK
)
if
(
getLong
Long
FromObjectOrReply
(
c
,
c
->
argv
[
3
],
&
end
,
NULL
)
!=
REDIS_OK
)
return
;
if
((
o
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
emptybulk
))
==
NULL
||
checkType
(
c
,
o
,
REDIS_STRING
))
return
;
...
...
@@ -255,11 +255,11 @@ void getrangeCommand(redisClient *c) {
if
(
end
<
0
)
end
=
strlen
+
end
;
if
(
start
<
0
)
start
=
0
;
if
(
end
<
0
)
end
=
0
;
if
((
size_t
)
end
>=
strlen
)
end
=
strlen
-
1
;
if
((
unsigned
long
long
)
end
>=
strlen
)
end
=
strlen
-
1
;
/* Precondition: end >= 0 && end < strlen, so the only condition where
* nothing can be returned is: start > end. */
if
(
start
>
end
)
{
if
(
start
>
end
||
strlen
==
0
)
{
addReply
(
c
,
shared
.
emptybulk
);
}
else
{
addReplyBulkCBuffer
(
c
,(
char
*
)
str
+
start
,
end
-
start
+
1
);
...
...
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