Browse Source

Fixed some off-by-one errors

release/0.19
JustinAJ 10 years ago
parent
commit
d8dd8dea54
  1. 4
      Jupiter/CString_Imp.h
  2. BIN
      Release/Jupiter.lib

4
Jupiter/CString_Imp.h

@ -146,7 +146,7 @@ template<> size_t inline Jupiter::CString_Type<char>::vformat(const char *format
if (minLen < 0) return 0; // We simply can not work with this. if (minLen < 0) return 0; // We simply can not work with this.
this->setBufferSizeNoCopy(minLen); this->setBufferSizeNoCopy(minLen);
Jupiter::String_Type<char>::length = minLen; Jupiter::String_Type<char>::length = minLen;
vsnprintf(Jupiter::String_Type<char>::str, Jupiter::String_Type<char>::length, format, args); vsnprintf(Jupiter::String_Type<char>::str, Jupiter::String_Type<char>::length + 1, format, args);
Jupiter::String_Type<char>::str[Jupiter::String_Type<char>::length] = 0; Jupiter::String_Type<char>::str[Jupiter::String_Type<char>::length] = 0;
return Jupiter::String_Type<char>::length; return Jupiter::String_Type<char>::length;
} }
@ -183,7 +183,7 @@ template<> size_t inline Jupiter::CString_Type<char>::avformat(const char *forma
if (minLen < 0) return 0; // We simply can not work with this. if (minLen < 0) return 0; // We simply can not work with this.
this->setBufferSize(Jupiter::String_Type<char>::length + minLen); this->setBufferSize(Jupiter::String_Type<char>::length + minLen);
minLen = vsnprintf(Jupiter::String_Type<char>::str + Jupiter::String_Type<char>::length, minLen, format, args); minLen = vsnprintf(Jupiter::String_Type<char>::str + Jupiter::String_Type<char>::length, minLen + 1, format, args);
if (minLen <= 0) return 0; if (minLen <= 0) return 0;
Jupiter::String_Type<char>::length += minLen; Jupiter::String_Type<char>::length += minLen;
Jupiter::String_Type<char>::str[Jupiter::String_Type<char>::length] = 0; Jupiter::String_Type<char>::str[Jupiter::String_Type<char>::length] = 0;

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save