diff options
author | ipknHama <ipknhama@gmail.com> | 2017-12-25 16:26:30 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2017-12-25 16:26:30 +0900 |
commit | 05d02fea6e2cf5d2603655419338995549993a8a (patch) | |
tree | 8db425097f676a82f5dc8b90d73a9a41c548550e /include | |
parent | b7360a2bacb426401636a1e76e5e713ed0c3b0fc (diff) | |
download | crow-05d02fea6e2cf5d2603655419338995549993a8a.tar.gz crow-05d02fea6e2cf5d2603655419338995549993a8a.zip |
Remove printf warning for lld, llu
Diffstat (limited to 'include')
-rw-r--r-- | include/crow/json.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/crow/json.h b/include/crow/json.h index fa6c411..05f68b9 100644 --- a/include/crow/json.h +++ b/include/crow/json.h @@ -1479,26 +1479,26 @@ namespace crow case type::True: out += "true"; break; case type::Number: { - char outbuf[128]; + if (v.nt == num_type::Floating_point) + { #ifdef _MSC_VER #define MSC_COMPATIBLE_SPRINTF(BUFFER_PTR, FORMAT_PTR, VALUE) sprintf_s((BUFFER_PTR), 128, (FORMAT_PTR), (VALUE)) #else #define MSC_COMPATIBLE_SPRINTF(BUFFER_PTR, FORMAT_PTR, VALUE) sprintf((BUFFER_PTR), (FORMAT_PTR), (VALUE)) #endif - if (v.nt == num_type::Floating_point) - { - MSC_COMPATIBLE_SPRINTF(outbuf, "%g", v.num.d); + char outbuf[128]; + MSC_COMPATIBLE_SPRINTF(outbuf, "%g", v.num.d); + out += outbuf; +#undef MSC_COMPATIBLE_SPRINTF } else if (v.nt == num_type::Signed_integer) { - MSC_COMPATIBLE_SPRINTF(outbuf, "%lld", v.num.si); + out += std::to_string(v.num.si); } else { - MSC_COMPATIBLE_SPRINTF(outbuf, "%llu", v.num.ui); + out += std::to_string(v.num.ui); } -#undef MSC_COMPATIBLE_SPRINTF - out += outbuf; } break; case type::String: dump_string(v.s, out); break; |