Remove warnings and improve integer sign correctness.

This commit is contained in:
antirez 2014-08-13 11:44:38 +02:00
parent 7e3ccddc6d
commit edca2b14d2
17 changed files with 66 additions and 48 deletions

View File

@ -117,6 +117,8 @@ int anetKeepAlive(char *err, int fd, int interval)
anetSetError(err, "setsockopt TCP_KEEPCNT: %s\n", strerror(errno)); anetSetError(err, "setsockopt TCP_KEEPCNT: %s\n", strerror(errno));
return ANET_ERR; return ANET_ERR;
} }
#else
((void) interval); /* Avoid unused var warning for non Linux systems. */
#endif #endif
return ANET_OK; return ANET_OK;

View File

@ -95,6 +95,10 @@ void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask) {
listNode *ln; listNode *ln;
aofrwblock *block; aofrwblock *block;
ssize_t nwritten; ssize_t nwritten;
REDIS_NOTUSED(el);
REDIS_NOTUSED(fd);
REDIS_NOTUSED(privdata);
REDIS_NOTUSED(mask);
while(1) { while(1) {
ln = listFirst(server.aof_rewrite_buf_blocks); ln = listFirst(server.aof_rewrite_buf_blocks);
@ -177,7 +181,7 @@ ssize_t aofRewriteBufferWrite(int fd) {
if (block->used) { if (block->used) {
nwritten = write(fd,block->buf,block->used); nwritten = write(fd,block->buf,block->used);
if (nwritten != block->used) { if (nwritten != (ssize_t)block->used) {
if (nwritten == 0) errno = EIO; if (nwritten == 0) errno = EIO;
return -1; return -1;
} }
@ -1128,6 +1132,9 @@ werr:
* parent sends a '!' as well to acknowledge. */ * parent sends a '!' as well to acknowledge. */
void aofChildPipeReadable(aeEventLoop *el, int fd, void *privdata, int mask) { void aofChildPipeReadable(aeEventLoop *el, int fd, void *privdata, int mask) {
char byte; char byte;
REDIS_NOTUSED(el);
REDIS_NOTUSED(privdata);
REDIS_NOTUSED(mask);
if (read(fd,&byte,1) == 1 && byte == '!') { if (read(fd,&byte,1) == 1 && byte == '!') {
redisLog(REDIS_NOTICE,"AOF rewrite child asks to stop sending diffs."); redisLog(REDIS_NOTICE,"AOF rewrite child asks to stop sending diffs.");

View File

@ -107,12 +107,12 @@ size_t redisPopcount(void *s, long count) {
* no zero bit is found, it returns count*8 assuming the string is zero * no zero bit is found, it returns count*8 assuming the string is zero
* padded on the right. However if 'bit' is 1 it is possible that there is * padded on the right. However if 'bit' is 1 it is possible that there is
* not a single set bit in the bitmap. In this special case -1 is returned. */ * not a single set bit in the bitmap. In this special case -1 is returned. */
long redisBitpos(void *s, long count, int bit) { long redisBitpos(void *s, unsigned long count, int bit) {
unsigned long *l; unsigned long *l;
unsigned char *c; unsigned char *c;
unsigned long skipval, word = 0, one; unsigned long skipval, word = 0, one;
long pos = 0; /* Position of bit, to return to the caller. */ long pos = 0; /* Position of bit, to return to the caller. */
int j; unsigned long j;
/* Process whole words first, seeking for first word that is not /* Process whole words first, seeking for first word that is not
* all ones or all zeros respectively if we are lookig for zeros * all ones or all zeros respectively if we are lookig for zeros
@ -276,11 +276,12 @@ void getbitCommand(redisClient *c) {
void bitopCommand(redisClient *c) { void bitopCommand(redisClient *c) {
char *opname = c->argv[1]->ptr; char *opname = c->argv[1]->ptr;
robj *o, *targetkey = c->argv[2]; robj *o, *targetkey = c->argv[2];
long op, j, numkeys; unsigned long op, j, numkeys;
robj **objects; /* Array of source objects. */ robj **objects; /* Array of source objects. */
unsigned char **src; /* Array of source strings pointers. */ unsigned char **src; /* Array of source strings pointers. */
long *len, maxlen = 0; /* Array of length of src strings, and max len. */ unsigned long *len, maxlen = 0; /* Array of length of src strings,
long minlen = 0; /* Min len among the input keys. */ and max len. */
unsigned long minlen = 0; /* Min len among the input keys. */
unsigned char *res = NULL; /* Resulting string. */ unsigned char *res = NULL; /* Resulting string. */
/* Parse the operation name. */ /* Parse the operation name. */
@ -320,9 +321,10 @@ void bitopCommand(redisClient *c) {
} }
/* Return an error if one of the keys is not a string. */ /* Return an error if one of the keys is not a string. */
if (checkType(c,o,REDIS_STRING)) { if (checkType(c,o,REDIS_STRING)) {
for (j = j-1; j >= 0; j--) { unsigned long i;
if (objects[j]) for (i = 0; i < j; i++) {
decrRefCount(objects[j]); if (objects[i])
decrRefCount(objects[i]);
} }
zfree(src); zfree(src);
zfree(len); zfree(len);
@ -340,7 +342,7 @@ void bitopCommand(redisClient *c) {
if (maxlen) { if (maxlen) {
res = (unsigned char*) sdsnewlen(NULL,maxlen); res = (unsigned char*) sdsnewlen(NULL,maxlen);
unsigned char output, byte; unsigned char output, byte;
long i; unsigned long i;
/* Fast path: as far as we have data for all the input bitmaps we /* Fast path: as far as we have data for all the input bitmaps we
* can take a fast path that performs much better than the * can take a fast path that performs much better than the

View File

@ -323,7 +323,7 @@ int clusterSaveConfig(int do_fsync) {
/* Pad the new payload if the existing file length is greater. */ /* Pad the new payload if the existing file length is greater. */
if (fstat(fd,&sb) != -1) { if (fstat(fd,&sb) != -1) {
if (sb.st_size > content_size) { if (sb.st_size > (off_t)content_size) {
ci = sdsgrowzero(ci,sb.st_size); ci = sdsgrowzero(ci,sb.st_size);
memset(ci+content_size,'\n',sb.st_size-content_size); memset(ci+content_size,'\n',sb.st_size-content_size);
} }
@ -1907,7 +1907,7 @@ void clusterReadHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
ssize_t nread; ssize_t nread;
clusterMsg *hdr; clusterMsg *hdr;
clusterLink *link = (clusterLink*) privdata; clusterLink *link = (clusterLink*) privdata;
int readlen, rcvbuflen; unsigned int readlen, rcvbuflen;
REDIS_NOTUSED(el); REDIS_NOTUSED(el);
REDIS_NOTUSED(mask); REDIS_NOTUSED(mask);
@ -3982,7 +3982,7 @@ void clusterCommand(redisClient *c) {
"configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH", "configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH",
(unsigned long long) myself->configEpoch); (unsigned long long) myself->configEpoch);
if (server.cluster->currentEpoch < epoch) if (server.cluster->currentEpoch < (uint64_t)epoch)
server.cluster->currentEpoch = epoch; server.cluster->currentEpoch = epoch;
/* No need to fsync the config here since in the unlucky event /* No need to fsync the config here since in the unlucky event
* of a failure to persist the config, the conflict resolution code * of a failure to persist the config, the conflict resolution code

View File

@ -629,7 +629,7 @@ void configSetCommand(redisClient *c) {
server.maxclients = orig_value; server.maxclients = orig_value;
return; return;
} }
if (aeGetSetSize(server.el) < if ((unsigned int) aeGetSetSize(server.el) <
server.maxclients + REDIS_EVENTLOOP_FDSET_INCR) server.maxclients + REDIS_EVENTLOOP_FDSET_INCR)
{ {
if (aeResizeSetSize(server.el, if (aeResizeSetSize(server.el,

View File

@ -421,9 +421,7 @@ int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *cursor) {
* In the case of a Hash object the function returns both the field and value * In the case of a Hash object the function returns both the field and value
* of every element on the Hash. */ * of every element on the Hash. */
void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) { void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) {
int rv;
int i, j; int i, j;
char buf[REDIS_LONGSTR_SIZE];
list *keys = listCreate(); list *keys = listCreate();
listNode *node, *nextnode; listNode *node, *nextnode;
long count = 10; long count = 10;
@ -503,7 +501,7 @@ void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) {
privdata[1] = o; privdata[1] = o;
do { do {
cursor = dictScan(ht, cursor, scanCallback, privdata); cursor = dictScan(ht, cursor, scanCallback, privdata);
} while (cursor && listLength(keys) < count); } while (cursor && listLength(keys) < (unsigned long)count);
} else if (o->type == REDIS_SET) { } else if (o->type == REDIS_SET) {
int pos = 0; int pos = 0;
int64_t ll; int64_t ll;
@ -577,9 +575,7 @@ void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) {
/* Step 4: Reply to the client. */ /* Step 4: Reply to the client. */
addReplyMultiBulkLen(c, 2); addReplyMultiBulkLen(c, 2);
rv = snprintf(buf, sizeof(buf), "%lu", cursor); addReplyBulkLongLong(c,cursor);
redisAssert(rv < sizeof(buf));
addReplyBulkCBuffer(c, buf, rv);
addReplyMultiBulkLen(c, listLength(keys)); addReplyMultiBulkLen(c, listLength(keys));
while ((node = listFirst(keys)) != NULL) { while ((node = listFirst(keys)) != NULL) {

View File

@ -668,9 +668,9 @@ dictEntry *dictGetRandomKey(dict *d)
* statistics. However the function is much faster than dictGetRandomKey() * statistics. However the function is much faster than dictGetRandomKey()
* at producing N elements, and the elements are guaranteed to be non * at producing N elements, and the elements are guaranteed to be non
* repeating. */ * repeating. */
int dictGetRandomKeys(dict *d, dictEntry **des, int count) { unsigned int dictGetRandomKeys(dict *d, dictEntry **des, unsigned int count) {
int j; /* internal hash table id, 0 or 1. */ int j; /* internal hash table id, 0 or 1. */
int stored = 0; unsigned int stored = 0;
if (dictSize(d) < count) count = dictSize(d); if (dictSize(d) < count) count = dictSize(d);
while(stored < count) { while(stored < count) {

View File

@ -162,7 +162,7 @@ dictIterator *dictGetSafeIterator(dict *d);
dictEntry *dictNext(dictIterator *iter); dictEntry *dictNext(dictIterator *iter);
void dictReleaseIterator(dictIterator *iter); void dictReleaseIterator(dictIterator *iter);
dictEntry *dictGetRandomKey(dict *d); dictEntry *dictGetRandomKey(dict *d);
int dictGetRandomKeys(dict *d, dictEntry **des, int count); unsigned int dictGetRandomKeys(dict *d, dictEntry **des, unsigned int count);
void dictPrintStats(dict *d); void dictPrintStats(dict *d);
unsigned int dictGenHashFunction(const void *key, int len); unsigned int dictGenHashFunction(const void *key, int len);
unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len); unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len);

View File

@ -1349,7 +1349,7 @@ void pfmergeCommand(redisClient *c) {
* Something that is not easy to test from within the outside. */ * Something that is not easy to test from within the outside. */
#define HLL_TEST_CYCLES 1000 #define HLL_TEST_CYCLES 1000
void pfselftestCommand(redisClient *c) { void pfselftestCommand(redisClient *c) {
int j, i; unsigned int j, i;
sds bitcounters = sdsnewlen(NULL,HLL_DENSE_SIZE); sds bitcounters = sdsnewlen(NULL,HLL_DENSE_SIZE);
struct hllhdr *hdr = (struct hllhdr*) bitcounters, *hdr2; struct hllhdr *hdr = (struct hllhdr*) bitcounters, *hdr2;
robj *o = NULL; robj *o = NULL;
@ -1431,7 +1431,7 @@ void pfselftestCommand(redisClient *c) {
if (j == 10) maxerr = 1; if (j == 10) maxerr = 1;
if (abserr < 0) abserr = -abserr; if (abserr < 0) abserr = -abserr;
if (abserr > maxerr) { if (abserr > (int64_t)maxerr) {
addReplyErrorFormat(c, addReplyErrorFormat(c,
"TESTFAILED Too big error. card:%llu abserr:%llu", "TESTFAILED Too big error. card:%llu abserr:%llu",
(unsigned long long) checkpoint, (unsigned long long) checkpoint,

View File

@ -37,6 +37,7 @@
/* Dictionary type for latency events. */ /* Dictionary type for latency events. */
int dictStringKeyCompare(void *privdata, const void *key1, const void *key2) { int dictStringKeyCompare(void *privdata, const void *key1, const void *key2) {
REDIS_NOTUSED(privdata);
return strcmp(key1,key2) == 0; return strcmp(key1,key2) == 0;
} }

View File

@ -1051,7 +1051,7 @@ int processMultibulkBuffer(redisClient *c) {
qblen = sdslen(c->querybuf); qblen = sdslen(c->querybuf);
/* Hint the sds library about the amount of bytes this string is /* Hint the sds library about the amount of bytes this string is
* going to contain. */ * going to contain. */
if (qblen < ll+2) if (qblen < (size_t)ll+2)
c->querybuf = sdsMakeRoomFor(c->querybuf,ll+2-qblen); c->querybuf = sdsMakeRoomFor(c->querybuf,ll+2-qblen);
} }
c->bulklen = ll; c->bulklen = ll;

View File

@ -213,7 +213,7 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
freeReplyObject(reply); freeReplyObject(reply);
if (c->selectlen) { if (c->selectlen) {
int j; size_t j;
/* This is the OK from SELECT. Just discard the SELECT /* This is the OK from SELECT. Just discard the SELECT
* from the buffer. */ * from the buffer. */
@ -359,7 +359,7 @@ static client createClient(char *cmd, size_t len, client from) {
c->randfree = 0; c->randfree = 0;
c->randptr = zmalloc(sizeof(char*)*c->randlen); c->randptr = zmalloc(sizeof(char*)*c->randlen);
/* copy the offsets. */ /* copy the offsets. */
for (j = 0; j < c->randlen; j++) { for (j = 0; j < (int)c->randlen; j++) {
c->randptr[j] = c->obuf + (from->randptr[j]-from->obuf); c->randptr[j] = c->obuf + (from->randptr[j]-from->obuf);
/* Adjust for the different select prefix length. */ /* Adjust for the different select prefix length. */
c->randptr[j] += c->selectlen - from->selectlen; c->randptr[j] += c->selectlen - from->selectlen;

View File

@ -1416,7 +1416,7 @@ static int toIntType(char *key, char *type) {
static void getKeyTypes(redisReply *keys, int *types) { static void getKeyTypes(redisReply *keys, int *types) {
redisReply *reply; redisReply *reply;
int i; unsigned int i;
/* Pipeline TYPE commands */ /* Pipeline TYPE commands */
for(i=0;i<keys->elements;i++) { for(i=0;i<keys->elements;i++) {
@ -1445,7 +1445,7 @@ static void getKeySizes(redisReply *keys, int *types,
{ {
redisReply *reply; redisReply *reply;
char *sizecmds[] = {"STRLEN","LLEN","SCARD","HLEN","ZCARD"}; char *sizecmds[] = {"STRLEN","LLEN","SCARD","HLEN","ZCARD"};
int i; unsigned int i;
/* Pipeline size commands */ /* Pipeline size commands */
for(i=0;i<keys->elements;i++) { for(i=0;i<keys->elements;i++) {
@ -1492,7 +1492,8 @@ static void findBigKeys(void) {
char *typename[] = {"string","list","set","hash","zset"}; char *typename[] = {"string","list","set","hash","zset"};
char *typeunit[] = {"bytes","items","members","fields","members"}; char *typeunit[] = {"bytes","items","members","fields","members"};
redisReply *reply, *keys; redisReply *reply, *keys;
int type, *types=NULL, arrsize=0, i; unsigned int arrsize=0, i;
int type, *types=NULL;
double pct; double pct;
/* Total keys pre scanning */ /* Total keys pre scanning */
@ -1779,7 +1780,7 @@ static void scanMode(void) {
printf("ERROR: %s\n", reply->str); printf("ERROR: %s\n", reply->str);
exit(1); exit(1);
} else { } else {
int j; unsigned int j;
cur = strtoull(reply->element[0]->str,NULL,10); cur = strtoull(reply->element[0]->str,NULL,10);
for (j = 0; j < reply->element[1]->elements; j++) for (j = 0; j < reply->element[1]->elements; j++)

View File

@ -760,8 +760,8 @@ void activeExpireCycle(int type) {
static int timelimit_exit = 0; /* Time limit hit in previous call? */ static int timelimit_exit = 0; /* Time limit hit in previous call? */
static long long last_fast_cycle = 0; /* When last fast cycle ran. */ static long long last_fast_cycle = 0; /* When last fast cycle ran. */
unsigned int j, iteration = 0; int j, iteration = 0;
unsigned int dbs_per_call = REDIS_DBCRON_DBS_PER_CALL; int dbs_per_call = REDIS_DBCRON_DBS_PER_CALL;
long long start = ustime(), timelimit; long long start = ustime(), timelimit;
if (type == ACTIVE_EXPIRE_CYCLE_FAST) { if (type == ACTIVE_EXPIRE_CYCLE_FAST) {
@ -1000,8 +1000,8 @@ void databasesCron(void) {
* cron loop iteration. */ * cron loop iteration. */
static unsigned int resize_db = 0; static unsigned int resize_db = 0;
static unsigned int rehash_db = 0; static unsigned int rehash_db = 0;
unsigned int dbs_per_call = REDIS_DBCRON_DBS_PER_CALL; int dbs_per_call = REDIS_DBCRON_DBS_PER_CALL;
unsigned int j; int j;
/* Don't test more DBs than we have. */ /* Don't test more DBs than we have. */
if (dbs_per_call > server.dbnum) dbs_per_call = server.dbnum; if (dbs_per_call > server.dbnum) dbs_per_call = server.dbnum;
@ -1557,7 +1557,7 @@ void adjustOpenFilesLimit(void) {
* to the higher value supported less than maxfiles. */ * to the higher value supported less than maxfiles. */
f = maxfiles; f = maxfiles;
while(f > oldlimit) { while(f > oldlimit) {
int decr_step = 16; rlim_t decr_step = 16;
limit.rlim_cur = f; limit.rlim_cur = f;
limit.rlim_max = f; limit.rlim_max = f;
@ -2359,9 +2359,9 @@ int time_independent_strcmp(char *a, char *b) {
* a or b are fixed (our password) length, and the difference is only * a or b are fixed (our password) length, and the difference is only
* relative to the length of the user provided string, so no information * relative to the length of the user provided string, so no information
* leak is possible in the following two lines of code. */ * leak is possible in the following two lines of code. */
int alen = strlen(a); unsigned int alen = strlen(a);
int blen = strlen(b); unsigned int blen = strlen(b);
int j; unsigned int j;
int diff = 0; int diff = 0;
/* We can't compare strings longer than our static buffers. /* We can't compare strings longer than our static buffers.

View File

@ -814,12 +814,12 @@ struct redisServer {
/* Replication script cache. */ /* Replication script cache. */
dict *repl_scriptcache_dict; /* SHA1 all slaves are aware of. */ dict *repl_scriptcache_dict; /* SHA1 all slaves are aware of. */
list *repl_scriptcache_fifo; /* First in, first out LRU eviction. */ list *repl_scriptcache_fifo; /* First in, first out LRU eviction. */
int repl_scriptcache_size; /* Max number of elements. */ unsigned int repl_scriptcache_size; /* Max number of elements. */
/* Synchronous replication. */ /* Synchronous replication. */
list *clients_waiting_acks; /* Clients waiting in WAIT command. */ list *clients_waiting_acks; /* Clients waiting in WAIT command. */
int get_ack_from_slaves; /* If true we send REPLCONF GETACK. */ int get_ack_from_slaves; /* If true we send REPLCONF GETACK. */
/* Limits */ /* Limits */
int maxclients; /* Max number of simultaneous clients */ unsigned int maxclients; /* Max number of simultaneous clients */
unsigned long long maxmemory; /* Max number of memory bytes to use */ unsigned long long maxmemory; /* Max number of memory bytes to use */
int maxmemory_policy; /* Policy for key eviction */ int maxmemory_policy; /* Policy for key eviction */
int maxmemory_samples; /* Pricision of random sampling */ int maxmemory_samples; /* Pricision of random sampling */

View File

@ -212,7 +212,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
static robj **argv = NULL; static robj **argv = NULL;
static int argv_size = 0; static int argv_size = 0;
static robj *cached_objects[LUA_CMD_OBJCACHE_SIZE]; static robj *cached_objects[LUA_CMD_OBJCACHE_SIZE];
static int cached_objects_len[LUA_CMD_OBJCACHE_SIZE]; static size_t cached_objects_len[LUA_CMD_OBJCACHE_SIZE];
/* Require at least one argument */ /* Require at least one argument */
if (argc == 0) { if (argc == 0) {

View File

@ -159,7 +159,7 @@ typedef struct sentinelRedisInstance {
/* Master specific. */ /* Master specific. */
dict *sentinels; /* Other sentinels monitoring the same master. */ dict *sentinels; /* Other sentinels monitoring the same master. */
dict *slaves; /* Slaves for this master instance. */ dict *slaves; /* Slaves for this master instance. */
int quorum; /* Number of sentinels that need to agree on failure. */ unsigned int quorum;/* Number of sentinels that need to agree on failure. */
int parallel_syncs; /* How many slaves to reconfigure at same time. */ int parallel_syncs; /* How many slaves to reconfigure at same time. */
char *auth_pass; /* Password to use for AUTH against master & slaves. */ char *auth_pass; /* Password to use for AUTH against master & slaves. */
@ -345,6 +345,7 @@ int dictSdsKeyCompare(void *privdata, const void *key1, const void *key2);
void releaseSentinelRedisInstance(sentinelRedisInstance *ri); void releaseSentinelRedisInstance(sentinelRedisInstance *ri);
void dictInstancesValDestructor (void *privdata, void *obj) { void dictInstancesValDestructor (void *privdata, void *obj) {
REDIS_NOTUSED(privdata);
releaseSentinelRedisInstance(obj); releaseSentinelRedisInstance(obj);
} }
@ -403,7 +404,7 @@ void initSentinelConfig(void) {
/* Perform the Sentinel mode initialization. */ /* Perform the Sentinel mode initialization. */
void initSentinel(void) { void initSentinel(void) {
int j; unsigned int j;
/* Remove usual Redis commands from the command table, then just add /* Remove usual Redis commands from the command table, then just add
* the SENTINEL command. */ * the SENTINEL command. */
@ -1634,6 +1635,7 @@ void sentinelLinkEstablishedCallback(const redisAsyncContext *c, int status) {
} }
void sentinelDisconnectCallback(const redisAsyncContext *c, int status) { void sentinelDisconnectCallback(const redisAsyncContext *c, int status) {
REDIS_NOTUSED(status);
sentinelDisconnectInstanceFromContext(c); sentinelDisconnectInstanceFromContext(c);
} }
@ -1998,6 +2000,7 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
redisReply *r; redisReply *r;
REDIS_NOTUSED(privdata);
if (ri) ri->pending_commands--; if (ri) ri->pending_commands--;
if (!reply || !ri) return; if (!reply || !ri) return;
@ -2012,6 +2015,8 @@ void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata
* value of the command but its effects directly. */ * value of the command but its effects directly. */
void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
REDIS_NOTUSED(reply);
REDIS_NOTUSED(privdata);
if (ri) ri->pending_commands--; if (ri) ri->pending_commands--;
} }
@ -2019,6 +2024,7 @@ void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privd
void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
redisReply *r; redisReply *r;
REDIS_NOTUSED(privdata);
if (ri) ri->pending_commands--; if (ri) ri->pending_commands--;
if (!reply || !ri) return; if (!reply || !ri) return;
@ -2057,6 +2063,7 @@ void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata
void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
redisReply *r; redisReply *r;
REDIS_NOTUSED(privdata);
if (ri) ri->pending_commands--; if (ri) ri->pending_commands--;
if (!reply || !ri) return; if (!reply || !ri) return;
@ -2166,6 +2173,7 @@ cleanup:
void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privdata) { void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
redisReply *r; redisReply *r;
REDIS_NOTUSED(privdata);
if (!reply || !ri) return; if (!reply || !ri) return;
r = reply; r = reply;
@ -2559,7 +2567,7 @@ sentinelRedisInstance *sentinelGetMasterByNameOrReplyError(redisClient *c,
{ {
sentinelRedisInstance *ri; sentinelRedisInstance *ri;
ri = dictFetchValue(sentinel.masters,c->argv[2]->ptr); ri = dictFetchValue(sentinel.masters,name->ptr);
if (!ri) { if (!ri) {
addReplyError(c,"No such master with that name"); addReplyError(c,"No such master with that name");
return NULL; return NULL;
@ -2997,7 +3005,7 @@ void sentinelCheckSubjectivelyDown(sentinelRedisInstance *ri) {
void sentinelCheckObjectivelyDown(sentinelRedisInstance *master) { void sentinelCheckObjectivelyDown(sentinelRedisInstance *master) {
dictIterator *di; dictIterator *di;
dictEntry *de; dictEntry *de;
int quorum = 0, odown = 0; unsigned int quorum = 0, odown = 0;
if (master->flags & SRI_S_DOWN) { if (master->flags & SRI_S_DOWN) {
/* Is down for enough sentinels? */ /* Is down for enough sentinels? */
@ -3034,6 +3042,7 @@ void sentinelCheckObjectivelyDown(sentinelRedisInstance *master) {
void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *privdata) { void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *privdata) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
redisReply *r; redisReply *r;
REDIS_NOTUSED(privdata);
if (ri) ri->pending_commands--; if (ri) ri->pending_commands--;
if (!reply || !ri) return; if (!reply || !ri) return;
@ -3057,7 +3066,7 @@ void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *p
/* If the runid in the reply is not "*" the Sentinel actually /* If the runid in the reply is not "*" the Sentinel actually
* replied with a vote. */ * replied with a vote. */
sdsfree(ri->leader); sdsfree(ri->leader);
if (ri->leader_epoch != r->element[2]->integer) if ((long long)ri->leader_epoch != r->element[2]->integer)
redisLog(REDIS_WARNING, redisLog(REDIS_WARNING,
"%s voted for %s %llu", ri->name, "%s voted for %s %llu", ri->name,
r->element[1]->str, r->element[1]->str,