Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14074/src/gui

Modified Files:
        wxComposeView.cpp 
Log Message:
added c_str() calls for wxStrings passed to printf()

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.379
retrieving revision 1.380
diff -b -u -2 -r1.379 -r1.380
--- wxComposeView.cpp   16 Nov 2004 00:15:26 -0000      1.379
+++ wxComposeView.cpp   16 Nov 2004 10:07:29 -0000      1.380
@@ -70,5 +70,4 @@
 #include <wx/tokenzr.h>
 #include <wx/textbuf.h>
-#include <wx/encconv.h>
 #include <wx/fontmap.h>
 #include <wx/fontutil.h>      // for wxNativeFontInfo
@@ -3941,12 +3940,31 @@
                // compatible -- one, in which case we need to translate it
                wxString textConv;
-               const wxString *text wxDUMMY_INITIALIZE(NULL);
+               const wxString *text = &part->GetText();
 
                wxFontEncoding encodingPart = part->GetEncoding();
-               if ( encodingMsg != wxFONTENCODING_SYSTEM &&
-                        encodingPart != encodingMsg )
+               if ( encodingMsg == wxFONTENCODING_SYSTEM )
                {
-                  wxEncodingConverter conv;
-                  if ( !conv.Init(encodingPart, encodingMsg) )
+                  // use the encoding of this part for all the other ones
+                  encodingMsg = encodingPart;
+               }
+
+               if ( encodingPart != encodingMsg )
+               {
+                  // try converting this part to the message encoding
+                  wxCSConv convPart(encodingPart);
+                  wxWCharBuffer wtext(convPart.cMB2WC(*text));
+
+                  bool ok = wtext.data() != NULL;
+
+                  if ( ok )
+                  {
+                     wxCSConv convMsg(encodingMsg);
+                     wxCharBuffer mbtext(convMsg.cWC2MB(wtext));
+                     ok = mbtext.data() != NULL;
+                     if ( ok )
+                        textConv = mbtext;
+                  }
+
+                  if ( !ok )
                   {
                      if ( !MDialog_YesNoDialog
@@ -3957,6 +3975,6 @@
                                    "the encoding \"%s\", would you like to "
                                    "send it in encoding \"%s\" instead?"),
-                                 wxFontMapper::GetEncodingName(encodingMsg),
-                                 wxFontMapper::GetEncodingName(encodingPart)
+                                 
wxFontMapper::GetEncodingName(encodingMsg).c_str(),
+                                 
wxFontMapper::GetEncodingName(encodingPart).c_str()
                               ),
                               this,
@@ -3974,19 +3992,15 @@
                      //        different encodings, we should use UTF8 in this
                      //        case but for this we must do a preliminary
-                     //        iteration over all text parts
+                     //        iteration over all text parts and it's worthless
+                     //        to do it now as we only can have a single text
+                     //        part with the text composer anyhow
                      encodingMsg = encodingPart;
                   }
-                  else // can convert, do it
+                  else
                   {
-                     textConv = conv.Convert(part->GetText());
                      text = &textConv;
                   }
                }
-               else // use the encoding as is
-               {
-                  encodingMsg = encodingPart;
-
-                  text = &part->GetText();
-               }
+               //else: use the encoding as is
 
                msg->AddPart(



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to