diff --git a/src/db.c b/src/db.c index b4190f86..2219194b 100644 --- a/src/db.c +++ b/src/db.c @@ -480,8 +480,7 @@ void existsCommand(client *c) { int j; for (j = 1; j < c->argc; j++) { - expireIfNeeded(c->db,c->argv[j]); - if (dbExists(c->db,c->argv[j])) count++; + if (lookupKeyRead(c->db,c->argv[j])) count++; } addReplyLongLong(c,count); } diff --git a/src/geohash.c b/src/geohash.c index 1ae7a7e0..b40282e7 100644 --- a/src/geohash.c +++ b/src/geohash.c @@ -144,8 +144,8 @@ int geohashEncode(const GeoHashRange *long_range, const GeoHashRange *lat_range, (longitude - long_range->min) / (long_range->max - long_range->min); /* convert to fixed point based on the step size */ - lat_offset *= (1 << step); - long_offset *= (1 << step); + lat_offset *= (1ULL << step); + long_offset *= (1ULL << step); hash->bits = interleave64(lat_offset, long_offset); return 1; } diff --git a/src/networking.c b/src/networking.c index 00558974..02e77307 100644 --- a/src/networking.c +++ b/src/networking.c @@ -247,7 +247,7 @@ void _addReplyStringToList(client *c, const char *s, size_t len) { /* Append to this object when possible. If tail == NULL it was * set via addDeferredMultiBulkLength(). */ - if (tail && sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES) { + if (tail && (sdsavail(tail) >= len || sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES)) { tail = sdscatlen(tail,s,len); listNodeValue(ln) = tail; c->reply_bytes += len;