summaryrefslogtreecommitdiffstats
path: root/qtools
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2004-12-13 18:59:17 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2004-12-13 18:59:17 (GMT)
commita17029cb0765fc41b79b3c94a28d734071f13176 (patch)
tree024124085a492939d5ad3d3b60fbac43f928b925 /qtools
parent6042e1bf9a46e61bf168ed3755e896aa9ebad934 (diff)
downloadDoxygen-a17029cb0765fc41b79b3c94a28d734071f13176.zip
Doxygen-a17029cb0765fc41b79b3c94a28d734071f13176.tar.gz
Doxygen-a17029cb0765fc41b79b3c94a28d734071f13176.tar.bz2
Release-1.3.9.1-20041213
Diffstat (limited to 'qtools')
-rw-r--r--qtools/qstring.cpp12
-rw-r--r--qtools/scstring.cpp2
-rw-r--r--qtools/scstring.h1
3 files changed, 9 insertions, 6 deletions
diff --git a/qtools/qstring.cpp b/qtools/qstring.cpp
index 4707fed..e073168 100644
--- a/qtools/qstring.cpp
+++ b/qtools/qstring.cpp
@@ -15156,16 +15156,18 @@ QCString qt_winQString2MB( const QString& s, int uclen )
if ( uclen == 0 )
return QCString();
BOOL used_def;
- QCString mb(4096);
+ int bufSize=4096;
+ QCString mb(bufSize);
int len;
while ( !(len=WideCharToMultiByte(CP_ACP, 0, (const WCHAR*)s.unicode(), uclen,
- mb.data(), mb.size()-1, 0, &used_def)) )
+ mb.data(), bufSize-1, 0, &used_def)) )
{
int r = GetLastError();
if ( r == ERROR_INSUFFICIENT_BUFFER ) {
- mb.resize(1+WideCharToMultiByte( CP_ACP, 0,
- (const WCHAR*)s.unicode(), uclen,
- 0, 0, 0, &used_def));
+ bufSize=1+WideCharToMultiByte( CP_ACP, 0,
+ (const WCHAR*)s.unicode(), uclen,
+ 0, 0, 0, &used_def);
+ mb.resize(bufSize);
// and try again...
} else {
// Fail.
diff --git a/qtools/scstring.cpp b/qtools/scstring.cpp
index ebf54a9..a265afe 100644
--- a/qtools/scstring.cpp
+++ b/qtools/scstring.cpp
@@ -34,7 +34,7 @@ SCString::SCString(int size)
m_data = (char *)malloc(size);
if (m_data)
{
- m_data[0]='\0';
+ if (size>1) memset(m_data,' ',size-1);
m_data[size-1]='\0';
}
}
diff --git a/qtools/scstring.h b/qtools/scstring.h
index 0c388b8..41dcfac 100644
--- a/qtools/scstring.h
+++ b/qtools/scstring.h
@@ -144,6 +144,7 @@ inline void SCString::duplicate( const char *str)
}
inline SCString &SCString::duplicate( const char *str, int)
{
+ if (m_data) free(m_data);
duplicate(str);
return *this;
}