diff --git a/src/public/tier1/fmtstr.h b/src/public/tier1/fmtstr.h index 40a5438a..2ef3f43d 100644 --- a/src/public/tier1/fmtstr.h +++ b/src/public/tier1/fmtstr.h @@ -25,7 +25,7 @@ #define FmtStrVSNPrintf( szBuf, nBufSize, bQuietTruncation, ppszFormat, nPrevLen, lastArg ) \ do \ { \ - int result; \ + ssize_t result; \ va_list arg_ptr; \ bool bTruncated = false; \ static int scAsserted = 0; \ diff --git a/src/public/tier1/strtools.h b/src/public/tier1/strtools.h index fa731525..0188f310 100644 --- a/src/public/tier1/strtools.h +++ b/src/public/tier1/strtools.h @@ -81,7 +81,7 @@ inline bool V_iswdigit(int c) } void V_binarytohex(const byte* in, size_t inputbytes, char* out, size_t outsize); -int V_vsnprintfRet(char* pDest, int maxLen, const char* pFormat, va_list params, bool* pbTruncated); +ssize_t V_vsnprintfRet(char* pDest, size_t maxLen, const char* pFormat, va_list params, bool* pbTruncated); // Strip white space at the beginning and end of a string ssize_t V_StrTrim(char* pStr); diff --git a/src/tier1/strtools.cpp b/src/tier1/strtools.cpp index ba843098..727bc5e0 100644 --- a/src/tier1/strtools.cpp +++ b/src/tier1/strtools.cpp @@ -266,12 +266,12 @@ void V_binarytohex(const byte* in, size_t inputbytes, char* out, size_t outsize) } -int V_vsnprintfRet(char* pDest, int maxLen, const char* pFormat, va_list params, bool* pbTruncated) +ssize_t V_vsnprintfRet(char* pDest, size_t maxLen, const char* pFormat, va_list params, bool* pbTruncated) { Assert(maxLen > 0); - int len = _vsnprintf(pDest, maxLen, pFormat, params); - bool bTruncated = (len < 0) || (len >= maxLen); + ssize_t len = _vsnprintf(pDest, maxLen, pFormat, params); + const bool bTruncated = (len < 0) || (len >= (ssize_t)maxLen); if (pbTruncated) {