From 30386aeb867e0b6311450a87c056c42301765a65 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2007 22:52:36 +0000 Subject: [PATCH] define wxUTF8Buf as the type returned by wxString::utf8_str() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/buffer.h | 7 +++++++ src/gtk/print.cpp | 14 ++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/wx/buffer.h b/include/wx/buffer.h index a18b85c762..bfaba4e58d 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -226,6 +226,13 @@ typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; #define wxWX2WCbuf wxWCharBuffer #endif // Unicode/ANSI +// type of the value returned by wxString::utf8_str() +#if wxUSE_UNICODE_UTF8 + #define wxUTF8Buf wxCharBuffer +#else + #define wxUTF8Buf char * +#endif + // ---------------------------------------------------------------------------- // A class for holding growable data buffers (not necessarily strings) // ---------------------------------------------------------------------------- diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index cf51030353..2374a13d87 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1715,12 +1715,7 @@ void wxGtkPrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, bool underlined = m_font.Ok() && m_font.GetUnderlined(); -// FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer -#if wxUSE_UNICODE_UTF8 - const char *data = text.utf8_str(); -#else - const wxCharBuffer data = text.utf8_str(); -#endif + const wxUTF8Buf data = text.utf8_str(); size_t datalen = strlen(data); pango_layout_set_text( m_layout, data, datalen); @@ -2135,12 +2130,7 @@ void wxGtkPrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoo } // Set layout's text - // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer -#if wxUSE_UNICODE_UTF8 - const char *dataUTF8 = string.utf8_str(); -#else - const wxCharBuffer dataUTF8 = string.utf8_str(); -#endif + const wxUTF8Buf dataUTF8 = string.utf8_str(); PangoFontDescription *desc = m_fontdesc; if (theFont) desc = theFont->GetNativeFontInfo()->description; -- 2.45.2