Commit 6effc948 authored by Ulrich Kemloh's avatar Ulrich Kemloh

Enable STL and restore original tinyxml licence

parent 53fb69f7
......@@ -36,7 +36,8 @@ TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
void TiXmlString::reserve (size_type cap)
{
if (cap > capacity()) {
if (cap > capacity())
{
TiXmlString tmp;
tmp.init(length(), cap);
memcpy(tmp.start(), data(), length());
......@@ -48,12 +49,15 @@ void TiXmlString::reserve (size_type cap)
TiXmlString& TiXmlString::assign(const char* str, size_type len)
{
size_type cap = capacity();
if (len > cap || cap > 3*(len + 8)) {
if (len > cap || cap > 3*(len + 8))
{
TiXmlString tmp;
tmp.init(len);
memcpy(tmp.start(), str, len);
swap(tmp);
} else {
}
else
{
memmove(start(), str, len);
set_size(len);
}
......@@ -64,7 +68,8 @@ TiXmlString& TiXmlString::assign(const char* str, size_type len)
TiXmlString& TiXmlString::append(const char* str, size_type len)
{
size_type newsize = length() + len;
if (newsize > capacity()) {
if (newsize > capacity())
{
reserve (newsize + capacity());
}
memmove(finish(), str, len);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,8 @@ distribution.
// It also cleans up the code a bit.
//
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] = {
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
{
"No error",
"Error",
"Failed to open file",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment