From a31746c7de9d15ae29bafcdf45f1ee23eca40de6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 May 2006 17:14:35 +0000 Subject: [PATCH] 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 --- src/common/wxchar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index da53404e28..3532e0533b 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -785,7 +785,7 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p) if (type == wxPAT_PCHAR) { // user passed a string explicitely indicated as ANSI... - val = wxString(p->pad_pchar, wxConvLibc); + val = s = wxString(p->pad_pchar, wxConvLibc); } #else p->pad_pchar; @@ -793,7 +793,7 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p) #if wxUSE_WCHAR_T if (type == wxPAT_PWCHAR) { // user passed a string explicitely indicated as Unicode... - val = wxString(p->pad_pwchar, wxConvLibc); + val = s = wxString(p->pad_pwchar, wxConvLibc); } #endif #endif @@ -802,7 +802,9 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p) if (val) { #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 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 - 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); lenCur += len; #else -- 2.45.2