Revision: 7350
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7350&view=rev
Author:   vadz
Date:     2007-08-28 06:50:13 -0700 (Tue, 28 Aug 2007)

Log Message:
-----------
replace wxConvertMB2WX() which is almost never the right function to use with 
the appropriate conversions

Modified Paths:
--------------
    trunk/M/include/strutil.h
    trunk/M/src/adb/ProvPasswd.cpp
    trunk/M/src/classes/XFace.cpp
    trunk/M/src/gui/wxMDialogs.cpp
    trunk/M/src/mail/MFPool.cpp
    trunk/M/src/mail/MailFolder.cpp
    trunk/M/src/mail/MailFolderCC.cpp
    trunk/M/src/mail/MimeType.cpp
    trunk/M/src/mail/SendMessageCC.cpp
    trunk/M/src/modules/spam/HeadersFilter.cpp
    trunk/M/src/util/ssl.cpp
    trunk/M/src/util/strutil.cpp

Modified: trunk/M/include/strutil.h
===================================================================
--- trunk/M/include/strutil.h   2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/include/strutil.h   2007-08-28 13:50:13 UTC (rev 7350)
@@ -128,16 +128,6 @@
 */
 char * strutil_strdup(const char *in);
 
-/**
-   This takes the string and splits it into tokens delimited by the
-   given delimiters, by using the strsep() function. The tokens are
-   returned as an STL list.
-   @param string     pointer to the character array holding the string
-   @param delim          character array holding the delimiters
-   @param tlist          reference to an STL String list to append the tokens 
to
-  */
-void strutil_tokenise(wxChar *string, const wxChar *delim, kbStringList 
&tlist);
-
 /** Find a next URL in the string.
 
     Note: this is implemented in matchurl.cpp, not strutil.cpp

Modified: trunk/M/src/adb/ProvPasswd.cpp
===================================================================
--- trunk/M/src/adb/ProvPasswd.cpp      2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/adb/ProvPasswd.cpp      2007-08-28 13:50:13 UTC (rev 7350)
@@ -317,12 +317,12 @@
    struct passwd *pwd;
    while ( (pwd = getpwent()) != NULL )
    {
-      size_t index = m_names.Add(wxConvertMB2WX(pwd->pw_name));
+      size_t index = m_names.Add(wxSafeConvertMB2WX(pwd->pw_name));
 
       // at least under Linux gecos fields of the password database often have
       // trailing commas to indicate missing fields but we don't want to use
       // them as part of "real name"
-      wxString gecos(wxConvertMB2WX(pwd->pw_gecos));
+      wxString gecos(wxSafeConvertMB2WX(pwd->pw_gecos));
       gecos.EndsWith(",,,", &gecos);
 
       m_gecos.Insert(gecos, index);

Modified: trunk/M/src/classes/XFace.cpp
===================================================================
--- trunk/M/src/classes/XFace.cpp       2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/classes/XFace.cpp       2007-08-28 13:50:13 UTC (rev 7350)
@@ -111,7 +111,7 @@
       if(zero == 0 || one == 0)
       {
          strncpy(buffer,token+4,8);
-         tstr = wxConvertMB2WX(buffer);
+         tstr = wxString::FromAscii(buffer);
          strutil_tolower(tstr);
 
          if(tstr == _T("#000000") || tstr == _T("gray0"))
@@ -145,7 +145,7 @@
          }
          value = value ^ 0xffff;
          sprintf(buffer,"0x%04lX", value);
-         dataString += wxConvertMB2WX(buffer);
+         dataString += wxString::FromAscii(buffer);
          dataString += _T(',');
       }
       dataString += _T('\n');
@@ -515,7 +515,7 @@
 XFace::GetHeaderLine(void) const
 {
    if(xface)
-      return wxConvertMB2WX(xface);
+      return wxString::FromAscii(xface);
    else
       return wxEmptyString;
 }

Modified: trunk/M/src/gui/wxMDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMDialogs.cpp      2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/gui/wxMDialogs.cpp      2007-08-28 13:50:13 UTC (rev 7350)
@@ -559,7 +559,7 @@
       msg;
 
    msg = String(message) + _("\nSystem error: ")
-      + wxConvertMB2WX(strerror(errno));
+      + wxSafeConvertMB2WX(strerror(errno));
 
    MDialog_ErrorMessage(msg.c_str(), parent, wxString(M_TITLE_PREFIX)+title, 
modal);
 }

Modified: trunk/M/src/mail/MFPool.cpp
===================================================================
--- trunk/M/src/mail/MFPool.cpp 2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/mail/MFPool.cpp 2007-08-28 13:50:13 UTC (rev 7350)
@@ -228,7 +228,7 @@
 {
    CHECK_RET( driver, _T("MFPool::Add(): NULL driver") );
 
-   const String driverName = wxConvertMB2WX(driver->GetName());
+   const String driverName = driver->GetName();
 
    MFClassPool *pool = MFClassPool::Find(driverName);
    if ( !pool )
@@ -257,7 +257,7 @@
 {
    CHECK( driver, NULL, _T("MFPool::Find(): NULL driver") );
 
-   MFClassPool *pool = MFClassPool::Find(wxConvertMB2WX(driver->GetName()));
+   MFClassPool *pool = MFClassPool::Find(driver->GetName());
    if ( !pool )
    {
       // no cached folders of this class at all

Modified: trunk/M/src/mail/MailFolder.cpp
===================================================================
--- trunk/M/src/mail/MailFolder.cpp     2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/mail/MailFolder.cpp     2007-08-28 13:50:13 UTC (rev 7350)
@@ -147,7 +147,7 @@
    const String kind = folder->GetClass();
 
    // find the creation function for this kind of folders
-   MFDriver *driver = MFDriver::Get(wxConvertWX2MB(kind));
+   MFDriver *driver = MFDriver::Get(kind.ToAscii());
    if ( !driver )
    {
       ERRORMESSAGE((_("Unknown folder kind '%s'"), kind.c_str()));
@@ -1275,7 +1275,7 @@
       // time stamp
       time_t t;
       time(&t);
-      fromLine += wxConvertMB2WX(ctime(&t));
+      fromLine += ctime(&t);
 
       ok = out.Write(fromLine);
 

Modified: trunk/M/src/mail/MailFolderCC.cpp
===================================================================
--- trunk/M/src/mail/MailFolderCC.cpp   2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/mail/MailFolderCC.cpp   2007-08-28 13:50:13 UTC (rev 7350)
@@ -280,23 +280,31 @@
 #endif
 };
 
-/// trivial wrappers around mail_open() which wants a non const "char *" (ugh)
+// trivial wrappers around mail_open() and mail_create() which want non
+// const "char *" (ugh)
+
+// this function accepts either "const char *" (in ANSI build) or wxCharBuffer
+// (in Unicode) allowing us to at least avoid having to write horrors like
+// "(char *)(const char *)s.ToAscii()"
+static inline char *CONST_CCAST(const char *p)
+{
+   return const_cast<char *>(p);
+}
+
 static inline
-MAILSTREAM *MailOpen(MAILSTREAM *stream, const char *mailbox, long options = 0)
+MAILSTREAM *
+MailOpen(MAILSTREAM *stream, const String& mailbox, long options = 0)
 {
    if ( mm_show_debug )
       options |= OP_DEBUG;
 
-   return mail_open(stream, (char *)mailbox, options);
+   return mail_open(stream, CONST_CCAST(mailbox.ToAscii()), options);
 }
 
-// we want to specify the stream as the first argument as c-client does so we
-// can't use just one function with default NIL parameter for the stream but
-// instead we have this second version for the most common case
 static inline
-MAILSTREAM *MailOpen(const char *mailbox, long options = 0)
+long MailCreate(MAILSTREAM *stream, const String& mailbox)
 {
-   return MailOpen(NIL, mailbox, options);
+   return mail_create(stream, CONST_CCAST(mailbox.ToAscii()));
 }
 
 // ============================================================================
@@ -895,7 +903,7 @@
 class MMStatusRedirector
 {
 public:
-   MMStatusRedirector(const String& mailbox, MAILSTATUS *mailstatus)
+   MMStatusRedirector(const char *mailbox, MAILSTATUS *mailstatus)
    {
       ms_mailstatus = mailstatus;
       memset(ms_mailstatus, 0, sizeof(*ms_mailstatus));
@@ -929,7 +937,7 @@
    // which can be compared with another NETMBX later
    //
    // returns false if we failed to parse the mailbox spec
-   static bool CanonicalizeMailbox(const wxChar *mailbox,
+   static bool CanonicalizeMailbox(const char *mailbox,
                                    NETMBX *mbx,
                                    String *filename)
    {
@@ -963,7 +971,7 @@
       //     name already is
       String filename;
       NETMBX mbx;
-      if ( !CanonicalizeMailbox(wxConvertMB2WX(name), &mbx, &filename) )
+      if ( !CanonicalizeMailbox(wxString::FromAscii(name), &mbx, &filename) )
       {
          FAIL_MSG( _T("c-client failed to parse its own spec?") );
       }
@@ -1674,7 +1682,7 @@
                  imapspec.c_str());
 
       CCErrorDisabler noErrs;
-      stream = MailOpen(wxConvertWX2MB(imapspec));
+      stream = MailOpen(NULL, imapspec);
    }
 
    // login data was reset by mm_login() called from mail_open(), set it once
@@ -1694,7 +1702,7 @@
                  imapspec.c_str());
 
       // stream may be NIL or not here
-      mail_create(stream, imapspec.char_str());
+      MailCreate(stream, imapspec);
 
       // restore the auth info once again
       if ( !login.empty() )
@@ -1706,7 +1714,7 @@
       wxLogTrace(TRACE_MF_CALLS, _T("Opening MailFolderCC '%s' after creating 
it."),
                  imapspec.c_str());
 
-      stream = MailOpen(stream, wxConvertWX2MB(imapspec));
+      stream = MailOpen(stream, imapspec);
    }
 
    if ( stream )
@@ -1802,8 +1810,6 @@
    // if the file folder doesn't exist, we should create it first
    if ( !exists )
    {
-      // This little hack makes it root (uid 0) safe and allows us
-      // to choose the file format, too:
       String tmp;
       if ( folderType == MF_FILE )
       {
@@ -1841,7 +1847,7 @@
       }
 
       tmp += m_ImapSpec;
-      mail_create(NIL, strutil_strdup(wxConvertWX2MB(tmp))); // const_cast for 
c-client
+      MailCreate(NIL, tmp);
    }
 
    // we either already tried to create it once or it had existed even before
@@ -2098,7 +2104,7 @@
          wxLogTrace(TRACE_MF_CALLS, _T("Opening MailFolderCC '%s'."),
                     m_ImapSpec.c_str());
 
-         m_MailStream = MailOpen(stream, wxConvertWX2MB(m_ImapSpec), 
ccOptions);
+         m_MailStream = MailOpen(stream, m_ImapSpec, ccOptions);
       }
    } // end of cclient lock block
 
@@ -2126,8 +2132,7 @@
 
       // redirect all notifications to us again
       CCDefaultFolder def(this);
-      MAILSTREAM *
-         msHalfOpened = MailOpen(m_MailStream, wxConvertWX2MB(m_ImapSpec), 
OP_HALFOPEN);
+      MAILSTREAM *msHalfOpened = MailOpen(m_MailStream, m_ImapSpec, 
OP_HALFOPEN);
       if ( msHalfOpened )
       {
          mail_close(msHalfOpened);
@@ -2478,9 +2483,10 @@
    // immediately afterwards, so don't try to access it from here
    if ( GetType() == MF_FILE )
    {
-      if ( !wxFile::Exists(wxConvertMB2WX(m_MailStream->mailbox)) )
+      if ( !wxFile::Exists(wxString::FromAscii(m_MailStream->mailbox)) )
       {
-         DBGMESSAGE((_T("MBOX folder '%s' already deleted."), 
m_MailStream->mailbox));
+         DBGMESSAGE((_T("MBOX folder '%s' already deleted."),
+                    m_MailStream->mailbox));
          return;
       }
    }
@@ -2651,7 +2657,7 @@
       // we're not interested in mm_exists() and what not
       CCCallbackDisabler noCallbacks;
 
-      stream = MailOpen(wxConvertWX2MB(spec), OP_HALFOPEN | OP_READONLY);
+      stream = MailOpen(NULL, spec, OP_HALFOPEN | OP_READONLY);
       if ( !stream )
       {
          // if we failed to open it, checking its status won't work neither
@@ -4978,8 +4984,8 @@
    // normally this shouldn't happen
    ASSERT_MSG( !MF_user.empty(), _T("no username in mm_login()?") );
 
-   strcpy(user, wxConvertWX2MB(MF_user.c_str()));
-   strcpy(pwd, wxConvertWX2MB(MF_pwd.c_str()));
+   strcpy(user, wxSafeConvertWX2MB(MF_user));
+   strcpy(pwd, wxSafeConvertWX2MB(MF_pwd));
 
    // they are used once only, don't keep them or they could be reused for
    // another folder somehow
@@ -5006,7 +5012,7 @@
 {
    if ( stream )
    {
-      ms_LastCriticalFolder = wxConvertMB2WX(stream->mailbox);
+      ms_LastCriticalFolder = wxString::FromAscii(stream->mailbox);
       MailFolderCC *mf = LookupObject(stream);
       if(mf)
       {
@@ -5056,13 +5062,16 @@
 void
 MailFolderCC::mm_fatal(char *str)
 {
-   GetLogCircle().Add(wxConvertMB2WX(str));
+   GetLogCircle().Add(wxSafeConvertMB2WX(str));
    wxLogError(_("Fatal error: %s"), str);
 
-   String msg2 = wxConvertMB2WX(str);
+   String msg2 = wxSafeConvertMB2WX(str);
    if(ms_LastCriticalFolder.length())
+   {
       msg2 << _("\nLast folder in a critical section was: ")
            << ms_LastCriticalFolder;
+   }
+
    FatalError(msg2);
 }
 
@@ -5343,7 +5352,7 @@
 
       // open the folder: although we don't need to do it to get its status, we
       // have to do it anyhow below, so better do it right now
-      stream = MailOpen(stream, wxConvertWX2MB(mboxpath));
+      stream = MailOpen(stream, mboxpath);
 
       if ( !stream )
       {
@@ -5356,7 +5365,7 @@
 
       // get the number of messages (only)
       MAILSTATUS mailstatus;
-      MMStatusRedirector statusRedir(wxConvertMB2WX(stream->mailbox), 
&mailstatus);
+      MMStatusRedirector statusRedir(stream->mailbox, &mailstatus);
       mail_status(stream, stream->mailbox, SA_MESSAGES);
       nmsgs = mailstatus.messages;
    }
@@ -5649,7 +5658,7 @@
 
    if ( !mm_disable_callbacks )
    {
-      MailFolderCC::mm_notify(stream, wxConvertMB2WX(str), errflg);
+      MailFolderCC::mm_notify(stream, wxString::FromAscii(str), errflg);
    }
 }
 
@@ -5658,7 +5667,7 @@
 {
    TRACE_CALLBACK3(mm_list, "%d, `%s', %ld", delim, name, attrib);
 
-   MailFolderCC::mm_list(stream, delim, wxConvertMB2WX(name), attrib);
+   MailFolderCC::mm_list(stream, delim, wxString::FromAscii(name), attrib);
 }
 
 void
@@ -5666,7 +5675,7 @@
 {
    TRACE_CALLBACK3(mm_lsub, "%d, `%s', %ld", delim, name, attrib);
 
-   MailFolderCC::mm_lsub(stream, delim, wxConvertMB2WX(name), attrib);
+   MailFolderCC::mm_lsub(stream, delim, wxString::FromAscii(name), attrib);
 }
 
 void
@@ -5692,7 +5701,7 @@
    }
    else if ( !mm_disable_callbacks )
    {
-      MailFolderCC::mm_status(stream, wxConvertMB2WX(mailbox), status);
+      MailFolderCC::mm_status(stream, wxString::FromAscii(mailbox), status);
    }
 }
 
@@ -5704,7 +5713,7 @@
    if ( mm_disable_callbacks || mm_ignore_errors )
       return;
 
-   String msg = wxConvertMB2WX(str);
+   String msg = wxString::FromAscii(str);
 
    // TODO: what's going on here?
    if(errflg >= 4) // fatal imap error, reopen-mailbox
@@ -5726,7 +5735,7 @@
 
    // if ( !mm_disable_callbacks )
    {
-      MailFolderCC::mm_dlog(wxConvertMB2WX(str));
+      MailFolderCC::mm_dlog(wxString::FromAscii(str));
    }
 }
 

Modified: trunk/M/src/mail/MimeType.cpp
===================================================================
--- trunk/M/src/mail/MimeType.cpp       2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/mail/MimeType.cpp       2007-08-28 13:50:13 UTC (rev 7350)
@@ -43,12 +43,12 @@
 
 MimeType& MimeType::Assign(const String& mimetype)
 {
-   String type = mimetype.BeforeFirst('/').Upper();
+   const wxCharBuffer type(mimetype.BeforeFirst('/').Upper().ToAscii());
 
    m_primary = INVALID;
    for ( size_t n = 0; body_types[n]; n++ )
    {
-      if ( type == wxConvertMB2WX(body_types[n]) )
+      if ( strcmp(type, body_types[n]) == 0 )
       {
          m_primary = (MimeType::Primary)n;
 
@@ -70,7 +70,7 @@
    ASSERT_MSG( IsOk(), _T("using uninitialized MimeType") );
 
    // body_types is defined in c-client/rfc822.c
-   return wxConvertMB2WX(body_types[m_primary]);
+   return wxString::FromAscii(body_types[m_primary]);
 }
 
 // ----------------------------------------------------------------------------

Modified: trunk/M/src/mail/SendMessageCC.cpp
===================================================================
--- trunk/M/src/mail/SendMessageCC.cpp  2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/mail/SendMessageCC.cpp  2007-08-28 13:50:13 UTC (rev 7350)
@@ -458,7 +458,7 @@
       hdr += *p;
    }
 
-   m_Envelope->remail = cpystr(wxConvertWX2MB(hdr.c_str()));
+   m_Envelope->remail = cpystr(hdr.ToAscii());
 
    // now copy the body: note that we have to use ENC7BIT here to prevent
    // c-client from (re)encoding the body
@@ -468,7 +468,7 @@
 
    // FIXME: we potentially copy a lot of data here!
    String text = message->FetchText();
-   m_Body->contents.text.data = (unsigned char 
*)cpystr(wxConvertWX2MB(text.c_str()));
+   m_Body->contents.text.data = (unsigned char *)cpystr(text.To8BitData());
    m_Body->contents.text.size = text.length();
 }
 
@@ -785,10 +785,10 @@
    //            it separately if necessary
    ASSERT_MSG( m_Protocol == Prot_NNTP, _T("can't post and send message") );
 
-   if(groups.Length())
+   if ( !groups.empty() )
    {
       ASSERT(m_Envelope->newsgroups == NIL);
-      m_Envelope->newsgroups = strdup(wxConvertWX2MB(groups));
+      m_Envelope->newsgroups = cpystr(groups.ToAscii());
    }
 
 }
@@ -992,7 +992,8 @@
    // is not a FQDN so don't do it in this case
    if ( m_DefaultHost.find('.') != String::npos )
    {
-      m_Envelope->message_id = 
cpystr(wxConvertWX2MB(BuildMessageId(wxConvertWX2MB(m_DefaultHost))));
+      m_Envelope->message_id = cpystr(
+            BuildMessageId(m_DefaultHost.ToAscii()).ToAscii());
    }
 
    // don't add any more headers to the message being resent
@@ -1058,13 +1059,14 @@
          i != m_extraHeaders.end();
          ++i, ++h )
    {
-      m_headerNames[h] = strutil_strdup(wxConvertWX2MB(i->m_name));
-      if ( wxStricmp(wxConvertMB2WX(m_headerNames[h]), _T("Reply-To")) == 0 )
+      const wxWX2MBbuf name(i->m_name.ToAscii());
+      if ( wxStricmp(name, _T("Reply-To")) == 0 )
          replyToSet = true;
-      else if ( wxStricmp(wxConvertMB2WX(m_headerNames[h]), _T("X-Mailer")) == 
0 )
+      else if ( wxStricmp(name, _T("X-Mailer")) == 0 )
          xmailerSet = true;
 
-      m_headerValues[h] = strutil_strdup(wxConvertWX2MB(i->m_value));
+      m_headerNames[h] = strutil_strdup(name);
+      m_headerValues[h] = strutil_strdup(i->m_value.To8BitData());
    }
 
    // add X-Mailer header if it wasn't overridden by the user (yes, we do allow
@@ -1084,7 +1086,7 @@
 #else // Windows
       version << _T(", running under ") << wxGetOsDescription();
 #endif // Unix/Windows
-      m_headerValues[h++] = strutil_strdup(wxConvertWX2MB(version));
+      m_headerValues[h++] = strutil_strdup(version.To8BitData());
    }
 
    // set Reply-To if it hadn't been set by the user as a custom header
@@ -1095,7 +1097,7 @@
       if ( !m_ReplyTo.empty() )
       {
          m_headerNames[h] = strutil_strdup("Reply-To");
-         m_headerValues[h++] = strutil_strdup(wxConvertWX2MB(m_ReplyTo));
+         m_headerValues[h++] = strutil_strdup(m_ReplyTo.To8BitData());
       }
    }
 
@@ -1107,7 +1109,7 @@
       if ( xface.CreateFromFile(m_XFaceFile) )
       {
          m_headerNames[h] = strutil_strdup("X-Face");
-         m_headerValues[h] = 
strutil_strdup(wxConvertWX2MB(xface.GetHeaderLine()));
+         m_headerValues[h] = strutil_strdup(xface.GetHeaderLine().ToAscii());
          if(strlen(m_headerValues[h]))  // paranoid, I know.
          {
             ASSERT_MSG( ((char*) 
(m_headerValues[h]))[strlen(m_headerValues[h])-2] == '\r', _T("String should 
have been DOSified") );
@@ -1274,8 +1276,8 @@
             hasCharset = true;
          }
 
-         par->attribute = strdup(wxConvertWX2MB(name));
-         par->value     = strdup(wxConvertWX2MB(i->value));
+         par->attribute = strdup(name.To8BitData());
+         par->value     = strdup(i->value.To8BitData());
          par->next      = lastpar;
          lastpar = par;
       }
@@ -1309,14 +1311,14 @@
       {
          par = mail_newbody_parameter();
          par->attribute = strdup("CHARSET");
-         par->value     = strdup(wxConvertWX2MB(cs));
+         par->value     = strdup(cs.ToAscii());
          par->next      = lastpar;
          lastpar = par;
       }
    }
 
    bdy->parameter = lastpar;
-   bdy->disposition.type = strdup(wxConvertWX2MB(disposition));
+   bdy->disposition.type = strdup(disposition.ToAscii());
    if ( dlist )
    {
       PARAMETER *lastpar = NULL,
@@ -1326,8 +1328,8 @@
       for ( i = dlist->begin(); i != dlist->end(); i++ )
       {
          par = mail_newbody_parameter();
-         par->attribute = strdup(wxConvertWX2MB(i->name));
-         par->value     = strdup(wxConvertWX2MB(i->value));
+         par->attribute = strdup(i->name.To8BitData());
+         par->value     = strdup(i->value.To8BitData());
          par->next      = NULL;
          if(lastpar)
             lastpar->next = par;
@@ -1706,13 +1708,13 @@
       {
          case Prot_SMTP:
             success = smtp_mail (stream,"MAIL",m_Envelope,m_Body) != 0;
-            reply = wxConvertMB2WX(stream->reply);
+            reply = wxString::From8BitData(stream->reply);
             smtp_close (stream);
             break;
 
          case Prot_NNTP:
             success = nntp_mail (stream,m_Envelope,m_Body) != 0;
-            reply = wxConvertMB2WX(stream->reply);
+            reply = wxString::From8BitData(stream->reply);
             nntp_close (stream);
             break;
 
@@ -1886,7 +1888,7 @@
 static long write_str_output(void *stream, char *string)
 {
    String *o = (String *)stream;
-   *o << wxConvertMB2WX(string);
+   *o << string;
    return 1;
 }
 

Modified: trunk/M/src/modules/spam/HeadersFilter.cpp
===================================================================
--- trunk/M/src/modules/spam/HeadersFilter.cpp  2007-08-27 21:44:47 UTC (rev 
7349)
+++ trunk/M/src/modules/spam/HeadersFilter.cpp  2007-08-28 13:50:13 UTC (rev 
7350)
@@ -987,7 +987,7 @@
    domain.Printf(_T("%d.%d.%d.%d.%s"), d, c, b, a, rblDomain.c_str() );
 
    res_init();
-   len = res_query( wxConvertWX2MB(domain.c_str()), C_IN, T_A,
+   len = res_query( domain.ToAscii(), C_IN, T_A,
                     (unsigned char *)answerBuffer, PACKETSZ );
 
    if ( len != -1 )
@@ -997,7 +997,7 @@
          delete [] answerBuffer;
          answerBuffer = new char [ len ];
          // and again:
-         len = res_query( wxConvertWX2MB(domain.c_str()), C_IN, T_A,
+         len = res_query( domain.ToAscii(), C_IN, T_A,
                           (unsigned char *) answerBuffer, len );
       }
    }

Modified: trunk/M/src/util/ssl.cpp
===================================================================
--- trunk/M/src/util/ssl.cpp    2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/util/ssl.cpp    2007-08-28 13:50:13 UTC (rev 7350)
@@ -93,12 +93,12 @@
    SSL_DEF2(void, name, args, params, (void))
 
 #define SSL_LOOKUP(name) \
-      stub_##name = (name##_TYPE) gs_dllSll.GetSymbol(wxConvertMB2WX(#name)); \
+      stub_##name = (name##_TYPE) gs_dllSll.GetSymbol(#name); \
       if ( !stub_##name ) \
          goto error
 
 #define CRYPTO_LOOKUP(name) \
-      stub_##name = (name##_TYPE) 
gs_dllCrypto.GetSymbol(wxConvertMB2WX(#name)); \
+      stub_##name = (name##_TYPE) gs_dllCrypto.GetSymbol(#name); \
       if ( !stub_##name ) \
          goto error
 

Modified: trunk/M/src/util/strutil.cpp
===================================================================
--- trunk/M/src/util/strutil.cpp        2007-08-27 21:44:47 UTC (rev 7349)
+++ trunk/M/src/util/strutil.cpp        2007-08-28 13:50:13 UTC (rev 7350)
@@ -241,20 +241,6 @@
 #endif // HAVE_STRSEP/!HAVE_STRSEP
 }
 
-void
-strutil_tokenise(char *string, const char *delim, kbStringList &tlist)
-{
-   char *found;
-
-   for(;;)
-   {
-      found = strutil_strsep(&string, delim);
-      if(! found || ! *found)
-         break;
-      tlist.push_back(new String(wxConvertMB2WX(found)));
-   }
-}
-
 String
 strutil_extract_formatspec(const wxChar *format)
 {
@@ -460,7 +446,7 @@
                break;
          } while(entry);
          if(entry)
-            path << wxConvertMB2WX(entry->pw_dir);
+            path << wxSafeConvertMB2WX(entry->pw_dir);
          else
             path << DIR_SEPARATOR << _T("home") << DIR_SEPARATOR << user; // 
improvise!
          path << DIR_SEPARATOR
@@ -784,9 +770,9 @@
 {
    if ( setup_twofish() )
    {
-      CryptData input(wxConvertWX2MB(original));
+      CryptData input(original.utf8_str());
       CryptData output;
-      int rc = TwoFishCrypt(1, 128, wxConvertWX2MB(gs_GlobalPassword), &input 
,&output);
+      int rc = TwoFishCrypt(1, 128, gs_GlobalPassword.utf8_str(), &input 
,&output);
       if(rc)
       {
          String tmp = output.ToHex();
@@ -819,7 +805,7 @@
    CryptData input;
    input.FromHex(original.c_str()+1); // skip initial '-'
    CryptData output;
-   int rc = TwoFishCrypt(0, 128, wxConvertWX2MB(gs_GlobalPassword), 
&input,&output);
+   int rc = TwoFishCrypt(0, 128, gs_GlobalPassword.utf8_str(), &input,&output);
    if(rc)
    {
       return output.data;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to