From: Michael Wetherell Date: Fri, 10 Nov 2006 22:42:42 +0000 (+0000) Subject: Fix for wxVsnprintf's %n. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e98d32057de9051bdad3b7442357c42226b16be8?ds=sidebyside Fix for wxVsnprintf's %n. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index e49acc8798..a41ac22e71 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -317,7 +317,7 @@ public: // Process this conversion specifier and puts the result in the given // buffer. Returns the number of characters written in 'buf' or -1 if // there's not enough space. - int Process(wxChar *buf, size_t lenMax, wxPrintfArg *p); + int Process(wxChar *buf, size_t lenMax, wxPrintfArg *p, size_t written); // Loads the argument of this conversion specifier from given va_list. bool LoadArg(wxPrintfArg *p, va_list &argptr); @@ -728,7 +728,7 @@ bool wxPrintfConvSpec::LoadArg(wxPrintfArg *p, va_list &argptr) return true; // loading was successful } -int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p) +int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p, size_t written) { // buffer to avoid dynamic memory allocation each time for small strings; // note that this buffer is used only to hold results of number formatting, @@ -906,15 +906,15 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p) break; case wxPAT_NINT: - *p->pad_nint = lenCur; + *p->pad_nint = written; break; case wxPAT_NSHORTINT: - *p->pad_nshortint = (short int)lenCur; + *p->pad_nshortint = (short int)written; break; case wxPAT_NLONGINT: - *p->pad_nlongint = lenCur; + *p->pad_nlongint = written; break; case wxPAT_INVALID: