X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/b19c33d48a3b5456b87f84c85fdd85592e0c0562..75b41de8ca975d01c6371a98f9e552c934af5937:/src/t_hash.c?ds=sidebyside diff --git a/src/t_hash.c b/src/t_hash.c index 5cef1cab..0f568b97 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -220,6 +220,7 @@ void hsetCommand(redisClient *c) { robj *o; if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; + c->argv[3] = tryObjectEncoding(c->argv[3]); hashTypeTryConversion(o,c->argv,2,3); hashTypeTryObjectEncoding(o,&c->argv[2], &c->argv[3]); update = hashTypeSet(o,c->argv[2],c->argv[3]); @@ -231,6 +232,7 @@ void hsetCommand(redisClient *c) { void hsetnxCommand(redisClient *c) { robj *o; if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; + c->argv[3] = tryObjectEncoding(c->argv[3]); hashTypeTryConversion(o,c->argv,2,3); if (hashTypeExists(o, c->argv[2])) { @@ -254,6 +256,7 @@ void hmsetCommand(redisClient *c) { } if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; + c->argv[c->argc-1] = tryObjectEncoding(c->argv[c->argc-1]); hashTypeTryConversion(o,c->argv,2,c->argc-1); for (i = 2; i < c->argc; i += 2) { hashTypeTryObjectEncoding(o,&c->argv[i], &c->argv[i+1]); @@ -296,6 +299,7 @@ void hgetCommand(redisClient *c) { if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL || checkType(c,o,REDIS_HASH)) return; + c->argv[2] = tryObjectEncoding(c->argv[2]); if ((value = hashTypeGet(o,c->argv[2])) != NULL) { addReplyBulk(c,value); decrRefCount(value); @@ -316,6 +320,7 @@ void hmgetCommand(redisClient *c) { * done because objects that cannot be found are considered to be * an empty hash. The reply should then be a series of NULLs. */ addReplyMultiBulkLen(c,c->argc-2); + c->argv[c->argc-1] = tryObjectEncoding(c->argv[c->argc-1]); for (i = 2; i < c->argc; i++) { if (o != NULL && (value = hashTypeGet(o,c->argv[i])) != NULL) { addReplyBulk(c,value); @@ -331,6 +336,7 @@ void hdelCommand(redisClient *c) { if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL || checkType(c,o,REDIS_HASH)) return; + c->argv[2] = tryObjectEncoding(c->argv[2]); if (hashTypeDelete(o,c->argv[2])) { if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]); addReply(c,shared.cone); @@ -395,5 +401,6 @@ void hexistsCommand(redisClient *c) { if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || checkType(c,o,REDIS_HASH)) return; + c->argv[2] = tryObjectEncoding(c->argv[2]); addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero); }