mirror of
https://github.com/fluencelabs/redis
synced 2025-03-31 14:51:04 +00:00
Fixed return value of GETRANGE / SUBSTR
This commit is contained in:
parent
4aec2ec8c4
commit
0b537972f4
@ -259,7 +259,7 @@ void getrangeCommand(redisClient *c) {
|
|||||||
return;
|
return;
|
||||||
if (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != REDIS_OK)
|
if (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != REDIS_OK)
|
||||||
return;
|
return;
|
||||||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
|
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptybulk)) == NULL ||
|
||||||
checkType(c,o,REDIS_STRING)) return;
|
checkType(c,o,REDIS_STRING)) return;
|
||||||
|
|
||||||
if (o->encoding == REDIS_ENCODING_INT) {
|
if (o->encoding == REDIS_ENCODING_INT) {
|
||||||
@ -280,7 +280,7 @@ void getrangeCommand(redisClient *c) {
|
|||||||
/* Precondition: end >= 0 && end < strlen, so the only condition where
|
/* Precondition: end >= 0 && end < strlen, so the only condition where
|
||||||
* nothing can be returned is: start > end. */
|
* nothing can be returned is: start > end. */
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
addReply(c,shared.nullbulk);
|
addReply(c,shared.emptybulk);
|
||||||
} else {
|
} else {
|
||||||
addReplyBulkCBuffer(c,(char*)str+start,end-start+1);
|
addReplyBulkCBuffer(c,(char*)str+start,end-start+1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user