wx printf() implementation bug fixes ('%' handling, thread safety, ...) and optimisations (patch 1548750)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-09-05 21:14:38 +00:00
parent 21d124e03c
commit 412a5c570d
6 changed files with 577 additions and 164 deletions

View File

@@ -1746,6 +1746,12 @@ wxGetTranslation wouldn't find them.
The same as \helpref{wxSnprintf}{wxsnprintf} but takes a {\tt va\_list }
argument instead of arbitrary number of parameters.
Note that if \texttt{wxUSE_PRINTF_POS_PARAMS} is set to 1, then this function supports
positional arguments (see \helpref{wxString::Printf}{wxstringprintf} for more information).
However other functions of the same family (wxPrintf, wxSprintf, wxFprintf, wxVfprintf,
wxVfprintf, wxVprintf, wxVsprintf) currently do not to support positional parameters
even when \texttt{wxUSE_PRINTF_POS_PARAMS} is 1.
\wxheading{See also}
\helpref{wxSnprintf}{wxsnprintf}, \helpref{wxString::PrintfV}{wxstringprintfv}

View File

@@ -897,6 +897,19 @@ Prepends {\it str} to this string, returning a reference to this string.
Similar to the standard function {\it sprintf()}. Returns the number of
characters written, or an integer less than zero on error.
Note that if {\tt wxUSE_PRINTF_POS_PARAMS} is set to 1, then this function supports
Unix98-style positional parameters:
\begin{verbatim}
wxString str;
str.Printf(wxT("%d %d %d"), 1, 2, 3);
// str now contains "1 2 3"
str.Printf(wxT("%2$d %3$d %1$d"), 1, 2, 3);
// str now contains "2 3 1"
\end{verbatim}
{\bf NB:} This function will use a safe version of {\it vsprintf()} (usually called
{\it vsnprintf()}) whenever available to always allocate the buffer of correct
size. Unfortunately, this function is not available on all platforms and the