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

Side by Side Diff: tools/ipc_fuzzer/message_lib/message_file_reader.cc

Issue 2241413003: Roll clang 277962:278861 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix Created 4 years, 4 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 | « tools/clang/scripts/update.py ('k') | tools/ipc_fuzzer/message_lib/message_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <limits.h> 5 #include <limits.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool Reader::ReadNameTable() { 159 bool Reader::ReadNameTable() {
160 for (size_t i = 0; i < header_->name_count; ++i) { 160 for (size_t i = 0; i < header_->name_count; ++i) {
161 const NameTableEntry* entry; 161 const NameTableEntry* entry;
162 if (!CutObject<NameTableEntry>(&entry)) 162 if (!CutObject<NameTableEntry>(&entry))
163 return false; 163 return false;
164 size_t offset = entry->string_table_offset; 164 size_t offset = entry->string_table_offset;
165 if (offset >= string_table_.size()) { 165 if (offset >= string_table_.size()) {
166 LOG(ERROR) << "Invalid string table offset: " << offset; 166 LOG(ERROR) << "Invalid string table offset: " << offset;
167 return false; 167 return false;
168 } 168 }
169 name_map_.Add(entry->type, std::string(string_table_.data() + offset)); 169 name_map_.Add(entry->type, string_table_.data() + offset);
170 } 170 }
171 return true; 171 return true;
172 } 172 }
173 173
174 bool Reader::RemoveUnknownMessages() { 174 bool Reader::RemoveUnknownMessages() {
175 MessageVector::iterator it = messages_->begin(); 175 MessageVector::iterator it = messages_->begin();
176 while (it != messages_->end()) { 176 while (it != messages_->end()) {
177 uint32_t type = (*it)->type(); 177 uint32_t type = (*it)->type();
178 if (!name_map_.TypeExists(type)) { 178 if (!name_map_.TypeExists(type)) {
179 LOG(ERROR) << "Missing name table entry for type " << type; 179 LOG(ERROR) << "Missing name table entry for type " << type;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 227
228 } // namespace 228 } // namespace
229 229
230 bool MessageFile::Read(const base::FilePath& path, MessageVector* messages) { 230 bool MessageFile::Read(const base::FilePath& path, MessageVector* messages) {
231 Reader reader(path); 231 Reader reader(path);
232 return reader.Read(messages); 232 return reader.Read(messages);
233 } 233 }
234 234
235 } // namespace ipc_fuzzer 235 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « tools/clang/scripts/update.py ('k') | tools/ipc_fuzzer/message_lib/message_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698