Skip to content

Commit 70a72f7

Browse files
authored
Fix build on OpenBSD (#1162)
* Replace DBL_DECIMAL_DIG with more portable C++ variant.
1 parent d893690 commit 70a72f7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/crow/json.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,9 +1896,9 @@ namespace crow // NOTE: Already documented in "crow/app.h"
18961896
if (v.nt == num_type::Double_precision_floating_point)
18971897
{
18981898
#ifdef _MSC_VER
1899-
sprintf_s(outbuf, sizeof(outbuf), "%.*g", DBL_DECIMAL_DIG, v.num.d);
1899+
sprintf_s(outbuf, sizeof(outbuf), "%.*g", std::numeric_limits<double>::max_digits10, v.num.d);
19001900
#else
1901-
snprintf(outbuf, sizeof(outbuf), "%.*g", DBL_DECIMAL_DIG, v.num.d);
1901+
snprintf(outbuf, sizeof(outbuf), "%.*g", std::numeric_limits<double>::max_digits10, v.num.d);
19021902
#endif
19031903
}
19041904
else

0 commit comments

Comments
 (0)