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

Side by Side Diff: net/cert/crl_set_storage.cc

Issue 1639393002: Use static_cast instead of reinterpret_cast in net::ReadHeader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/cert/crl_set_storage.h" 5 #include "net/cert/crl_set_storage.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 const base::StringPiece header_bytes(data->data(), header_len); 125 const base::StringPiece header_bytes(data->data(), header_len);
126 data->remove_prefix(header_len); 126 data->remove_prefix(header_len);
127 127
128 scoped_ptr<base::Value> header = 128 scoped_ptr<base::Value> header =
129 base::JSONReader::Read(header_bytes, base::JSON_ALLOW_TRAILING_COMMAS); 129 base::JSONReader::Read(header_bytes, base::JSON_ALLOW_TRAILING_COMMAS);
130 if (header.get() == NULL) 130 if (header.get() == NULL)
131 return NULL; 131 return NULL;
132 132
133 if (!header->IsType(base::Value::TYPE_DICTIONARY)) 133 if (!header->IsType(base::Value::TYPE_DICTIONARY))
134 return NULL; 134 return NULL;
135 return reinterpret_cast<base::DictionaryValue*>(header.release()); 135 return static_cast<base::DictionaryValue*>(header.release());
136 } 136 }
137 137
138 // kCurrentFileVersion is the version of the CRLSet file format that we 138 // kCurrentFileVersion is the version of the CRLSet file format that we
139 // currently implement. 139 // currently implement.
140 static const int kCurrentFileVersion = 0; 140 static const int kCurrentFileVersion = 0;
141 141
142 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, 142 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash,
143 std::vector<std::string>* out_serials) { 143 std::vector<std::string>* out_serials) {
144 if (data->size() < crypto::kSHA256Length) 144 if (data->size() < crypto::kSHA256Length)
145 return false; 145 return false;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 memcpy(out + off, j->data(), j->size()); 543 memcpy(out + off, j->data(), j->size());
544 off += j->size(); 544 off += j->size();
545 } 545 }
546 } 546 }
547 547
548 CHECK_EQ(off, len); 548 CHECK_EQ(off, len);
549 return ret; 549 return ret;
550 } 550 }
551 551
552 } // namespace net 552 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698