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

Side by Side Diff: base/i18n/number_formatting.cc

Issue 1542323002: Switch to standard integer types in base/i18n/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: header Created 4 years, 12 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 | « base/i18n/number_formatting.h ('k') | base/i18n/number_formatting_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 "base/i18n/number_formatting.h" 5 #include "base/i18n/number_formatting.h"
6 6
7 #include <stddef.h>
8
7 #include "base/format_macros.h" 9 #include "base/format_macros.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
14 #include "third_party/icu/source/common/unicode/ustring.h" 16 #include "third_party/icu/source/common/unicode/ustring.h"
15 #include "third_party/icu/source/i18n/unicode/numfmt.h" 17 #include "third_party/icu/source/i18n/unicode/numfmt.h"
16 18
(...skipping 21 matching lines...) Expand all
38 scoped_ptr<icu::NumberFormat> number_format; 40 scoped_ptr<icu::NumberFormat> number_format;
39 }; 41 };
40 42
41 LazyInstance<NumberFormatWrapper> g_number_format_int = 43 LazyInstance<NumberFormatWrapper> g_number_format_int =
42 LAZY_INSTANCE_INITIALIZER; 44 LAZY_INSTANCE_INITIALIZER;
43 LazyInstance<NumberFormatWrapper> g_number_format_float = 45 LazyInstance<NumberFormatWrapper> g_number_format_float =
44 LAZY_INSTANCE_INITIALIZER; 46 LAZY_INSTANCE_INITIALIZER;
45 47
46 } // namespace 48 } // namespace
47 49
48 string16 FormatNumber(int64 number) { 50 string16 FormatNumber(int64_t number) {
49 icu::NumberFormat* number_format = 51 icu::NumberFormat* number_format =
50 g_number_format_int.Get().number_format.get(); 52 g_number_format_int.Get().number_format.get();
51 53
52 if (!number_format) { 54 if (!number_format) {
53 // As a fallback, just return the raw number in a string. 55 // As a fallback, just return the raw number in a string.
54 return UTF8ToUTF16(StringPrintf("%" PRId64, number)); 56 return UTF8ToUTF16(StringPrintf("%" PRId64, number));
55 } 57 }
56 icu::UnicodeString ustr; 58 icu::UnicodeString ustr;
57 number_format->format(number, ustr); 59 number_format->format(number, ustr);
58 60
(...skipping 19 matching lines...) Expand all
78 namespace testing { 80 namespace testing {
79 81
80 void ResetFormatters() { 82 void ResetFormatters() {
81 g_number_format_int.Get().Reset(); 83 g_number_format_int.Get().Reset();
82 g_number_format_float.Get().Reset(); 84 g_number_format_float.Get().Reset();
83 } 85 }
84 86
85 } // namespace testing 87 } // namespace testing
86 88
87 } // namespace base 89 } // namespace base
OLDNEW
« no previous file with comments | « base/i18n/number_formatting.h ('k') | base/i18n/number_formatting_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698