From 08ec978cf700176fb6b6f3a96255f54f0e13ebdf Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Thu, 5 Jun 2014 20:14:59 -0400 Subject: [PATCH] Fixed off-by-one error. --- Jupiter/String_Imp.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jupiter/String_Imp.h b/Jupiter/String_Imp.h index db5b589..4a12902 100644 --- a/Jupiter/String_Imp.h +++ b/Jupiter/String_Imp.h @@ -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 + 1, format, args); + minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length, 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 + 1, format, args); + minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return 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 + 1, format, args); + minLen = vsnprintf(Jupiter::String_Type::str + Jupiter::String_Type::length, 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 + 1, format, args); + minLen = vswprintf(Jupiter::String_Type::str + Jupiter::String_Type::length, minLen + 1, format, args); if (minLen <= 0) return 0; Jupiter::String_Type::length += minLen; return minLen;