summaryrefslogtreecommitdiffstats
path: root/qtools
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2004-12-13 18:59:17 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2004-12-13 18:59:17 (GMT)
commitd048df9811a8686d93dc28f275a1c5c575833669 (patch)
tree024124085a492939d5ad3d3b60fbac43f928b925 /qtools
parent71de527ef4ec4b221eecfe02450548390fc03cf4 (diff)
downloadDoxygen-d048df9811a8686d93dc28f275a1c5c575833669.zip
Doxygen-d048df9811a8686d93dc28f275a1c5c575833669.tar.gz
Doxygen-d048df9811a8686d93dc28f275a1c5c575833669.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;
}