[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Konversation] bc4cbdd: Added patch by Gary Cramblitt (aka
From:       Christian Muehlhaeuser <chris () chris ! de>
Date:       2010-07-01 13:27:14
Message-ID: 20100701132714.44C36BB5558 () projects ! kde ! org
[Download RAW message or body]

commit bc4cbddb06e2a7a9214e6393ffd87d457ae5dda8
Author: Christian Muehlhaeuser <chris@chris.de>
Date:   Mon Jan 5 03:14:47 2004 +0000

    Added patch by Gary Cramblitt (aka PhantomsDad), which fixes an inefficient
    while loop in the highlighting/capturing code of IRCView::filter. Works out
    nicely, here -> commited. Thanks to PhantomsDad
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=276876

diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp
index 6a9cdbc..0d8352e 100644
--- a/konversation/ircview.cpp
+++ b/konversation/ircview.cpp
@@ -281,9 +281,7 @@ QString IRCView::filter(const QString& line,const QString& \
whoSent,bool doHiligh  emailPattern.setCaseSensitive(false);
 
   pos=0;
-  while(static_cast<unsigned int>(pos) < filteredLine.length())
-  {
-    if(pattern.search(filteredLine,pos)!=-1) {
+  while(pattern.search(filteredLine,pos)!=-1) {
       // Remember where we found the url
       pos=pattern.pos();
 
@@ -310,7 +308,10 @@ QString IRCView::filter(const QString& line,const QString& \
whoSent,bool doHiligh  
       KonversationApplication *konvApp=static_cast<KonversationApplication \
*>(KApplication::kApplication());  konvApp->storeUrl(whoSent,url);
-    } else if(emailPattern.search(filteredLine,pos)!=-1) {
+  }
+
+  pos = 0;
+  while (emailPattern.search(filteredLine,pos)!=-1) {
       // Remember where we found the url
       pos=emailPattern.pos();
       // Extract url
@@ -327,9 +328,6 @@ QString IRCView::filter(const QString& line,const QString& \
whoSent,bool doHiligh  filteredLine.replace(pos,url.length(),link);
       // next search begins right after the link
       pos+=link.length();
-    } else {
-      pos++;
-    }
   }
 
   // Hilight


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic