diff --git a/src/networking.cpp b/src/networking.cpp index 39282d5c6..7342a0fe4 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -623,7 +623,7 @@ void setDeferredPushLen(client *c, void *node, long length) { /* Add a double as a bulk reply */ void addReplyDoubleCore(client *c, double d, bool fAsync) { - if (isinf(d)) { + if (std::isinf(d)) { /* Libc in odd systems (Hi Solaris!) will format infinite in a * different way, so better to handle it in an explicit way. */ if (c->resp == 2) { diff --git a/src/object.cpp b/src/object.cpp index de770e47e..b57a09b7e 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -624,7 +624,7 @@ int getDoubleFromObject(const robj *o, double *target) { (size_t)(eptr-(char*)szFromObj(o)) != sdslen(szFromObj(o)) || (errno == ERANGE && (value == HUGE_VAL || value == -HUGE_VAL || value == 0)) || - isnan(value)) + std::isnan(value)) return C_ERR; } else if (o->encoding == OBJ_ENCODING_INT) { value = (long)ptrFromObj(o); @@ -666,7 +666,7 @@ int getLongDoubleFromObject(robj *o, long double *target) { (size_t)(eptr-(char*)szFromObj(o)) != sdslen(szFromObj(o)) || (errno == ERANGE && (value == HUGE_VAL || value == -HUGE_VAL || value == 0)) || - isnan(value)) + std::isnan(value)) return C_ERR; } else if (o->encoding == OBJ_ENCODING_INT) { value = (long)szFromObj(o); diff --git a/src/rdb.cpp b/src/rdb.cpp index 97b20e24b..2cac89178 100644 --- a/src/rdb.cpp +++ b/src/rdb.cpp @@ -543,10 +543,10 @@ int rdbSaveDoubleValue(rio *rdb, double val) { unsigned char buf[128]; int len; - if (isnan(val)) { + if (std::isnan(val)) { buf[0] = 253; len = 1; - } else if (!isfinite(val)) { + } else if (!std::isfinite(val)) { len = 1; buf[0] = (val < 0) ? 255 : 254; } else { diff --git a/src/server.h b/src/server.h index 8f45d39ed..6b66c9635 100644 --- a/src/server.h +++ b/src/server.h @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/sort.cpp b/src/sort.cpp index 6b517b25a..34b86d700 100644 --- a/src/sort.cpp +++ b/src/sort.cpp @@ -475,7 +475,7 @@ void sortCommand(client *c) { vector[j].u.score = strtod(szFromObj(byval),&eptr); if (eptr[0] != '\0' || errno == ERANGE || - isnan(vector[j].u.score)) + std::isnan(vector[j].u.score)) { int_conversion_error = 1; } diff --git a/src/t_hash.cpp b/src/t_hash.cpp index a7d35a926..f2758bdd2 100644 --- a/src/t_hash.cpp +++ b/src/t_hash.cpp @@ -615,7 +615,7 @@ void hincrbyfloatCommand(client *c) { } value += incr; - if (isnan(value) || isinf(value)) { + if (std::isnan(value) || std::isinf(value)) { addReplyError(c,"increment would produce NaN or Infinity"); return; } diff --git a/src/t_string.cpp b/src/t_string.cpp index aea74b48d..4cb30eac6 100644 --- a/src/t_string.cpp +++ b/src/t_string.cpp @@ -28,7 +28,7 @@ */ #include "server.h" -#include /* isnan(), isinf() */ +#include /* isnan(), isinf() */ /*----------------------------------------------------------------------------- * String Commands @@ -408,7 +408,7 @@ void incrbyfloatCommand(client *c) { return; value += incr; - if (isnan(value) || isinf(value)) { + if (std::isnan(value) || std::isinf(value)) { addReplyError(c,"increment would produce NaN or Infinity"); return; } diff --git a/src/t_zset.cpp b/src/t_zset.cpp index 1c965813d..456348e10 100644 --- a/src/t_zset.cpp +++ b/src/t_zset.cpp @@ -134,7 +134,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) { unsigned int rank[ZSKIPLIST_MAXLEVEL]; int i, level; - serverAssert(!isnan(score)); + serverAssert(!std::isnan(score)); x = zsl->header; for (i = zsl->level-1; i >= 0; i--) { /* store rank that is crossed to reach the insert position */ @@ -530,11 +530,11 @@ static int zslParseRange(robj *min, robj *max, zrangespec *spec) { } else { if (((char*)ptrFromObj(min))[0] == '(') { spec->min = strtod((char*)ptrFromObj(min)+1,&eptr); - if (eptr[0] != '\0' || isnan(spec->min)) return C_ERR; + if (eptr[0] != '\0' || std::isnan(spec->min)) return C_ERR; spec->minex = 1; } else { spec->min = strtod((char*)ptrFromObj(min),&eptr); - if (eptr[0] != '\0' || isnan(spec->min)) return C_ERR; + if (eptr[0] != '\0' || std::isnan(spec->min)) return C_ERR; } } if (max->encoding == OBJ_ENCODING_INT) { @@ -542,11 +542,11 @@ static int zslParseRange(robj *min, robj *max, zrangespec *spec) { } else { if (((char*)ptrFromObj(max))[0] == '(') { spec->max = strtod((char*)ptrFromObj(max)+1,&eptr); - if (eptr[0] != '\0' || isnan(spec->max)) return C_ERR; + if (eptr[0] != '\0' || std::isnan(spec->max)) return C_ERR; spec->maxex = 1; } else { spec->max = strtod((char*)ptrFromObj(max),&eptr); - if (eptr[0] != '\0' || isnan(spec->max)) return C_ERR; + if (eptr[0] != '\0' || std::isnan(spec->max)) return C_ERR; } } @@ -1320,7 +1320,7 @@ int zsetAdd(robj *zobj, double score, sds ele, int *flags, double *newscore) { double curscore; /* NaN as input is an error regardless of all the other parameters. */ - if (isnan(score)) { + if (std::isnan(score)) { *flags = ZADD_NAN; return 0; } @@ -1339,7 +1339,7 @@ int zsetAdd(robj *zobj, double score, sds ele, int *flags, double *newscore) { /* Prepare the score for the increment if needed. */ if (incr) { score += curscore; - if (isnan(score)) { + if (std::isnan(score)) { *flags |= ZADD_NAN; return 0; } @@ -1385,7 +1385,7 @@ int zsetAdd(robj *zobj, double score, sds ele, int *flags, double *newscore) { /* Prepare the score for the increment if needed. */ if (incr) { score += curscore; - if (isnan(score)) { + if (std::isnan(score)) { *flags |= ZADD_NAN; return 0; } @@ -2150,7 +2150,7 @@ inline static void zunionInterAggregate(double *target, double val, int aggregat /* The result of adding two doubles is NaN when one variable * is +inf and the other is -inf. When these numbers are added, * we maintain the convention of the result being 0.0. */ - if (isnan(*target)) *target = 0.0; + if (std::isnan(*target)) *target = 0.0; } else if (aggregate == REDIS_AGGR_MIN) { *target = val < *target ? val : *target; } else if (aggregate == REDIS_AGGR_MAX) { @@ -2283,7 +2283,7 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) { double score, value; score = src[0].weight * zval.score; - if (isnan(score)) score = 0; + if (std::isnan(score)) score = 0; for (j = 1; j < setnum; j++) { /* It is not safe to access the zset we are @@ -2330,7 +2330,7 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) { while (zuiNext(&src[i],&zval)) { /* Initialize value */ score = src[i].weight * zval.score; - if (isnan(score)) score = 0; + if (std::isnan(score)) score = 0; /* Search for this element in the accumulating dictionary. */ de = dictAddRaw(accumulator,zuiSdsFromValue(&zval),&existing);