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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 13:25:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit aea45966c011a267df948d93b794c654cf469d1c
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 15 01:23:17 2010 +0000

    2010-09-14  Patrick Gansterer  <paroga at paroga.com>
    
            Reviewed by Adam Roben.
    
            [WINCE] Use codePage instead of TextEncoding
            https://bugs.webkit.org/show_bug.cgi?id=45466
    
            Use codePage as member variable to avoid repeated lookup.
    
            * platform/text/wince/TextCodecWinCE.cpp:
            (WebCore::newTextCodecWinCE):
            (WebCore::TextCodecWinCE::TextCodecWinCE):
            (WebCore::decode):
            (WebCore::TextCodecWinCE::decode):
            (WebCore::TextCodecWinCE::encode):
            * platform/text/wince/TextCodecWinCE.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67523 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fc48901..f5d3de0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-14  Patrick Gansterer  <paroga at paroga.com>
+
+        Reviewed by Adam Roben.
+
+        [WINCE] Use codePage instead of TextEncoding
+        https://bugs.webkit.org/show_bug.cgi?id=45466
+
+        Use codePage as member variable to avoid repeated lookup.
+
+        * platform/text/wince/TextCodecWinCE.cpp:
+        (WebCore::newTextCodecWinCE):
+        (WebCore::TextCodecWinCE::TextCodecWinCE):
+        (WebCore::decode):
+        (WebCore::TextCodecWinCE::decode):
+        (WebCore::TextCodecWinCE::encode):
+        * platform/text/wince/TextCodecWinCE.h:
+
 2010-09-14  Adam Barth  <abarth at webkit.org>
 
         Attempted Chromium build fix.  The compiler can't tell that
diff --git a/WebCore/platform/text/wince/TextCodecWinCE.cpp b/WebCore/platform/text/wince/TextCodecWinCE.cpp
index 2789148..8e5711d 100644
--- a/WebCore/platform/text/wince/TextCodecWinCE.cpp
+++ b/WebCore/platform/text/wince/TextCodecWinCE.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007-2009 Torch Mobile, Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga at paroga.com>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -132,11 +133,11 @@ static UINT getCodePage(const char* name)
 
 static PassOwnPtr<TextCodec> newTextCodecWinCE(const TextEncoding& encoding, const void*)
 {
-    return new TextCodecWinCE(encoding);
+    return new TextCodecWinCE(getCodePage(encoding.name()));
 }
 
-TextCodecWinCE::TextCodecWinCE(const TextEncoding& encoding)
-    : m_encoding(encoding)
+TextCodecWinCE::TextCodecWinCE(UINT codePage)
+    : m_codePage(codePage)
 {
 }
 
@@ -211,22 +212,12 @@ static inline const char* findFirstNonAsciiCharacter(const char* bytes, size_t l
     return bytes;
 }
 
-static void decode(Vector<UChar, 8192>& result, const char* encodingName, const char* bytes, size_t length, size_t* left, bool canBeFirstTime, bool& sawInvalidChar)
+static void decode(Vector<UChar, 8192>& result, UINT codePage, const char* bytes, size_t length, size_t* left, bool canBeFirstTime, bool& sawInvalidChar)
 {
     *left = length;
     if (!bytes || !length)
         return;
 
-    UINT codePage;
-
-    HashMap<String, CharsetInfo>::iterator i = knownCharsets().find(encodingName);
-    if (i == knownCharsets().end()) {
-        if (!strcmp(encodingName, "UTF-8"))
-            codePage = CP_UTF8;
-        else
-            codePage = CP_ACP;
-    }
-
     DWORD flags = getCodePageFlags(codePage);
 
     if (codePage == CP_UTF8) {
@@ -331,7 +322,7 @@ String TextCodecWinCE::decode(const char* bytes, size_t length, bool flush, bool
     Vector<UChar, 8192> result;
     for (;;) {
         bool sawInvalidChar = false;
-        WebCore::decode(result, m_encoding.name(), bytes, length, &left, m_decodeBuffer.isEmpty(), sawInvalidChar);
+        WebCore::decode(result, m_codePage, bytes, length, &left, m_decodeBuffer.isEmpty(), sawInvalidChar);
         if (!left)
             break;
 
@@ -367,10 +358,9 @@ CString TextCodecWinCE::encode(const UChar* characters, size_t length, Unencodab
     if (!characters || !length)
         return CString();
 
-    UINT codePage = getCodePage(m_encoding.name());
-    DWORD flags = codePage == CP_UTF8 ? 0 : WC_COMPOSITECHECK;
+    DWORD flags = m_codePage == CP_UTF8 ? 0 : WC_COMPOSITECHECK;
 
-    int resultLength = WideCharToMultiByte(codePage, flags, characters, length, 0, 0, 0, 0);
+    int resultLength = WideCharToMultiByte(m_codePage, flags, characters, length, 0, 0, 0, 0);
 
     // FIXME: We need to implement UnencodableHandling: QuestionMarksForUnencodables, EntitiesForUnencodables, and URLEncodedEntitiesForUnencodables.
 
@@ -379,7 +369,7 @@ CString TextCodecWinCE::encode(const UChar* characters, size_t length, Unencodab
 
     Vector<char> result(resultLength);
 
-    WideCharToMultiByte(codePage, flags, characters, length, result.data(), resultLength, 0, 0);
+    WideCharToMultiByte(m_codePage, flags, characters, length, result.data(), resultLength, 0, 0);
 
     return CString(result.data(), result.size());
 }
diff --git a/WebCore/platform/text/wince/TextCodecWinCE.h b/WebCore/platform/text/wince/TextCodecWinCE.h
index a870d3e..8d332a6 100644
--- a/WebCore/platform/text/wince/TextCodecWinCE.h
+++ b/WebCore/platform/text/wince/TextCodecWinCE.h
@@ -2,6 +2,7 @@
  * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov <ap at nypop.com>
  * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Patrick Gansterer <paroga at paroga.com>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +33,7 @@
 #include "TextCodec.h"
 #include "TextEncoding.h"
 #include <wtf/Vector.h>
+#include <windows.h>
 
 namespace WebCore {
 
@@ -43,7 +45,7 @@ public:
     static void registerExtendedEncodingNames(EncodingNameRegistrar);
     static void registerExtendedCodecs(TextCodecRegistrar);
 
-    TextCodecWinCE(const TextEncoding&);
+    TextCodecWinCE(UINT codePage);
     virtual ~TextCodecWinCE();
 
     virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
@@ -62,7 +64,7 @@ public:
     static void enumerateSupportedEncodings(EncodingReceiver& receiver);
 
 private:
-    TextEncoding m_encoding;
+    UINT m_codePage;
     Vector<char> m_decodeBuffer;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list