From a6ed2b09a3e737e58f9ee7d0674be6c7ae1427c5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 19 Feb 2005 22:46:06 +0000 Subject: [PATCH] set string length to 0 in AllocBeforeWrite() just to be tidy (replaces patch 1123226) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/string.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/string.cpp b/src/common/string.cpp index 6ddd68f0c7..1a86ca3d1b 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -312,13 +312,15 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen) pData->nAllocLength = nLen; m_pchData = pData->data(); } - - // now we have enough space, just update the string length - pData->nDataLength = nLen; } wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner + // it doesn't really matter what the string length is as it's going to be + // overwritten later but, for extra safety, set it to 0 for now as we may + // have some junk in m_pchData + pData->nDataLength = 0; + return true; } -- 2.45.2