[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 15:23:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 48c6f86f0615e8ad6e6545091a7084f3ce25aa10
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 19:07:32 2010 +0000

    2010-11-02  Patrick Gansterer  <paroga at webkit.org>
    
            Reviewed by Adam Roben.
    
            Cleanup createGlobalImageFileDescriptor in ClipboardWin
            https://bugs.webkit.org/show_bug.cgi?id=48189
    
            * platform/win/ClipboardWin.cpp:
            (WebCore::ClipboardWin::writeURL):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71145 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a1656cc..8cc8d64 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-02  Patrick Gansterer  <paroga at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Cleanup createGlobalImageFileDescriptor in ClipboardWin
+        https://bugs.webkit.org/show_bug.cgi?id=48189
+
+        * platform/win/ClipboardWin.cpp:
+        (WebCore::ClipboardWin::writeURL):
+
 2010-11-02  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp
index f467d65..4906790 100644
--- a/WebCore/platform/win/ClipboardWin.cpp
+++ b/WebCore/platform/win/ClipboardWin.cpp
@@ -56,7 +56,7 @@
 #include <wininet.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/CString.h>
-#include <wtf/text/StringConcatenate.h> 
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/text/StringHash.h>
 
 using namespace std;
@@ -161,25 +161,6 @@ static String filesystemPathFromUrlOrTitle(const String& url, const String& titl
     return result;
 }
 
-static HGLOBAL createGlobalURLContent(const CString& content)
-{
-    HRESULT hr = S_OK;
-    HGLOBAL memObj = 0;
-
-    char* fileContents;
-
-    memObj = GlobalAlloc(GPTR, content.length());
-    if (!memObj) 
-        return 0;
-
-    fileContents = (PSTR)GlobalLock(memObj);
-    CopyMemory(fileContents, content.data(), content.length());
-    
-    GlobalUnlock(memObj);
-    
-    return memObj;
-}
-
 static HGLOBAL createGlobalImageFileContent(SharedBuffer* data)
 {
     HGLOBAL memObj = GlobalAlloc(GPTR, data->size());
@@ -258,36 +239,6 @@ static HGLOBAL createGlobalHDropContent(const KURL& url, String& fileName, Share
     return memObj;
 }
 
-static HGLOBAL createGlobalUrlFileDescriptor(const String& url, const String& title, const CString& content)
-{
-    HRESULT hr = S_OK;
-    HGLOBAL memObj = 0;
-    String fsPath;
-    memObj = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
-    if (!memObj)
-        return 0;
-
-    FILEGROUPDESCRIPTOR* fgd = (FILEGROUPDESCRIPTOR*)GlobalLock(memObj);
-    memset(fgd, 0, sizeof(FILEGROUPDESCRIPTOR));
-    fgd->cItems = 1;
-    fgd->fgd[0].dwFlags = FD_FILESIZE;
-    fgd->fgd[0].nFileSizeLow = content.length();
-    fsPath = filesystemPathFromUrlOrTitle(url, title, L".URL", true);
-
-    if (fsPath.length() <= 0) {
-        GlobalUnlock(memObj);
-        GlobalFree(memObj);
-        return 0;
-    }
-
-    int maxSize = min(fsPath.length(), ARRAYSIZE(fgd->fgd[0].cFileName));
-    CopyMemory(fgd->fgd[0].cFileName, (LPCWSTR)fsPath.characters(), maxSize * sizeof(UChar));
-    GlobalUnlock(memObj);
-    
-    return memObj;
-}
-
-
 static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String& title, CachedImage* image)
 {
     ASSERT_ARG(image, image);
@@ -725,16 +676,36 @@ void ClipboardWin::writeURL(const KURL& kurl, const String& titleStr, Frame*)
     String url = kurl.string();
     ASSERT(url.containsOnlyASCII()); // KURL::string() is URL encoded.
 
+    String fsPath = filesystemPathFromUrlOrTitle(url, titleStr, L".URL", true);
     CString content = makeString("[InternetShortcut]\r\nURL=", url, "\r\n").ascii();
 
-    HGLOBAL urlFileDescriptor = createGlobalUrlFileDescriptor(url, titleStr, content);
+    if (fsPath.length() <= 0)
+        return;
+
+    HGLOBAL urlFileDescriptor = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
     if (!urlFileDescriptor)
         return;
-    HGLOBAL urlFileContent = createGlobalURLContent(content);
+
+    HGLOBAL urlFileContent = GlobalAlloc(GPTR, content.length());
     if (!urlFileContent) {
         GlobalFree(urlFileDescriptor);
         return;
     }
+
+    FILEGROUPDESCRIPTOR* fgd = static_cast<FILEGROUPDESCRIPTOR*>(GlobalLock(urlFileDescriptor));
+    ZeroMemory(fgd, sizeof(FILEGROUPDESCRIPTOR));
+    fgd->cItems = 1;
+    fgd->fgd[0].dwFlags = FD_FILESIZE;
+    fgd->fgd[0].nFileSizeLow = content.length();
+
+    unsigned maxSize = min(fsPath.length(), ARRAYSIZE(fgd->fgd[0].cFileName));
+    CopyMemory(fgd->fgd[0].cFileName, fsPath.characters(), maxSize * sizeof(UChar));
+    GlobalUnlock(urlFileDescriptor);
+
+    char* fileContents = static_cast<char*>(GlobalLock(urlFileContent));
+    CopyMemory(fileContents, content.data(), content.length());
+    GlobalUnlock(urlFileContent);
+
     writeFileToDataObject(m_writableDataObject.get(), urlFileDescriptor, urlFileContent, 0);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list