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

Side by Side Diff: printing/page_range.cc

Issue 1544623002: Switch to standard integer types in printing/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « printing/page_number.cc ('k') | printing/pdf_metafile_cg_mac.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "printing/page_range.h" 5 #include "printing/page_range.h"
6 6
7 #include <stddef.h>
8
7 #include <set> 9 #include <set>
8 10
9 namespace { 11 namespace {
10 const std::size_t kMaxNumberOfPages = 100000; 12 const std::size_t kMaxNumberOfPages = 100000;
11 } 13 }
12 14
13 namespace printing { 15 namespace printing {
14 16
15 /* static */ 17 /* static */
16 std::vector<int> PageRange::GetPages(const PageRanges& ranges) { 18 std::vector<int> PageRange::GetPages(const PageRanges& ranges) {
17 // TODO(vitalybuka): crbug.com/95548 Remove this method as part fix. 19 // TODO(vitalybuka): crbug.com/95548 Remove this method as part fix.
18 std::set<int> pages; 20 std::set<int> pages;
19 for (unsigned i = 0; i < ranges.size(); ++i) { 21 for (unsigned i = 0; i < ranges.size(); ++i) {
20 const PageRange& range = ranges[i]; 22 const PageRange& range = ranges[i];
21 // Ranges are inclusive. 23 // Ranges are inclusive.
22 for (int i = range.from; i <= range.to; ++i) { 24 for (int i = range.from; i <= range.to; ++i) {
23 pages.insert(i); 25 pages.insert(i);
24 if (pages.size() >= kMaxNumberOfPages) 26 if (pages.size() >= kMaxNumberOfPages)
25 return std::vector<int>(pages.begin(), pages.end()); 27 return std::vector<int>(pages.begin(), pages.end());
26 } 28 }
27 } 29 }
28 return std::vector<int>(pages.begin(), pages.end()); 30 return std::vector<int>(pages.begin(), pages.end());
29 } 31 }
30 32
31 } // namespace printing 33 } // namespace printing
OLDNEW
« no previous file with comments | « printing/page_number.cc ('k') | printing/pdf_metafile_cg_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698