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

List:       kde-core-devel
Subject:    Re: KURL problem
From:       Andras Mantia <amantia () kde ! org>
Date:       2005-09-27 10:28:19
Message-ID: 200509271328.20262.amantia () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On Tuesday 20 September 2005 14:02, Michael Brade wrote:
> What do you suggest? Can we please fix KURL? If adjustPath() removes
> *one* slash, then cleanPath() should get rid of all of them but one.
> Or neither of them should change the url.

Isn't the attached patch a solution (adjustPath(-1) removes all trailing 
slashes)?. Hopefully it doesn't break existing applications (it 
shouldn't). And it fixes the crash.

Andras
-- 
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org

["kurl.cpp.diff" (text/x-diff)]

--- kurl.cpp.orig	2005-07-06 19:08:00.000000000 +0300
+++ kurl.cpp	2005-09-27 12:46:38.000000000 +0300
@@ -1273,8 +1273,11 @@
     if ( result == "/" )
       return result;
     int len = result.length();
-    if ( (len != 0) && (result[ len - 1 ] == '/') )
-      result.truncate( len - 1 );
+    while (len > 1 && result[ len - 1 ] == '/')
+    {
+      len--;
+    }
+    result.truncate( len );
     return result;
   }
   else {

[Attachment #6 (application/pgp-signature)]

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

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