[haiku-commits] haiku: hrev53443 - src/apps/mail

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 31 Aug 2019 23:02:27 -0400 (EDT)

hrev53443 adds 1 changeset to branch 'master'
old head: 58a582ff22126e500b8fa44d822c5365d0f69da7
new head: 29536b4c4bd17a3c6ff325f3ba09812765b074bc
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=29536b4c4bd1+%5E58a582ff2212

----------------------------------------------------------------------------

29536b4c4bd1: Mail: Don't use strtok.
  
  That seems like a bad idea...

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53443
Commit:      29536b4c4bd17a3c6ff325f3ba09812765b074bc
URL:         https://git.haiku-os.org/haiku/commit/?id=29536b4c4bd1
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep  1 03:01:51 2019 UTC

----------------------------------------------------------------------------

1 file changed, 4 insertions(+), 4 deletions(-)
src/apps/mail/MailWindow.cpp | 8 ++++----

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index 3a72957839..d3ea359a77 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -2952,14 +2952,14 @@ TMailWindow::OpenMessage(const entry_ref* ref, uint32 
characterSetForDecoding)
                        BMessage msg(REFS_RECEIVED);
                        entry_ref enc_ref;
 
-                       char* s = strtok((char*)string.String(), ":");
-                       while (s != NULL) {
-                               BEntry entry(s, true);
+                       BStringList list;
+                       string.Split(":", false, list);
+                       for (int32 i = 0; i < list.CountStrings(); i++) {
+                               BEntry entry(list.StringAt(i), true);
                                if (entry.Exists()) {
                                        entry.GetRef(&enc_ref);
                                        msg.AddRef("refs", &enc_ref);
                                }
-                               s = strtok(NULL, ":");
                        }
                        AddEnclosure(&msg);
                }


Other related posts: