diff --git a/NppJSONViewer/TreeBuilder.cpp b/NppJSONViewer/TreeBuilder.cpp index cb2398a..0d132fa 100644 --- a/NppJSONViewer/TreeBuilder.cpp +++ b/NppJSONViewer/TreeBuilder.cpp @@ -43,14 +43,14 @@ const char* FALSE_STR = "false"; bool TreeBuilder::Null() { - return this->String(NULL_STR, sizeof(NULL_STR), true); + return this->String(NULL_STR, static_cast(strlen(NULL_STR)), true); } bool TreeBuilder::Bool(bool b) { if (b) - return this->String(TRUE_STR, sizeof(TRUE_STR), true); - return this->String(FALSE_STR, sizeof(FALSE_STR), true); + return this->String(TRUE_STR, static_cast(strlen(TRUE_STR)), true); + return this->String(FALSE_STR, static_cast(strlen(FALSE_STR)), true); } bool TreeBuilder::Int(int i) { cout << "Int(" << i << ")" << endl; return true; } diff --git a/NppJSONViewer/utils.h b/NppJSONViewer/utils.h index a8d93e1..bc81756 100644 --- a/NppJSONViewer/utils.h +++ b/NppJSONViewer/utils.h @@ -3,8 +3,8 @@ #include #include -#define SSTR( x ) static_cast< std::ostringstream & >( \ - ( std::ostringstream() << std::dec << x ) ).str() +template +constexpr auto SSTR(T x) { return (std::ostringstream() << std::dec << x).str(); } EXTERN_C IMAGE_DOS_HEADER __ImageBase;