23 lines
889 B
Diff
23 lines
889 B
Diff
diff --git base/power_monitor/battery_level_provider_win.cc base/power_monitor/battery_level_provider_win.cc
|
|
index 1e9f88154adc7..3c3a4ee7cd511 100644
|
|
--- base/power_monitor/battery_level_provider_win.cc
|
|
+++ base/power_monitor/battery_level_provider_win.cc
|
|
@@ -18,6 +18,7 @@
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "base/metrics/histogram_macros.h"
|
|
+#include "base/numerics/safe_conversions.h"
|
|
#include "base/task/sequenced_task_runner.h"
|
|
#include "base/task/task_traits.h"
|
|
#include "base/task/thread_pool.h"
|
|
@@ -134,7 +135,8 @@ absl::optional<uint32_t> GetBatteryBatteryDischargeGranularity(
|
|
if (!success)
|
|
return absl::nullopt;
|
|
|
|
- size_t nb_elements = bytes_returned / sizeof(BATTERY_REPORTING_SCALE);
|
|
+ ptrdiff_t nb_elements = base::checked_cast<ptrdiff_t>(
|
|
+ bytes_returned / sizeof(BATTERY_REPORTING_SCALE));
|
|
if (!nb_elements)
|
|
return absl::nullopt;
|
|
|