OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/pickle.h" | 5 #include "base/pickle.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> // for max() | 9 #include <algorithm> // for max() |
10 | 10 |
11 //------------------------------------------------------------------------------ | 11 //------------------------------------------------------------------------------ |
12 | 12 |
| 13 using base::char16; |
| 14 using base::string16; |
| 15 |
13 // static | 16 // static |
14 const int Pickle::kPayloadUnit = 64; | 17 const int Pickle::kPayloadUnit = 64; |
15 | 18 |
16 static const size_t kCapacityReadOnly = static_cast<size_t>(-1); | 19 static const size_t kCapacityReadOnly = static_cast<size_t>(-1); |
17 | 20 |
18 PickleIterator::PickleIterator(const Pickle& pickle) | 21 PickleIterator::PickleIterator(const Pickle& pickle) |
19 : read_ptr_(pickle.payload()), | 22 : read_ptr_(pickle.payload()), |
20 read_end_ptr_(pickle.end_of_payload()) { | 23 read_end_ptr_(pickle.end_of_payload()) { |
21 } | 24 } |
22 | 25 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 if (new_size > capacity_after_header_) { | 328 if (new_size > capacity_after_header_) { |
326 Resize(std::max(capacity_after_header_ * 2, new_size)); | 329 Resize(std::max(capacity_after_header_ * 2, new_size)); |
327 } | 330 } |
328 | 331 |
329 char* write = mutable_payload() + write_offset_; | 332 char* write = mutable_payload() + write_offset_; |
330 memcpy(write, data, length); | 333 memcpy(write, data, length); |
331 memset(write + length, 0, data_len - length); | 334 memset(write + length, 0, data_len - length); |
332 header_->payload_size = static_cast<uint32>(write_offset_ + length); | 335 header_->payload_size = static_cast<uint32>(write_offset_ + length); |
333 write_offset_ = new_size; | 336 write_offset_ = new_size; |
334 } | 337 } |
OLD | NEW |