Fix some 64-bit to 32-bit implicit conversions in sql.
Found with -Wshorten-64-to-32.
../../sql/initialization.cc(21,59): warning: implicit conversion loses integer precision: 'long long' to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.TenMinutes", used / 1024);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../..\base/metrics/histogram_macros.h(364,11): note: expanded from macro 'UMA_HISTOGRAM_COUNTS'
name, sample, 1, 1000000, 50)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros.h(189,15): note: expanded from macro 'UMA_HISTOGRAM_CUSTOM_COUNTS'
name, sample, min, max, bucket_count, \
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(128,19): note: expanded from macro 'INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG'
name, Add(sample), \
~~~ ^~~~~~
../..\base/metrics/histogram_macros_internal.h(120,27): note: expanded from macro 'STATIC_HISTOGRAM_POINTER_BLOCK'
histogram_add_method_invocation, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(104,24): note: expanded from macro 'HISTOGRAM_POINTER_USE'
histogram_pointer->histogram_add_method_invocation; \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../sql/initialization.cc(26,56): warning: implicit conversion loses integer precision: 'long long' to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.OneHour", used / 1024);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../..\base/metrics/histogram_macros.h(364,11): note: expanded from macro 'UMA_HISTOGRAM_COUNTS'
name, sample, 1, 1000000, 50)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros.h(189,15): note: expanded from macro 'UMA_HISTOGRAM_CUSTOM_COUNTS'
name, sample, min, max, bucket_count, \
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(128,19): note: expanded from macro 'INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG'
name, Add(sample), \
~~~ ^~~~~~
../..\base/metrics/histogram_macros_internal.h(120,27): note: expanded from macro 'STATIC_HISTOGRAM_POINTER_BLOCK'
histogram_add_method_invocation, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(104,24): note: expanded from macro 'HISTOGRAM_POINTER_USE'
histogram_pointer->histogram_add_method_invocation; \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../sql/initialization.cc(31,55): warning: implicit conversion loses integer precision: 'long long' to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.OneDay", used / 1024);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../..\base/metrics/histogram_macros.h(364,11): note: expanded from macro 'UMA_HISTOGRAM_COUNTS'
name, sample, 1, 1000000, 50)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros.h(189,15): note: expanded from macro 'UMA_HISTOGRAM_CUSTOM_COUNTS'
name, sample, min, max, bucket_count, \
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(128,19): note: expanded from macro 'INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG'
name, Add(sample), \
~~~ ^~~~~~
../..\base/metrics/histogram_macros_internal.h(120,27): note: expanded from macro 'STATIC_HISTOGRAM_POINTER_BLOCK'
histogram_add_method_invocation, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(104,24): note: expanded from macro 'HISTOGRAM_POINTER_USE'
histogram_pointer->histogram_add_method_invocation; \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../sql/initialization.cc(36,56): warning: implicit conversion loses integer precision: 'long long' to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.OneWeek", used / 1024);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../..\base/metrics/histogram_macros.h(364,11): note: expanded from macro 'UMA_HISTOGRAM_COUNTS'
name, sample, 1, 1000000, 50)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros.h(189,15): note: expanded from macro 'UMA_HISTOGRAM_CUSTOM_COUNTS'
name, sample, min, max, bucket_count, \
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(128,19): note: expanded from macro 'INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG'
name, Add(sample), \
~~~ ^~~~~~
../..\base/metrics/histogram_macros_internal.h(120,27): note: expanded from macro 'STATIC_HISTOGRAM_POINTER_BLOCK'
histogram_add_method_invocation, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(104,24): note: expanded from macro 'HISTOGRAM_POINTER_USE'
histogram_pointer->histogram_add_method_invocation; \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../sql/statement.cc(167,40): warning: implicit conversion loses integer precision: 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32]
val.size(), SQLITE_TRANSIENT));
~~~~^~~~~~
../../sql/database.cc(346,24): warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
histogram->Add(sample);
~~~ ^~~~~~
../../sql/database.cc(347,45): warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
UMA_HISTOGRAM_COUNTS("Sqlite.SizeKB", sample);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../..\base/metrics/histogram_macros.h(364,11): note: expanded from macro 'UMA_HISTOGRAM_COUNTS'
name, sample, 1, 1000000, 50)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros.h(189,15): note: expanded from macro 'UMA_HISTOGRAM_CUSTOM_COUNTS'
name, sample, min, max, bucket_count, \
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(128,19): note: expanded from macro 'INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG'
name, Add(sample), \
~~~ ^~~~~~
../..\base/metrics/histogram_macros_internal.h(120,27): note: expanded from macro 'STATIC_HISTOGRAM_POINTER_BLOCK'
histogram_add_method_invocation, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\base/metrics/histogram_macros_internal.h(104,24): note: expanded from macro 'HISTOGRAM_POINTER_USE'
histogram_pointer->histogram_add_method_invocation; \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../sql/database.cc(1810,20): warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'base::HistogramBase::Sample' (aka 'int') [-Wshorten-64-to-32]
histogram->Add(sample);
~~~ ^~~~~~
BUG=588506
Change-Id: I5b0fb4d1913301a64af178924f98c22e7811b359
Reviewed-on: https://chromium-review.googlesource.com/1188758
Reviewed-by: Victor Costan <[email protected]>
Commit-Queue: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#586906}
diff --git a/sql/database.h b/sql/database.h
index 6fb5e599..ce0c106 100644
--- a/sql/database.h
+++ b/sql/database.h
@@ -140,7 +140,7 @@
// Record a sparse UMA histogram sample under
// |name|+"."+|histogram_tag_|. If |histogram_tag_| is empty, no
// histogram is recorded.
- void AddTaggedHistogram(const std::string& name, size_t sample) const;
+ void AddTaggedHistogram(const std::string& name, int sample) const;
// Track various API calls and results. Values corrospond to UMA
// histograms, do not modify, or add or delete other than directly