diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index e67437ae00..fc469c7b79 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -14,8 +14,8 @@ std::string fmt::FormatV(const char *fmt, va_list args) for (;;) { std::vector buffptr(length); - int printlen = vsnprintf(buffptr.data(), length, fmt, args); - if (printlen >= 0 && printlen < length) + size_t printlen = vsnprintf(buffptr.data(), length, fmt, args); + if (printlen < length) { str = std::string(buffptr.data(), printlen); break; diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index d4e46917eb..744d6ea189 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -86,9 +86,9 @@ namespace fmt{ std::vector buffptr(length); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wformat-security" - int printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward(parameters)...); + size_t printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward(parameters)...); #pragma clang diagnostic pop - if (printlen >= 0 && printlen < length) + if (printlen < length) { str = string(buffptr.data(), printlen); break;