Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
83c6a618
Commit
83c6a618
authored
Dec 06, 2009
by
antirez
Browse files
printf format warnings fixed by casting
parent
5acdc75d
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis-cli.c
View file @
83c6a618
...
@@ -311,7 +311,8 @@ static int cliSendCommand(int argc, char **argv) {
...
@@ -311,7 +311,8 @@ static int cliSendCommand(int argc, char **argv) {
if
(
rc
->
flags
&
REDIS_CMD_MULTIBULK
)
{
if
(
rc
->
flags
&
REDIS_CMD_MULTIBULK
)
{
cmd
=
sdscatprintf
(
cmd
,
"*%d
\r\n
"
,
argc
);
cmd
=
sdscatprintf
(
cmd
,
"*%d
\r\n
"
,
argc
);
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
cmd
=
sdscatprintf
(
cmd
,
"$%lu
\r\n
"
,
sdslen
(
argv
[
j
]));
cmd
=
sdscatprintf
(
cmd
,
"$%lu
\r\n
"
,
(
unsigned
long
)
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
"
\r\n
"
,
2
);
cmd
=
sdscatlen
(
cmd
,
"
\r\n
"
,
2
);
}
}
...
@@ -319,7 +320,8 @@ static int cliSendCommand(int argc, char **argv) {
...
@@ -319,7 +320,8 @@ static int cliSendCommand(int argc, char **argv) {
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
if
(
j
!=
0
)
cmd
=
sdscat
(
cmd
,
" "
);
if
(
j
!=
0
)
cmd
=
sdscat
(
cmd
,
" "
);
if
(
j
==
argc
-
1
&&
rc
->
flags
&
REDIS_CMD_BULK
)
{
if
(
j
==
argc
-
1
&&
rc
->
flags
&
REDIS_CMD_BULK
)
{
cmd
=
sdscatprintf
(
cmd
,
"%lu"
,
sdslen
(
argv
[
j
]));
cmd
=
sdscatprintf
(
cmd
,
"%lu"
,
(
unsigned
long
)
sdslen
(
argv
[
j
]));
}
else
{
}
else
{
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
}
}
...
...
redis.c
View file @
83c6a618
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#define REDIS_VERSION "1.1.9
0
"
#define REDIS_VERSION "1.1.9
1
"
#include "fmacros.h"
#include "fmacros.h"
#include "config.h"
#include "config.h"
...
@@ -1802,7 +1802,7 @@ static void replicationFeedSlaves(list *slaves, struct redisCommand *cmd, int di
...
@@ -1802,7 +1802,7 @@ static void replicationFeedSlaves(list *slaves, struct redisCommand *cmd, int di
lenobj = createObject(REDIS_STRING,
lenobj = createObject(REDIS_STRING,
sdscatprintf(sdsempty(),"%lu\r\n",
sdscatprintf(sdsempty(),"%lu\r\n",
stringObjectLen(argv[j])));
(unsigned long)
stringObjectLen(argv[j])));
lenobj->refcount = 0;
lenobj->refcount = 0;
outv[outc++] = lenobj;
outv[outc++] = lenobj;
}
}
...
@@ -2019,7 +2019,7 @@ static void addReplyDouble(redisClient *c, double d) {
...
@@ -2019,7 +2019,7 @@ static void addReplyDouble(redisClient *c, double d) {
snprintf(buf,sizeof(buf),"%.17g",d);
snprintf(buf,sizeof(buf),"%.17g",d);
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n%s\r\n",
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n%s\r\n",
strlen(buf),buf));
(unsigned long)
strlen(buf),buf));
}
}
static void addReplyBulkLen(redisClient *c, robj *obj) {
static void addReplyBulkLen(redisClient *c, robj *obj) {
...
@@ -2039,7 +2039,7 @@ static void addReplyBulkLen(redisClient *c, robj *obj) {
...
@@ -2039,7 +2039,7 @@ static void addReplyBulkLen(redisClient *c, robj *obj) {
len++;
len++;
}
}
}
}
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n",len));
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n",
(unsigned long)
len));
}
}
static void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
static void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -5125,7 +5125,8 @@ static sds genRedisInfoString(void) {
...
@@ -5125,7 +5125,8 @@ static sds genRedisInfoString(void) {
static void infoCommand(redisClient *c) {
static void infoCommand(redisClient *c) {
sds info = genRedisInfoString();
sds info = genRedisInfoString();
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n",sdslen(info)));
addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n",
(unsigned long)sdslen(info)));
addReplySds(c,info);
addReplySds(c,info);
addReply(c,shared.crlf);
addReply(c,shared.crlf);
}
}
...
@@ -5668,7 +5669,7 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
...
@@ -5668,7 +5669,7 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
snprintf(seldb,sizeof(seldb),"%d",dictid);
snprintf(seldb,sizeof(seldb),"%d",dictid);
buf = sdscatprintf(buf,"*2\r\n$6\r\nSELECT\r\n$%lu\r\n%s\r\n",
buf = sdscatprintf(buf,"*2\r\n$6\r\nSELECT\r\n$%lu\r\n%s\r\n",
strlen(seldb),seldb);
(unsigned long)
strlen(seldb),seldb);
server.appendseldb = dictid;
server.appendseldb = dictid;
}
}
...
@@ -5692,7 +5693,7 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
...
@@ -5692,7 +5693,7 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
robj *o = argv[j];
robj *o = argv[j];
o = getDecodedObject(o);
o = getDecodedObject(o);
buf = sdscatprintf(buf,"$%lu\r\n",sdslen(o->ptr));
buf = sdscatprintf(buf,"$%lu\r\n",
(unsigned long)
sdslen(o->ptr));
buf = sdscatlen(buf,o->ptr,sdslen(o->ptr));
buf = sdscatlen(buf,o->ptr,sdslen(o->ptr));
buf = sdscatlen(buf,"\r\n",2);
buf = sdscatlen(buf,"\r\n",2);
decrRefCount(o);
decrRefCount(o);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment