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

Side by Side Diff: snapshot/minidump/minidump_simple_string_dictionary_reader.cc

Issue 1044273002: Improve map insertions (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 8 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 Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 std::string key; 65 std::string key;
66 if (!ReadMinidumpUTF8String(file_reader, entry.key, &key)) { 66 if (!ReadMinidumpUTF8String(file_reader, entry.key, &key)) {
67 return false; 67 return false;
68 } 68 }
69 69
70 std::string value; 70 std::string value;
71 if (!ReadMinidumpUTF8String(file_reader, entry.value, &value)) { 71 if (!ReadMinidumpUTF8String(file_reader, entry.value, &value)) {
72 return false; 72 return false;
73 } 73 }
74 74
75 if (local_dictionary.find(key) != local_dictionary.end()) { 75 if (!local_dictionary.insert(std::make_pair(key, value)).second) {
76 LOG(WARNING) << "duplicate key " << key << ", discarding value " << value; 76 LOG(ERROR) << "duplicate key " << key;
scottmg 2015/03/31 18:16:15 log level change was intentional?
Mark Mentovai 2015/03/31 18:21:32 scottmg wrote:
77 return false; 77 return false;
78 } 78 }
79
80 local_dictionary.insert(std::make_pair(key, value));
81 } 79 }
82 80
83 dictionary->swap(local_dictionary); 81 dictionary->swap(local_dictionary);
84 return true; 82 return true;
85 } 83 }
86 84
87 } // namespace internal 85 } // namespace internal
88 } // namespace crashpad 86 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/mac/mach_o_image_symbol_table_reader.cc ('k') | snapshot/minidump/process_snapshot_minidump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698