File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ unit_evaluate(const char *str, const char **endptr)
8282{
8383 double ret = unit_evaluate_dbl (str, false , endptr);
8484
85- if (ret == NAN || ret >= nexttoward ((double ) LLONG_MAX, LLONG_MAX)) {
85+ if (std::isnan (ret) ||
86+ ret >= nexttoward ((double ) LLONG_MAX, LLONG_MAX)) {
8687 return LLONG_MIN;
8788 }
8889
@@ -96,7 +97,7 @@ unit_evaluate(const char *str, const char **endptr)
9697 * @param case_sensitive if true 'm' will be considered as milli, otherwise mega
9798 * @param endptr if not NULL, point to suffix after parse
9899 * @returns positive floating point representation of the string
99- * @returns NAN if error
100+ * @returns NAN if error (isnan() must be called to check ret val)
100101 */
101102double
102103unit_evaluate_dbl (const char *str, bool case_sensitive, const char **endptr)
Original file line number Diff line number Diff line change @@ -506,8 +506,8 @@ static void usage() {
506506
507507#define ASSIGN_CHECK_VAL (var, str, minval ) \
508508 do { \
509- long long val = unit_evaluate_dbl (str, false , nullptr ); \
510- if (val < (minval) || val > UINT_MAX) { \
509+ const double val = unit_evaluate_dbl (str, false , nullptr ); \
510+ if (std::isnan (val) || val < (minval) || val > UINT_MAX) { \
511511 LOG (LOG_LEVEL_ERROR) \
512512 << " [J2K] Wrong value " << (str) \
513513 << " for " #var " ! Value must be >= " << (minval) \
You can’t perform that action at this time.
0 commit comments