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/base64.h" | 5 #include "base/base64.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 memcpy(&header_len, data->data(), 2); // assumes little-endian. | 131 memcpy(&header_len, data->data(), 2); // assumes little-endian. |
132 data->remove_prefix(2); | 132 data->remove_prefix(2); |
133 | 133 |
134 if (data->size() < header_len) | 134 if (data->size() < header_len) |
135 return NULL; | 135 return NULL; |
136 | 136 |
137 const base::StringPiece header_bytes(data->data(), header_len); | 137 const base::StringPiece header_bytes(data->data(), header_len); |
138 data->remove_prefix(header_len); | 138 data->remove_prefix(header_len); |
139 | 139 |
140 scoped_ptr<Value> header(base::JSONReader::Read( | 140 scoped_ptr<Value> header(base::JSONReader::Read( |
141 header_bytes.as_string(), true /* allow trailing comma */)); | 141 header_bytes.as_string(), base::JSON_ALLOW_TRAILING_COMMAS)); |
142 if (header.get() == NULL) | 142 if (header.get() == NULL) |
143 return NULL; | 143 return NULL; |
144 | 144 |
145 if (!header->IsType(Value::TYPE_DICTIONARY)) | 145 if (!header->IsType(Value::TYPE_DICTIONARY)) |
146 return NULL; | 146 return NULL; |
147 return reinterpret_cast<base::DictionaryValue*>(header.release()); | 147 return reinterpret_cast<base::DictionaryValue*>(header.release()); |
148 } | 148 } |
149 | 149 |
150 // kCurrentFileVersion is the version of the CRLSet file format that we | 150 // kCurrentFileVersion is the version of the CRLSet file format that we |
151 // currently implement. | 151 // currently implement. |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 return new CRLSet; | 588 return new CRLSet; |
589 } | 589 } |
590 | 590 |
591 CRLSet* CRLSet::ExpiredCRLSetForTesting() { | 591 CRLSet* CRLSet::ExpiredCRLSetForTesting() { |
592 CRLSet* crl_set = new CRLSet; | 592 CRLSet* crl_set = new CRLSet; |
593 crl_set->not_after_ = 1; | 593 crl_set->not_after_ = 1; |
594 return crl_set; | 594 return crl_set; |
595 } | 595 } |
596 | 596 |
597 } // namespace net | 597 } // namespace net |
OLD | NEW |