Changeset 89177 in webkit


Ignore:
Timestamp:
Jun 17, 2011 3:43:17 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-06-17 Anders Carlsson <andersca@apple.com>

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.
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r89170 r89177  
     12011-06-17  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Remove unused ArgumentEncoder and ArgumentDecoder functions
     6        https://bugs.webkit.org/show_bug.cgi?id=62909
     7
     8        * Platform/CoreIPC/ArgumentDecoder.cpp:
     9        * Platform/CoreIPC/ArgumentDecoder.h:
     10        * Platform/CoreIPC/ArgumentEncoder.cpp:
     11        * Platform/CoreIPC/ArgumentEncoder.h:
     12       
     13        * Shared/win/PlatformCertificateInfo.cpp:
     14        (WebKit::PlatformCertificateInfo::encode):
     15        (WebKit::PlatformCertificateInfo::decode):
     16        Replace calls to encodeBytes/decodeBytes with
     17        encodeVariableLengthByteArray/decodeVariableLengthByteArray.
     18
    1192011-06-17  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp

    r88886 r89177  
    116116}
    117117
    118 bool ArgumentDecoder::decodeBytes(Vector<uint8_t>& buffer)
     118bool ArgumentDecoder::decodeVariableLengthByteArray(DataReference& dataReference)
    119119{
    120120    uint64_t size;
    121121    if (!decodeUInt64(size))
    122122        return false;
    123 
    124     if (!alignBufferPosition(1, size))
    125         return false;
    126 
    127     buffer.resize(size);
    128     if (size > 0)
    129         memcpy(&buffer[0], m_bufferPos, size);
    130     m_bufferPos += size;
    131     return true;
    132 }
    133 
    134 bool ArgumentDecoder::decodeVariableLengthByteArray(DataReference& dataReference)
    135 {
    136     uint64_t size;
    137     if (!decodeUInt64(size))
    138         return false;
    139123   
    140124    if (!alignBufferPosition(1, size))
     
    145129
    146130    dataReference = DataReference(data, size);
    147     return true;
    148 }
    149 
    150 bool ArgumentDecoder::decodeBytes(uint8_t* buffer, size_t bufferSize)
    151 {
    152     // FIXME: Decoding the size is not strictly necessary here since we know the size upfront.
    153     uint64_t size;
    154     if (!decodeUInt64(size))
    155         return false;
    156 
    157     ASSERT(size == bufferSize);
    158     if (size != bufferSize)
    159         return false;
    160 
    161     if (!alignBufferPosition(1, size))
    162         return false;
    163 
    164     memcpy(buffer, m_bufferPos, size);
    165     m_bufferPos += size;
    166131    return true;
    167132}
  • trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h

    r88869 r89177  
    5252    // The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object.
    5353    bool decodeVariableLengthByteArray(DataReference&);
    54 
    55     bool decodeBytes(Vector<uint8_t>&);
    56     bool decodeBytes(uint8_t*, size_t);
    5754
    5855    bool decodeBool(bool&);
  • trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp

    r88869 r89177  
    103103}
    104104
    105 void ArgumentEncoder::encodeBytes(const uint8_t* bytes, size_t size)
    106 {
    107     // Encode the size.
    108     encodeUInt64(static_cast<uint64_t>(size));
    109    
    110     uint8_t* buffer = grow(1, size);
    111    
    112     memcpy(buffer, bytes, size);
    113 }
    114 
    115105void ArgumentEncoder::encodeBool(bool n)
    116106{
  • trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h

    r88869 r89177  
    4545    void encodeFixedLengthData(const uint8_t*, size_t, unsigned alignment);
    4646    void encodeVariableLengthByteArray(const DataReference&);
    47 
    48     void encodeBytes(const uint8_t*, size_t);
    4947
    5048    void encodeBool(bool);
  • trunk/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp

    r84101 r89177  
    2929#include "ArgumentDecoder.h"
    3030#include "ArgumentEncoder.h"
     31#include "DataReference.h"
    3132#include <WebCore/ResourceResponse.h>
    3233
     
    118119
    119120    for (size_t i = 0; i < length; ++i)
    120         encoder->encodeBytes(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded);
     121        encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded));
    121122}
    122123
     
    133134
    134135    for (size_t i = 0; i < length; ++i) {
    135         Vector<uint8_t> bytes;
    136         if (!decoder->decodeBytes(bytes)) {
     136        CoreIPC::DataReference dataReference;
     137        if (!decoder->decodeVariableLengthByteArray(dataReference)) {
    137138            c.clearCertificateChain();
    138139            return false;
    139140        }
    140141
    141         PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, bytes.data(), bytes.size());
     142        PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, dataReference.data(), dataReference.size());
    142143        if (!certificateContext) {
    143144            c.clearCertificateChain();
Note: See TracChangeset for help on using the changeset viewer.