summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-23 11:25:56 +0000
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-23 13:02:22 +0100
commit454f4bfd2867138e97db5db79ac1164ebb61bd24 (patch)
tree255de43989b89db7c7a6436a4b54d448d1e6e92f
parent1408d147e43deb8a2aaa3abf9d7da7e4cb8722e4 (diff)
downloadredis-454f4bfd2867138e97db5db79ac1164ebb61bd24.tar.gz
Fix compiler warnings on Solaris
-rw-r--r--src/redis-cli.c4
-rw-r--r--src/redis.c2
-rw-r--r--src/ziplist.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index ca70c9472..08b3a713e 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -414,10 +414,11 @@ static sds cliFormatReplyRaw(redisReply *r) {
}
static int cliReadReply(int output_raw_strings) {
+ void *_reply;
redisReply *reply;
sds out;
- if (redisGetReply(context,(void**)&reply) != REDIS_OK) {
+ if (redisGetReply(context,&_reply) != REDIS_OK) {
if (config.shutdown)
return REDIS_OK;
if (config.interactive) {
@@ -431,6 +432,7 @@ static int cliReadReply(int output_raw_strings) {
return REDIS_ERR; /* avoid compiler warning */
}
+ reply = (redisReply*)_reply;
if (output_raw_strings) {
out = cliFormatReplyRaw(reply);
} else {
diff --git a/src/redis.c b/src/redis.c
index 6e667f29a..8f4ca9619 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -1476,7 +1476,7 @@ void createPidFile(void) {
/* Try to write the pid file in a best-effort way. */
FILE *fp = fopen(server.pidfile,"w");
if (fp) {
- fprintf(fp,"%d\n",getpid());
+ fprintf(fp,"%d\n",(int)getpid());
fclose(fp);
}
}
diff --git a/src/ziplist.c b/src/ziplist.c
index a1a634789..233fabefe 100644
--- a/src/ziplist.c
+++ b/src/ziplist.c
@@ -119,6 +119,7 @@ static unsigned int zipEntryEncoding(unsigned char *p) {
return p[0] & 0xf0;
}
assert(NULL);
+ return 0;
}
/* Return bytes needed to store integer encoded by 'encoding' */
@@ -129,13 +130,14 @@ static unsigned int zipIntSize(unsigned char encoding) {
case ZIP_INT_64B: return sizeof(int64_t);
}
assert(NULL);
+ return 0;
}
/* Decode the encoded length pointed by 'p'. If a pointer to 'lensize' is
* provided, it is set to the number of bytes required to encode the length. */
static unsigned int zipDecodeLength(unsigned char *p, unsigned int *lensize) {
unsigned char encoding = zipEntryEncoding(p);
- unsigned int len;
+ unsigned int len = 0;
if (ZIP_IS_STR(encoding)) {
switch(encoding) {
@@ -300,7 +302,7 @@ static void zipSaveInteger(unsigned char *p, int64_t value, unsigned char encodi
static int64_t zipLoadInteger(unsigned char *p, unsigned char encoding) {
int16_t i16;
int32_t i32;
- int64_t i64, ret;
+ int64_t i64, ret = 0;
if (encoding == ZIP_INT_16B) {
memcpy(&i16,p,sizeof(i16));
ret = i16;