fixes for wxVsnprintf() in Unicode build (2nd part of patch 1462778)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-30 17:14:35 +00:00
parent 851dee09b5
commit a31746c7de

View File

@@ -785,7 +785,7 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p)
if (type == wxPAT_PCHAR) { if (type == wxPAT_PCHAR) {
// user passed a string explicitely indicated as ANSI... // user passed a string explicitely indicated as ANSI...
val = wxString(p->pad_pchar, wxConvLibc); val = s = wxString(p->pad_pchar, wxConvLibc);
} }
#else #else
p->pad_pchar; p->pad_pchar;
@@ -793,7 +793,7 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p)
#if wxUSE_WCHAR_T #if wxUSE_WCHAR_T
if (type == wxPAT_PWCHAR) { if (type == wxPAT_PWCHAR) {
// user passed a string explicitely indicated as Unicode... // user passed a string explicitely indicated as Unicode...
val = wxString(p->pad_pwchar, wxConvLibc); val = s = wxString(p->pad_pwchar, wxConvLibc);
} }
#endif #endif
#endif #endif
@@ -802,7 +802,9 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p)
if (val) if (val)
{ {
#if wxUSE_STRUTILS #if wxUSE_STRUTILS
len = wxMin(max_width, wxStrlen(val)); // at this point we are sure that max_width is positive or null
// (see top of wxPrintfConvSpec::LoadArg)
len = wxMin((unsigned int)max_width, wxStrlen(val));
#else #else
for ( len = 0; val[len] && (len < max_width); len++ ) for ( len = 0; val[len] && (len < max_width); len++ )
; ;
@@ -828,7 +830,9 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p)
} }
#if wxUSE_STRUTILS #if wxUSE_STRUTILS
len = wxMin(len, lenMax-lenCur); // at this point we are sure that max_width is positive or null
// (see top of wxPrintfConvSpec::LoadArg)
len = wxMin((unsigned int)len, lenMax-lenCur);
wxStrncpy(buf+lenCur, val, len); wxStrncpy(buf+lenCur, val, len);
lenCur += len; lenCur += len;
#else #else