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

Side by Side Diff: courgette/label_manager.cc

Issue 2534203003: Fix courgette use of base/numerics (Closed)
Patch Set: Created 4 years 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 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 "courgette/label_manager.h" 5 #include "courgette/label_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 size_t num_distinct_rva = 0; 171 size_t num_distinct_rva = 0;
172 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) 172 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance())
173 ++num_distinct_rva; 173 ++num_distinct_rva;
174 174
175 // Reserve space for |labels_|, populate with sorted RVA and repeats. 175 // Reserve space for |labels_|, populate with sorted RVA and repeats.
176 DCHECK(labels_.empty()); 176 DCHECK(labels_.empty());
177 labels_.reserve(num_distinct_rva); 177 labels_.reserve(num_distinct_rva);
178 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) { 178 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) {
179 labels_.push_back(Label(*it.cur())); 179 labels_.push_back(Label(*it.cur()));
180 base::CheckedNumeric<uint32_t> count = it.repeat(); 180 labels_.back().count_ =
181 labels_.back().count_ = count.ValueOrDie(); 181 base::checked_cast<decltype(labels_.back().count_)>(it.repeat());
182 } 182 }
183 } 183 }
184 184
185 } // namespace courgette 185 } // namespace courgette
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