OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/crypto/cert_compressor.h" | 5 #include "net/quic/crypto/cert_compressor.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
10 #include "third_party/zlib/zlib.h" | 10 #include "third_party/zlib/zlib.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 entries_size++; // for end marker | 253 entries_size++; // for end marker |
254 | 254 |
255 return entries_size; | 255 return entries_size; |
256 } | 256 } |
257 | 257 |
258 // SerializeCertEntries serialises |entries| to |out|, which must have enough | 258 // SerializeCertEntries serialises |entries| to |out|, which must have enough |
259 // space to contain them. | 259 // space to contain them. |
260 void SerializeCertEntries(uint8* out, const vector<CertEntry>& entries) { | 260 void SerializeCertEntries(uint8* out, const vector<CertEntry>& entries) { |
261 for (vector<CertEntry>::const_iterator i = entries.begin(); | 261 for (vector<CertEntry>::const_iterator i = entries.begin(); |
262 i != entries.end(); ++i) { | 262 i != entries.end(); ++i) { |
263 *out++ = i->type; | 263 *out++ = static_cast<uint8>(i->type); |
264 switch (i->type) { | 264 switch (i->type) { |
265 case CertEntry::COMPRESSED: | 265 case CertEntry::COMPRESSED: |
266 break; | 266 break; |
267 case CertEntry::CACHED: | 267 case CertEntry::CACHED: |
268 memcpy(out, &i->hash, sizeof(i->hash)); | 268 memcpy(out, &i->hash, sizeof(i->hash)); |
269 out += sizeof(uint64); | 269 out += sizeof(uint64); |
270 break; | 270 break; |
271 case CertEntry::COMMON: | 271 case CertEntry::COMMON: |
272 // Assumes a little-endian machine. | 272 // Assumes a little-endian machine. |
273 memcpy(out, &i->set_hash, sizeof(i->set_hash)); | 273 memcpy(out, &i->set_hash, sizeof(i->set_hash)); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 | 638 |
639 if (!uncompressed.empty()) { | 639 if (!uncompressed.empty()) { |
640 return false; | 640 return false; |
641 } | 641 } |
642 | 642 |
643 return true; | 643 return true; |
644 } | 644 } |
645 | 645 |
646 } // namespace net | 646 } // namespace net |
OLD | NEW |