From a94c20966c4028f96b0df3321cc30893e839a62e Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Thu, 5 Jun 2014 01:35:18 -0400 Subject: [PATCH] set now properly appends a null terminator. --- Jupiter/CString_Imp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jupiter/CString_Imp.h b/Jupiter/CString_Imp.h index ce616e6..4dce368 100644 --- a/Jupiter/CString_Imp.h +++ b/Jupiter/CString_Imp.h @@ -292,16 +292,18 @@ template Jupiter::CString_Type Jupiter::CString_Type::gotoWord template size_t Jupiter::CString_Type::set(const Jupiter::Readable_String &in) { this->setBufferSizeNoCopy(in.size()); - for (Jupiter::String_Type::length = 0; Jupiter::String_Type::length < in.size() && in.get(Jupiter::String_Type::length) != 0; Jupiter::String_Type::length++) + for (Jupiter::String_Type::length = 0; Jupiter::String_Type::length != in.size() && in.get(Jupiter::String_Type::length) != 0; Jupiter::String_Type::length++) Jupiter::String_Type::str[Jupiter::String_Type::length] = in.get(Jupiter::String_Type::length); + Jupiter::String_Type::str[Jupiter::String_Type::length] = 0; return Jupiter::String_Type::length; } template size_t Jupiter::CString_Type::set(const std::basic_string &in) { this->setBufferSizeNoCopy(in.size()); - for (Jupiter::String_Type::length = 0; Jupiter::String_Type::length < in.size() && in.at(Jupiter::String_Type::length) != 0; Jupiter::String_Type::length++) + for (Jupiter::String_Type::length = 0; Jupiter::String_Type::length != in.size() && in.at(Jupiter::String_Type::length) != 0; Jupiter::String_Type::length++) Jupiter::String_Type::str[Jupiter::String_Type::length] = in.at(Jupiter::String_Type::length); + Jupiter::String_Type::str[Jupiter::String_Type::length] return Jupiter::String_Type::length; }