Browse Source

set now properly appends a null terminator.

release/0.19
JustinAJ 11 years ago
parent
commit
a94c20966c
  1. 6
      Jupiter/CString_Imp.h

6
Jupiter/CString_Imp.h

@ -292,16 +292,18 @@ template<typename T> Jupiter::CString_Type<T> Jupiter::CString_Type<T>::gotoWord
template<typename T> size_t Jupiter::CString_Type<T>::set(const Jupiter::Readable_String<T> &in) template<typename T> size_t Jupiter::CString_Type<T>::set(const Jupiter::Readable_String<T> &in)
{ {
this->setBufferSizeNoCopy(in.size()); this->setBufferSizeNoCopy(in.size());
for (Jupiter::String_Type<T>::length = 0; Jupiter::String_Type<T>::length < in.size() && in.get(Jupiter::String_Type<T>::length) != 0; Jupiter::String_Type<T>::length++) for (Jupiter::String_Type<T>::length = 0; Jupiter::String_Type<T>::length != in.size() && in.get(Jupiter::String_Type<T>::length) != 0; Jupiter::String_Type<T>::length++)
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length); Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = 0;
return Jupiter::String_Type<T>::length; return Jupiter::String_Type<T>::length;
} }
template<typename T> size_t Jupiter::CString_Type<T>::set(const std::basic_string<T> &in) template<typename T> size_t Jupiter::CString_Type<T>::set(const std::basic_string<T> &in)
{ {
this->setBufferSizeNoCopy(in.size()); this->setBufferSizeNoCopy(in.size());
for (Jupiter::String_Type<T>::length = 0; Jupiter::String_Type<T>::length < in.size() && in.at(Jupiter::String_Type<T>::length) != 0; Jupiter::String_Type<T>::length++) for (Jupiter::String_Type<T>::length = 0; Jupiter::String_Type<T>::length != in.size() && in.at(Jupiter::String_Type<T>::length) != 0; Jupiter::String_Type<T>::length++)
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length); Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length]
return Jupiter::String_Type<T>::length; return Jupiter::String_Type<T>::length;
} }

Loading…
Cancel
Save