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

Side by Side Diff: ui/gfx/range/range.cc

Issue 1948283002: Fix gfx::Range::ToString() to use the correct format specifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add sstream header. Created 4 years, 7 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 | ui/gfx/range/range_unittest.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/range/range.h" 5 #include "ui/gfx/range/range.h"
6 6
7 #include <inttypes.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 #include <limits> 10 #include <limits>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
12 14
13 namespace gfx { 15 namespace gfx {
14 16
15 Range::Range() 17 Range::Range()
16 : start_(0), 18 : start_(0),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 uint32_t min = std::max(GetMin(), range.GetMin()); 72 uint32_t min = std::max(GetMin(), range.GetMin());
71 uint32_t max = std::min(GetMax(), range.GetMax()); 73 uint32_t max = std::min(GetMax(), range.GetMax());
72 74
73 if (min >= max) // No intersection. 75 if (min >= max) // No intersection.
74 return InvalidRange(); 76 return InvalidRange();
75 77
76 return Range(min, max); 78 return Range(min, max);
77 } 79 }
78 80
79 std::string Range::ToString() const { 81 std::string Range::ToString() const {
80 return base::StringPrintf("{%d,%d}", start(), end()); 82 return base::StringPrintf("{%" PRIu32 ",%" PRIu32 "}", start(), end());
81 } 83 }
82 84
83 std::ostream& operator<<(std::ostream& os, const Range& range) { 85 std::ostream& operator<<(std::ostream& os, const Range& range) {
84 return os << range.ToString(); 86 return os << range.ToString();
85 } 87 }
86 88
87 } // namespace gfx 89 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/range/range_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698