Pre-asserts to clarify buffer usage
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index dd8e3fd..ca6c566 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -1997,6 +1997,7 @@
// Close out and re-start the va-args
va_end( va );
va_start( va, format );
+ TIXMLASSERT( _buffer.Size() > 0 && _buffer[_buffer.Size() - 1] == 0 );
char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator.
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
#if defined(WINCE)
diff --git a/tinyxml2.h b/tinyxml2.h
index 1f6c833..d0017b6 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -276,6 +276,7 @@
}
int Size() const {
+ TIXMLASSERT( _size >= 0 );
return _size;
}