OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/der/input.h" | 8 #include "net/der/input.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 namespace der { | 12 namespace der { |
13 | 13 |
14 Input::Input() : data_(nullptr), len_(0) { | 14 Input::Input() : data_(nullptr), len_(0) { |
15 } | 15 } |
16 | 16 |
17 Input::Input(const uint8_t* data, size_t len) : data_(data), len_(len) { | 17 Input::Input(const uint8_t* data, size_t len) : data_(data), len_(len) { |
18 } | 18 } |
19 | 19 |
20 Input::Input(const std::string& s) | |
21 : data_(reinterpret_cast<const uint8_t*>(s.data())), len_(s.size()) { | |
22 } | |
23 | |
24 bool Input::Equals(const Input& other) const { | 20 bool Input::Equals(const Input& other) const { |
25 if (len_ != other.len_) | 21 if (len_ != other.len_) |
26 return false; | 22 return false; |
27 return memcmp(data_, other.data_, len_) == 0; | 23 return memcmp(data_, other.data_, len_) == 0; |
28 } | 24 } |
29 | 25 |
30 ByteReader::ByteReader(const Input& in) | 26 ByteReader::ByteReader(const Input& in) |
31 : data_(in.UnsafeData()), len_(in.Length()) { | 27 : data_(in.UnsafeData()), len_(in.Length()) { |
32 } | 28 } |
33 | 29 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 87 |
92 Mark::Mark(const uint8_t* ptr) : ptr_(ptr) { | 88 Mark::Mark(const uint8_t* ptr) : ptr_(ptr) { |
93 } | 89 } |
94 | 90 |
95 Mark::Mark() : ptr_(nullptr) { | 91 Mark::Mark() : ptr_(nullptr) { |
96 } | 92 } |
97 | 93 |
98 } // namespace der | 94 } // namespace der |
99 | 95 |
100 } // namespace net | 96 } // namespace net |
OLD | NEW |