From 762e4d99ddbf2f0dff36e6c1126986c5639d4718 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Wed, 4 Jun 2014 23:35:03 -0400 Subject: [PATCH] Fixed format bug --- Jupiter/String_Imp.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Jupiter/String_Imp.h b/Jupiter/String_Imp.h index 407ef6a..db5b589 100644 --- a/Jupiter/String_Imp.h +++ b/Jupiter/String_Imp.h @@ -110,7 +110,7 @@ template<> size_t inline Jupiter::String_Strict::vformat(const char *forma if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSizeNoCopy(minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vsnprintf(Jupiter::String_Type::str, Jupiter::String_Type::length + 1, format, args); + minLen = vsnprintf(Jupiter::String_Type::str, minLen + 1, format, args); if (minLen < 0) return 0; return Jupiter::String_Type::length = minLen; } @@ -125,7 +125,7 @@ template<> size_t inline Jupiter::String_Strict::vformat(const wchar_t if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSizeNoCopy(minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vswprintf(Jupiter::String_Type::str, Jupiter::String_Type::length + 1, format, args); + minLen = vswprintf(Jupiter::String_Type::str, minLen + 1, format, args); if (minLen < 0) return 0; return Jupiter::String_Type::length = minLen; } @@ -147,7 +147,7 @@ template<> size_t inline Jupiter::String_Strict::avformat(const char *form if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSize(Jupiter::String_Type::length + minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen, format, args); + minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return minLen; @@ -163,7 +163,7 @@ template<> size_t inline Jupiter::String_Strict::avformat(const wchar_t if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSize(minLen + Jupiter::String_Type::length + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen, format, args); + minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return minLen; @@ -350,7 +350,7 @@ template<> size_t inline Jupiter::String_Loose::vformat(const char *format if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSizeNoCopy(minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vsnprintf(Jupiter::String_Type::str, Jupiter::String_Type::length + 1, format, args); + minLen = vsnprintf(Jupiter::String_Type::str, minLen + 1, format, args); if (minLen < 0) return 0; return Jupiter::String_Type::length = minLen; } @@ -365,7 +365,7 @@ template<> size_t inline Jupiter::String_Loose::vformat(const wchar_t * if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSizeNoCopy(minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vswprintf(Jupiter::String_Type::str, Jupiter::String_Type::length + 1, format, args); + minLen = vswprintf(Jupiter::String_Type::str, minLen + 1, format, args); if (minLen < 0) return 0; return Jupiter::String_Type::length = minLen; } @@ -387,7 +387,7 @@ template<> size_t inline Jupiter::String_Loose::avformat(const char *forma if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSize(Jupiter::String_Type::length + minLen + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen, format, args); + minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return minLen; @@ -403,7 +403,7 @@ template<> size_t inline Jupiter::String_Loose::avformat(const wchar_t if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSize(minLen + Jupiter::String_Type::length + 1); // vsnprintf REQUIRES space for an additional null character. - minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen, format, args); + minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length + 1, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return minLen;