set: fix the int problem for SPOP & SRANDMEMBER

This commit is contained in:
zhaozhao.zz 2017-12-05 17:19:19 +08:00
parent e6c3bcf9e0
commit de809666f8

View File

@ -407,7 +407,7 @@ void spopWithCountCommand(client *c) {
/* Get the count argument */ /* Get the count argument */
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return; if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
if (l >= 0) { if (l >= 0) {
count = (unsigned) l; count = (unsigned long) l;
} else { } else {
addReply(c,shared.outofrangeerr); addReply(c,shared.outofrangeerr);
return; return;
@ -626,7 +626,7 @@ void srandmemberWithCountCommand(client *c) {
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return; if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
if (l >= 0) { if (l >= 0) {
count = (unsigned) l; count = (unsigned long) l;
} else { } else {
/* A negative count means: return the same elements multiple times /* A negative count means: return the same elements multiple times
* (i.e. don't remove the extracted element after every extraction). */ * (i.e. don't remove the extracted element after every extraction). */