[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

paroga at webkit.org paroga at webkit.org
Wed Dec 22 16:38:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ab63ef67ec23ad56c36281291410763ace22e0b8
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 29 18:17:37 2010 +0000

    2010-11-29  Patrick Gansterer  <paroga at webkit.org>
    
            Reviewed by Adam Roben.
    
            [WINCE] Implement WebCore::directoryName
            https://bugs.webkit.org/show_bug.cgi?id=50031
    
            Also fix handling of paths without path separator.
    
            * platform/wince/FileSystemWinCE.cpp:
            (WebCore::reverseFindPathSeparator):
            (WebCore::makeAllDirectories):
            (WebCore::pathGetFileName):
            (WebCore::directoryName):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72809 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 991a09d..a6305dd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,21 @@
 
         Reviewed by Adam Roben.
 
+        [WINCE] Implement WebCore::directoryName
+        https://bugs.webkit.org/show_bug.cgi?id=50031
+
+        Also fix handling of paths without path separator.
+
+        * platform/wince/FileSystemWinCE.cpp:
+        (WebCore::reverseFindPathSeparator):
+        (WebCore::makeAllDirectories):
+        (WebCore::pathGetFileName):
+        (WebCore::directoryName):
+
+2010-11-29  Patrick Gansterer  <paroga at webkit.org>
+
+        Reviewed by Adam Roben.
+
         Simplify directoryName in FileSystemWin.cpp
         https://bugs.webkit.org/show_bug.cgi?id=50028
 
diff --git a/WebCore/platform/wince/FileSystemWinCE.cpp b/WebCore/platform/wince/FileSystemWinCE.cpp
index 90b278e..49acf12 100644
--- a/WebCore/platform/wince/FileSystemWinCE.cpp
+++ b/WebCore/platform/wince/FileSystemWinCE.cpp
@@ -33,13 +33,26 @@
 
 #include "NotImplemented.h"
 #include "PlatformString.h"
-#include <wtf/text/CString.h>
-
-#include <windows.h>
 #include <wincrypt.h>
+#include <windows.h>
+#include <wtf/text/CString.h>
 
 namespace WebCore {
 
+static size_t reverseFindPathSeparator(const String& path, unsigned start = UINT_MAX)
+{
+    size_t positionSlash = path.reverseFind('/', start);
+    size_t positionBackslash = path.reverseFind('\\', start);
+
+    if (positionSlash == notFound)
+        return positionBackslash;
+
+    if (positionBackslash == notFound)
+        return positionSlash;
+
+    return std::max(positionSlash, positionBackslash);
+}
+
 static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo)
 {
     String filename = path;
@@ -133,14 +146,14 @@ CString fileSystemRepresentation(const String&)
 
 bool makeAllDirectories(const String& path)
 {
-    int lastDivPos = std::max(path.reverseFind('/'), path.reverseFind('\\'));
-    int endPos = path.length();
-    if (lastDivPos == path.length() - 1) {
-        endPos -= 1;
-        lastDivPos = std::max(path.reverseFind('/', lastDivPos), path.reverseFind('\\', lastDivPos));
+    size_t lastDivPos = reverseFindPathSeparator(path);
+    unsigned endPos = path.length();
+    if (lastDivPos == endPos - 1) {
+        --endPos;
+        lastDivPos = reverseFindPathSeparator(path, lastDivPos);
     }
 
-    if (lastDivPos > 0) {
+    if (lastDivPos != notFound) {
         if (!makeAllDirectories(path.substring(0, lastDivPos)))
             return false;
     }
@@ -160,13 +173,18 @@ String homeDirectoryPath()
 
 String pathGetFileName(const String& path)
 {
-    return path.substring(std::max(path.reverseFind('/'), path.reverseFind('\\')) + 1);
+    size_t pos = reverseFindPathSeparator(path);
+    if (pos == notFound)
+        return path;
+    return path.substring(pos + 1);
 }
 
 String directoryName(const String& path)
 {
-    notImplemented();
-    return String();
+    size_t pos = reverseFindPathSeparator(path);
+    if (pos == notFound)
+        return String();
+    return path.left(pos);
 }
 
 CString openTemporaryFile(const char*, PlatformFileHandle& handle)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list