Title: [89177] trunk/Source/WebKit2
Revision
89177
Author
[email protected]
Date
2011-06-17 15:43:17 -0700 (Fri, 17 Jun 2011)

Log Message

2011-06-17  Anders Carlsson  <[email protected]>

        Reviewed by Sam Weinig.

        Remove unused ArgumentEncoder and ArgumentDecoder functions
        https://bugs.webkit.org/show_bug.cgi?id=62909

        * Platform/CoreIPC/ArgumentDecoder.cpp:
        * Platform/CoreIPC/ArgumentDecoder.h:
        * Platform/CoreIPC/ArgumentEncoder.cpp:
        * Platform/CoreIPC/ArgumentEncoder.h:
        
        * Shared/win/PlatformCertificateInfo.cpp:
        (WebKit::PlatformCertificateInfo::encode):
        (WebKit::PlatformCertificateInfo::decode):
        Replace calls to encodeBytes/decodeBytes with
        encodeVariableLengthByteArray/decodeVariableLengthByteArray.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (89176 => 89177)


--- trunk/Source/WebKit2/ChangeLog	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-17 22:43:17 UTC (rev 89177)
@@ -1,5 +1,23 @@
 2011-06-17  Anders Carlsson  <[email protected]>
 
+        Reviewed by Sam Weinig.
+
+        Remove unused ArgumentEncoder and ArgumentDecoder functions
+        https://bugs.webkit.org/show_bug.cgi?id=62909
+
+        * Platform/CoreIPC/ArgumentDecoder.cpp:
+        * Platform/CoreIPC/ArgumentDecoder.h:
+        * Platform/CoreIPC/ArgumentEncoder.cpp:
+        * Platform/CoreIPC/ArgumentEncoder.h:
+        
+        * Shared/win/PlatformCertificateInfo.cpp:
+        (WebKit::PlatformCertificateInfo::encode):
+        (WebKit::PlatformCertificateInfo::decode):
+        Replace calls to encodeBytes/decodeBytes with
+        encodeVariableLengthByteArray/decodeVariableLengthByteArray.
+
+2011-06-17  Anders Carlsson  <[email protected]>
+
         Yet another Qt build fix attempt.
 
         * UIProcess/API/qt/ClientImpl.cpp:

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp (89176 => 89177)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp	2011-06-17 22:43:17 UTC (rev 89177)
@@ -115,22 +115,6 @@
     return true;
 }
 
-bool ArgumentDecoder::decodeBytes(Vector<uint8_t>& buffer)
-{
-    uint64_t size;
-    if (!decodeUInt64(size))
-        return false;
-
-    if (!alignBufferPosition(1, size))
-        return false;
-
-    buffer.resize(size);
-    if (size > 0)
-        memcpy(&buffer[0], m_bufferPos, size);
-    m_bufferPos += size;
-    return true;
-}
-
 bool ArgumentDecoder::decodeVariableLengthByteArray(DataReference& dataReference)
 {
     uint64_t size;
@@ -147,25 +131,6 @@
     return true;
 }
 
-bool ArgumentDecoder::decodeBytes(uint8_t* buffer, size_t bufferSize)
-{
-    // FIXME: Decoding the size is not strictly necessary here since we know the size upfront.
-    uint64_t size;
-    if (!decodeUInt64(size))
-        return false;
-
-    ASSERT(size == bufferSize);
-    if (size != bufferSize)
-        return false;
-
-    if (!alignBufferPosition(1, size))
-        return false;
-
-    memcpy(buffer, m_bufferPos, size);
-    m_bufferPos += size;
-    return true;
-}
-
 bool ArgumentDecoder::decodeBool(bool& result)
 {
     if (!alignBufferPosition(sizeof(result), sizeof(result)))

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h (89176 => 89177)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h	2011-06-17 22:43:17 UTC (rev 89177)
@@ -52,9 +52,6 @@
     // The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object.
     bool decodeVariableLengthByteArray(DataReference&);
 
-    bool decodeBytes(Vector<uint8_t>&);
-    bool decodeBytes(uint8_t*, size_t);
-
     bool decodeBool(bool&);
     bool decodeUInt32(uint32_t&);
     bool decodeUInt64(uint64_t&);

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp (89176 => 89177)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2011-06-17 22:43:17 UTC (rev 89177)
@@ -102,16 +102,6 @@
     encodeFixedLengthData(dataReference.data(), dataReference.size(), 1);
 }
 
-void ArgumentEncoder::encodeBytes(const uint8_t* bytes, size_t size)
-{
-    // Encode the size.
-    encodeUInt64(static_cast<uint64_t>(size));
-    
-    uint8_t* buffer = grow(1, size);
-    
-    memcpy(buffer, bytes, size);
-}
-
 void ArgumentEncoder::encodeBool(bool n)
 {
     uint8_t* buffer = grow(sizeof(n), sizeof(n));

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h (89176 => 89177)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h	2011-06-17 22:43:17 UTC (rev 89177)
@@ -45,8 +45,6 @@
     void encodeFixedLengthData(const uint8_t*, size_t, unsigned alignment);
     void encodeVariableLengthByteArray(const DataReference&);
 
-    void encodeBytes(const uint8_t*, size_t);
-
     void encodeBool(bool);
     void encodeUInt32(uint32_t);
     void encodeUInt64(uint64_t);

Modified: trunk/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp (89176 => 89177)


--- trunk/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp	2011-06-17 22:18:10 UTC (rev 89176)
+++ trunk/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp	2011-06-17 22:43:17 UTC (rev 89177)
@@ -28,6 +28,7 @@
 
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
+#include "DataReference.h"
 #include <WebCore/ResourceResponse.h>
 
 #if USE(CG)
@@ -117,7 +118,7 @@
     encoder->encodeUInt64(length);
 
     for (size_t i = 0; i < length; ++i)
-        encoder->encodeBytes(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded);
+        encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded));
 }
 
 bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& c)
@@ -132,13 +133,13 @@
     }
 
     for (size_t i = 0; i < length; ++i) {
-        Vector<uint8_t> bytes;
-        if (!decoder->decodeBytes(bytes)) {
+        CoreIPC::DataReference dataReference;
+        if (!decoder->decodeVariableLengthByteArray(dataReference)) {
             c.clearCertificateChain();
             return false;
         }
 
-        PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, bytes.data(), bytes.size());
+        PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, dataReference.data(), dataReference.size());
         if (!certificateContext) {
             c.clearCertificateChain();
             return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to