SF.net SVN: mahogany: [7216] trunk/M/src

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7216
          http://svn.sourceforge.net/mahogany/?rev=7216&view=rev
Author:   vadz
Date:     2007-03-21 17:18:07 -0700 (Wed, 21 Mar 2007)

Log Message:
-----------
Compilation fixes for the latest wx HEAD:

1. const_cast<char *>(s.c_str()) doesn't work any longer, and neither does
   the C style (char *) cast but still convert the former to the latter
   because it might be made to work while for the former it's hopeless and
   also because we C style casts much more often so at least it's more
   consistent now
2. use wxIsEmpty() instead of deprecated IsEmpty()
3. wxString::iterator is not convertible to const wxChar * any more
4. pointer arithmetic with c_str() doesn't really work any longer

[NB: it still doesn't compile but might start if I change wx as proposed]

Modified Paths:
--------------
    trunk/M/src/Python/PythonHelp.cpp
    trunk/M/src/classes/MessageTemplate.cpp
    trunk/M/src/classes/MessageView.cpp
    trunk/M/src/classes/Sequence.cpp
    trunk/M/src/gui/AddressExpander.cpp
    trunk/M/src/gui/wxMDialogs.cpp
    trunk/M/src/gui/wxMenuDefs.cpp
    trunk/M/src/mail/MailFolderCC.cpp
    trunk/M/src/mail/Pop3.cpp
    trunk/M/src/mail/SendMessageCC.cpp
    trunk/M/src/modules/TextViewer.cpp
    trunk/M/src/modules/viewflt/QuoteURL.cpp
    trunk/M/src/util/strutil.cpp
    trunk/M/src/wx/generic/persctrl.cpp

Modified: trunk/M/src/Python/PythonHelp.cpp
===================================================================
--- trunk/M/src/Python/PythonHelp.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/Python/PythonHelp.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -181,8 +181,7 @@
    }
    //else: if reloading failed, fall back to the original module
 
-   *function = PyObject_GetAttrString(*module,
-                     const_cast<char *>(functionName.c_str()));
+   *function = PyObject_GetAttrString(*module, (char *)functionName.c_str());
    if ( !*function )
    {
       Py_XDECREF(*module);

Modified: trunk/M/src/classes/MessageTemplate.cpp
===================================================================
--- trunk/M/src/classes/MessageTemplate.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/classes/MessageTemplate.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -404,7 +404,7 @@
                }
                else if ( (len > alignWidth) && truncate )
                {
-                  *value = value->c_str() + len - alignWidth;
+                  *value = value->c_str() + (len - alignWidth);
                }
                //else: value is already wide enough, but we don't truncate it
                break;

Modified: trunk/M/src/classes/MessageView.cpp
===================================================================
--- trunk/M/src/classes/MessageView.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/classes/MessageView.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -3652,7 +3652,7 @@
 
    // trim trailing empty lines, it is annoying to have to delete them manually
    // when replying
-   const wxChar *p = m_textBody.end() - 1;
+   wxString::const_iterator p = m_textBody.end() - 1;
    while ( *p == _T('\r') || *p == _T('\n') )
       p--;
 

Modified: trunk/M/src/classes/Sequence.cpp
===================================================================
--- trunk/M/src/classes/Sequence.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/classes/Sequence.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -231,7 +231,7 @@
 
 UIdType Sequence::GetNext(UIdType n, size_t& cookie) const
 {
-   switch ( m_seq[cookie] )
+   switch ( (wxChar)m_seq[cookie] )
    {
       case ':':
          // we're inside a range, check if we didn't exhaust it

Modified: trunk/M/src/gui/AddressExpander.cpp
===================================================================
--- trunk/M/src/gui/AddressExpander.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/gui/AddressExpander.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -72,7 +72,7 @@
    bool quoted = false;
    for ( size_t n = 0; n < len; n++ )
    {
-      switch ( text[n] )
+      switch ( (wxChar)text[n] )
       {
          case '\\':
             // skip the next character, even if it's a quote or separator

Modified: trunk/M/src/gui/wxMDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMDialogs.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/gui/wxMDialogs.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -632,7 +632,8 @@
       configPath = GetPersMsgBoxName(persMsg);
 
    return MDialog_Message(message, parent, title,
-                          persMsg ? configPath.c_str() : NULL, flags);
+                          persMsg ? configPath.c_str()
+                                  : (wxChar *)NULL, flags);
 }
 
 MDlgResult MDialog_YesNoCancel(wxChar const *message,

Modified: trunk/M/src/gui/wxMenuDefs.cpp
===================================================================
--- trunk/M/src/gui/wxMenuDefs.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/gui/wxMenuDefs.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -658,7 +658,7 @@
    for ( int n = nFirst; n <= nLast; n++ ) {
 #ifdef DEBUG
       const wxChar *label = wxGetTranslation(GetMenuItem(n).label);
-      if ( !IsEmpty(wxConvertWX2MB(label)) ) {
+      if ( !wxIsEmpty(wxConvertWX2MB(label)) ) {
          const wxChar *p = wxStrchr(label, '&');
          if ( p == NULL ) {
             wxLogWarning(_T("Menu label '%s' doesn't have keyboard accelerator."),

Modified: trunk/M/src/mail/MailFolderCC.cpp
===================================================================
--- trunk/M/src/mail/MailFolderCC.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/mail/MailFolderCC.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -5436,10 +5436,9 @@
    (
       m_MailStream,
       NULL,
-      const_cast<char *>(
-         (spec + reference + (pattern.empty() ? String(_T("*")) : pattern))
-            .c_str()
-      )
+      (char *)
+      (spec + reference + (pattern.empty() ? String(_T("*"))
+                                           : pattern)).c_str()
    );
 
    // send event telling about end of listing:

Modified: trunk/M/src/mail/Pop3.cpp
===================================================================
--- trunk/M/src/mail/Pop3.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/mail/Pop3.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -148,8 +148,7 @@
    {
       int flags;
       bool ok = wxSscanf(file[n], _T("%s %d"),
-                       uidl.GetWriteBuf(file[n].length()), &flags) == 2;
-      uidl.UngetWriteBuf();
+                       wxStringBuffer(uidl, file[n].length()), &flags) == 2;
 
       if ( !ok )
       {

Modified: trunk/M/src/mail/SendMessageCC.cpp
===================================================================
--- trunk/M/src/mail/SendMessageCC.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/mail/SendMessageCC.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -748,7 +748,7 @@
       // only encode the strings which contain the characters unallowed in RFC
       // 822 headers
       const unsigned char *p;
-      for ( p = (unsigned char *)header.c_str(); *p; p++ )
+      for ( p = (const unsigned char *)header.c_str(); *p; p++ )
       {
          if ( NeedsEncodingInHeader(*p) )
             break;

Modified: trunk/M/src/modules/TextViewer.cpp
===================================================================
--- trunk/M/src/modules/TextViewer.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/modules/TextViewer.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -292,7 +292,7 @@
       }
 #endif // 0
 
-      switch ( ch[0u] )
+      switch ( (wxChar)ch[0u] )
       {
          case '<':
             s += _T("&lt;");

Modified: trunk/M/src/modules/viewflt/QuoteURL.cpp
===================================================================
--- trunk/M/src/modules/viewflt/QuoteURL.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/modules/viewflt/QuoteURL.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -329,7 +329,8 @@
       }
 
       // finally insert everything after the last URL (if any)
-      String textAfter(endURL, lineNext ? lineNext + 1 : text.end());
+      String textAfter(endURL, lineNext ? lineNext + 1
+                                        : text.c_str() + text.length());
       m_next->Process(textAfter, viewer, style);
 
       if ( !lineNext )

Modified: trunk/M/src/util/strutil.cpp
===================================================================
--- trunk/M/src/util/strutil.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/util/strutil.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -159,7 +159,7 @@
    String s = wxEmptyString;
    const wxChar *cptr = str.c_str();
    while(*cptr)
-      s += toupper(*cptr++);
+      s += (wxChar)toupper(*cptr++);
    str = s;
 }
 
@@ -169,7 +169,7 @@
    String s = wxEmptyString;
    const wxChar *cptr = str.c_str();
    while(*cptr)
-      s += tolower(*cptr++);
+      s += (wxChar)tolower(*cptr++);
    str = s;
 }
 

Modified: trunk/M/src/wx/generic/persctrl.cpp
===================================================================
--- trunk/M/src/wx/generic/persctrl.cpp	2007-03-22 00:14:40 UTC (rev 7215)
+++ trunk/M/src/wx/generic/persctrl.cpp	2007-03-22 00:18:07 UTC (rev 7216)
@@ -842,7 +842,7 @@
             char *p = (char *)str.c_str();
             for ( int col = 0; col < countCol; col++ )
             {
-                if ( IsEmpty(p) )
+                if ( wxIsEmpty(p) )
                     break;
 
                 char *end = strchr(p, ':');


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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.