SF.net SVN: mahogany: [7264] trunk/M/src/adb/AdbManager.cpp

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7264
          http://svn.sourceforge.net/mahogany/?rev=7264&view=rev
Author:   vadz
Date:     2007-05-02 06:56:07 -0700 (Wed, 02 May 2007)

Log Message:
-----------
fix assert in AdbExpandSingleAddress() mailto handling

Modified Paths:
--------------
    trunk/M/src/adb/AdbManager.cpp

Modified: trunk/M/src/adb/AdbManager.cpp
===================================================================
--- trunk/M/src/adb/AdbManager.cpp	2007-05-02 00:57:43 UTC (rev 7263)
+++ trunk/M/src/adb/AdbManager.cpp	2007-05-02 13:56:07 UTC (rev 7264)
@@ -411,42 +411,48 @@
       // this is a non-standard but custom extension: mailto URLs can have
       // extra parameters introduced by '?' and separated by '&'
       const size_t posQuestion  = newText.find('?');
-      for ( size_t posParamStart = posQuestion; posParamStart != String::npos; )
+      if ( posQuestion != String::npos )
       {
-         posParamStart++;
-         size_t posEq = newText.find('=', posParamStart);
-         if ( posEq != String::npos )
-         {
-            size_t posParamEnd = newText.find('&', posEq);
+        size_t posParamStart = posQuestion;
+        do
+        {
+           posParamStart++;
+           size_t posEq = newText.find('=', posParamStart);
+           if ( posEq != String::npos )
+           {
+              size_t posParamEnd = newText.find('&', posEq);
 
-            const String param(newText, posParamStart, posEq - posParamStart),
-                         value(newText, posEq + 1,
-                               posParamEnd == String::npos
-                                 ? posParamEnd
-                                 : posParamEnd - posEq - 1);
-;
-            if ( wxStricmp(param, "subject") == 0 )
-            {
-               *subject = value;
-            }
-            else
-            {
-               // at least cc, bcc and body are also possible
-               wxLogDebug("Ignoring unknown mailto: URL parameter %s=\"%s\"",
-                          param.c_str(), value.c_str());
-            }
+              const String param(newText, posParamStart, posEq - posParamStart),
+                           value(newText, posEq + 1,
+                                 posParamEnd == String::npos
+                                   ? posParamEnd
+                                   : posParamEnd - posEq - 1);
+  ;
+              if ( wxStricmp(param, "subject") == 0 )
+              {
+                 *subject = value;
+              }
+              else
+              {
+                 // at least cc, bcc and body are also possible but we don't
+                 // handle them now
+                 wxLogDebug("Ignoring unknown mailto: URL parameter %s=\"%s\"",
+                            param.c_str(), value.c_str());
+              }
 
-            posParamStart = posParamEnd;
-         }
-         else // unknown parameter
-         {
-            wxLogDebug("Ignoring unknown mailto: URL parameter without value");
+              posParamStart = posParamEnd;
+           }
+           else // unknown parameter
+           {
+              wxLogDebug("Ignoring unknown mailto: URL parameter without value");
 
-            posParamStart = newText.find('&', posParamStart);
-         }
+              posParamStart = newText.find('&', posParamStart);
+           }
+        }
+        while ( posParamStart != String::npos );
+
+        newText.erase(posQuestion, String::npos);
       }
-
-      newText.erase(posQuestion, String::npos);
    }
 
    *address = newText;


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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
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.