modules: correct protolen

This commit is contained in:
Sun He 2016-04-06 22:42:24 +08:00 committed by antirez
parent 4efe9e19c1
commit fded8aa4e5

View File

@ -855,7 +855,7 @@ void moduleParseCallReply_BulkString(RedisModuleCallReply *reply) {
string2ll(proto+1,p-proto-1,&bulklen); string2ll(proto+1,p-proto-1,&bulklen);
if (bulklen == -1) { if (bulklen == -1) {
reply->protolen = proto-p+2; reply->protolen = p-proto+2;
reply->type = REDISMODULE_REPLY_NULL; reply->type = REDISMODULE_REPLY_NULL;
} else { } else {
reply->val.str = p+2; reply->val.str = p+2;
@ -871,7 +871,7 @@ void moduleParseCallReply_SimpleString(RedisModuleCallReply *reply) {
reply->val.str = proto+1; reply->val.str = proto+1;
reply->len = p-proto-1; reply->len = p-proto-1;
reply->protolen = proto-p+2; reply->protolen = p-proto+2;
reply->type = proto[0] == '+' ? REDISMODULE_REPLY_STRING : reply->type = proto[0] == '+' ? REDISMODULE_REPLY_STRING :
REDISMODULE_REPLY_ERROR; REDISMODULE_REPLY_ERROR;
} }
@ -885,7 +885,7 @@ void moduleParseCallReply_Array(RedisModuleCallReply *reply) {
p += 2; p += 2;
if (arraylen == -1) { if (arraylen == -1) {
reply->protolen = proto-p; reply->protolen = p-proto;
reply->type = REDISMODULE_REPLY_NULL; reply->type = REDISMODULE_REPLY_NULL;
return; return;
} }
@ -900,7 +900,7 @@ void moduleParseCallReply_Array(RedisModuleCallReply *reply) {
moduleParseCallReply(ele); moduleParseCallReply(ele);
p += ele->protolen; p += ele->protolen;
} }
reply->protolen = proto-p; reply->protolen = p-proto;
reply->type = REDISMODULE_REPLY_ARRAY; reply->type = REDISMODULE_REPLY_ARRAY;
} }