From 7b9392f0c76625840697450cec4bb0bde3746596 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 1 Jan 2005 19:37:26 +0000 Subject: [PATCH] Necessary changes for the previous API/UTF-8 changes. --- src/mmg/mmg.cpp | 17 +++++++++++++---- src/mmg/mmg.h | 1 + src/mmg/tab_input.cpp | 15 --------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index d4ef4d5df..ddf8a7e99 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -431,24 +431,33 @@ strip(vector &v, string to_utf8(const wxString &src) { - char *utf8; string retval; #if WXUNICODE + char *utf8; int len; len = wxConvUTF8.WC2MB(NULL, src.c_str(), 0); utf8 = (char *)safemalloc(len + 1); wxConvUTF8.WC2MB(utf8, src.c_str(), len + 1); -#else - utf8 = to_utf8_c(cc_local_utf8, src); -#endif retval = utf8; safefree(utf8); +#else + retval = to_utf8(cc_local_utf8, src.c_str()); +#endif return retval; } +wxString +from_utf8(const wxString &src) { +#if WXUNICODE + return src; +#else + return wxString(from_utf8(cc_local_utf8, src.c_str()).c_str()); +#endif +} + wxString unescape(const wxString &src) { wxString dst; diff --git a/src/mmg/mmg.h b/src/mmg/mmg.h index 046688850..5e6f8770e 100644 --- a/src/mmg/mmg.h +++ b/src/mmg/mmg.h @@ -92,6 +92,7 @@ wxString join(const wxString &pattern, vector &strings); wxString &strip(wxString &s, bool newlines = false); vector & strip(vector &v, bool newlines = false); string to_utf8(const wxString &src); +wxString from_utf8(const wxString &src); wxString UTFstring_to_wxString(const UTFstring &u); wxString unescape(const wxString &src); wxString format_date_time(time_t date_time); diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index e0bfb6e7d..abe22c3a4 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -634,21 +634,6 @@ tab_input::enable_ar_controls(mmg_track_t *track) { rb_display_dimensions->SetValue(!ar_enabled); } -static wxString -from_utf8(const wxString &src) { -#if WXUNICODE - return src; -#else - wxString retval; - char *local; - - local = from_utf8_c(cc_local_utf8, src.c_str()); - retval = local; - safefree(local); - return retval; -#endif -} - void tab_input::on_add_file(wxCommandEvent &evt) { wxString media_files;