| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/big_endian.h" | 5 #include "base/big_endian.h" |
| 6 | 6 |
| 7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool BigEndianReader::ReadU16(uint16* value) { | 50 bool BigEndianReader::ReadU16(uint16* value) { |
| 51 return Read(value); | 51 return Read(value); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool BigEndianReader::ReadU32(uint32* value) { | 54 bool BigEndianReader::ReadU32(uint32* value) { |
| 55 return Read(value); | 55 return Read(value); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool BigEndianReader::ReadU64(uint64* value) { |
| 59 return Read(value); |
| 60 } |
| 61 |
| 58 BigEndianWriter::BigEndianWriter(char* buf, size_t len) | 62 BigEndianWriter::BigEndianWriter(char* buf, size_t len) |
| 59 : ptr_(buf), end_(ptr_ + len) {} | 63 : ptr_(buf), end_(ptr_ + len) {} |
| 60 | 64 |
| 61 bool BigEndianWriter::Skip(size_t len) { | 65 bool BigEndianWriter::Skip(size_t len) { |
| 62 if (ptr_ + len > end_) | 66 if (ptr_ + len > end_) |
| 63 return false; | 67 return false; |
| 64 ptr_ += len; | 68 ptr_ += len; |
| 65 return true; | 69 return true; |
| 66 } | 70 } |
| 67 | 71 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 } | 91 } |
| 88 | 92 |
| 89 bool BigEndianWriter::WriteU16(uint16 value) { | 93 bool BigEndianWriter::WriteU16(uint16 value) { |
| 90 return Write(value); | 94 return Write(value); |
| 91 } | 95 } |
| 92 | 96 |
| 93 bool BigEndianWriter::WriteU32(uint32 value) { | 97 bool BigEndianWriter::WriteU32(uint32 value) { |
| 94 return Write(value); | 98 return Write(value); |
| 95 } | 99 } |
| 96 | 100 |
| 101 bool BigEndianWriter::WriteU64(uint64 value) { |
| 102 return Write(value); |
| 103 } |
| 104 |
| 97 } // namespace base | 105 } // namespace base |
| OLD | NEW |