X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/44f508f1a81941f298bdb0f2f87c4469094beeb6..4b1f6ad3e7a5c7c28618e43e7539c9a937bf8521:/src/util.c diff --git a/src/util.c b/src/util.c index b6ec2150..e3224f50 100644 --- a/src/util.c +++ b/src/util.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "util.h" @@ -211,8 +212,8 @@ int ll2string(char *s, size_t len, long long value) { /* Convert a string into a long long. Returns 1 if the string could be parsed * into a (non-overflowing) long long, 0 otherwise. The value will be set to * the parsed value when appropriate. */ -int string2ll(char *s, size_t slen, long long *value) { - char *p = s; +int string2ll(const char *s, size_t slen, long long *value) { + const char *p = s; size_t plen = 0; int negative = 0; unsigned long long v; @@ -277,7 +278,7 @@ int string2ll(char *s, size_t slen, long long *value) { /* Convert a string into a long. Returns 1 if the string could be parsed into a * (non-overflowing) long, 0 otherwise. The value will be set to the parsed * value when appropriate. */ -int string2l(char *s, size_t slen, long *lval) { +int string2l(const char *s, size_t slen, long *lval) { long long llval; if (!string2ll(s,slen,&llval)) @@ -319,7 +320,7 @@ int d2string(char *buf, size_t len, double value) { * integer printing function that is much faster. */ double min = -4503599627370495; /* (2^52)-1 */ double max = 4503599627370496; /* -(2^52) */ - if (val > min && val < max && value == ((double)((long long)value))) + if (value > min && value < max && value == ((double)((long long)value))) len = ll2string(buf,len,(long long)value); else #endif