Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: net/der/input.cc

Issue 1541213002: Adding OCSP Parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix break condition. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/der/input.h" 10 #include "net/der/input.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 namespace der { 14 namespace der {
15 15
16 Input::Input() : data_(nullptr), len_(0) { 16 Input::Input() : data_(nullptr), len_(0) {
17 } 17 }
18 18
19 Input::Input(const uint8_t* data, size_t len) : data_(data), len_(len) { 19 Input::Input(const uint8_t* data, size_t len) : data_(data), len_(len) {
20 } 20 }
21 21
22 bool Input::Equals(const Input& other) const { 22 bool Input::Equals(const Input& other) const {
23 if (len_ != other.len_) 23 if (len_ != other.len_)
24 return false; 24 return false;
25 return memcmp(data_, other.data_, len_) == 0; 25 return memcmp(data_, other.data_, len_) == 0;
26 } 26 }
27 27
28 bool Input::operator==(const Input& other) const {
29 return Equals(other);
30 }
31
28 std::string Input::AsString() const { 32 std::string Input::AsString() const {
29 return std::string(reinterpret_cast<const char*>(data_), len_); 33 return std::string(reinterpret_cast<const char*>(data_), len_);
30 } 34 }
31 35
32 bool operator<(const Input& lhs, const Input& rhs) { 36 bool operator<(const Input& lhs, const Input& rhs) {
33 return std::lexicographical_compare( 37 return std::lexicographical_compare(
34 lhs.UnsafeData(), lhs.UnsafeData() + lhs.Length(), rhs.UnsafeData(), 38 lhs.UnsafeData(), lhs.UnsafeData() + lhs.Length(), rhs.UnsafeData(),
35 rhs.UnsafeData() + rhs.Length()); 39 rhs.UnsafeData() + rhs.Length());
36 } 40 }
37 41
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 103
100 Mark::Mark(const uint8_t* ptr) : ptr_(ptr) { 104 Mark::Mark(const uint8_t* ptr) : ptr_(ptr) {
101 } 105 }
102 106
103 Mark::Mark() : ptr_(nullptr) { 107 Mark::Mark() : ptr_(nullptr) {
104 } 108 }
105 109
106 } // namespace der 110 } // namespace der
107 111
108 } // namespace net 112 } // namespace net
OLDNEW
« net/der/input.h ('K') | « net/der/input.h ('k') | net/der/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698