From: Vadim Zeitlin Date: Mon, 11 Oct 2004 23:49:15 +0000 (+0000) Subject: wxPuts() should output a trailing newline even in Unix/Unicode builds X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/19b65a3033b64672b1d726bae1cd240112b1639e wxPuts() should output a trailing newline even in Unix/Unicode builds git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index ad81c9d99e..18c3a3426c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -199,6 +199,13 @@ versions, please update your code to not use them. OTHER CHANGES ============= +2.5.4 +----- + +Unix: + +- wxPuts() now correctly outputs trailing new line in Unicode build + 2.5.3 ----- diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index a5a03e38a0..cd87652f6d 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -393,9 +393,11 @@ #define wxNEED_UNGETC #define wxNEED_FPUTS + #define wxNEED_PUTS #define wxNEED_PUTC int wxFputs(const wxChar *ch, FILE *stream); + int wxPuts(const wxChar *ws); int wxPutc(wxChar ch, FILE *stream); #ifdef __cplusplus @@ -407,7 +409,6 @@ #endif #define wxPutchar(wch) wxPutc(wch, stdout) - #define wxPuts(ws) wxFputs(ws, stdout) #define wxNEED_PRINTF_CONVERSION #define wxNEED_WX_STDIO_H @@ -498,7 +499,8 @@ #ifdef HAVE_PUTWS #define wxPuts putws #else - #define wxPuts(ws) wxFputs(ws, stdout) + #define wxNEED_PUTS + int wxPuts(const wxChar *ws) #endif /* we need %s to %ls conversion for printf and scanf etc */ diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 1b86121929..9f12a7b582 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -613,6 +613,22 @@ int wxFputs(const wchar_t *ws, FILE *stream) } #endif // wxNEED_FPUTS +#ifdef wxNEED_PUTS +int wxPuts(const wxChar *ws) +{ + int rc = wxFputs(ws, stdout); + if ( rc != -1 ) + { + if ( wxFputs(L"\n", stdout) == -1 ) + return -1; + + rc++; + } + + return rc; +} +#endif // wxNEED_PUTS + #ifdef wxNEED_PUTC int /* not wint_t */ wxPutc(wchar_t wc, FILE *stream) {