diff options
author | 2022-10-06 12:31:33 -0700 | |
---|---|---|
committer | 2022-10-06 12:32:48 -0700 | |
commit | 8317b9a01cbc32594ad4bf971709c97cb13ec921 (patch) | |
tree | b5b22d90392021f249d9b2659db2df0bfa82e03a /absl/log/internal/conditions.cc | |
parent | 10e7b4b72d58bc1476a1dcc94a779b4804974256 (diff) |
Fix "unsafe narrowing" warnings in absl, 11/n.
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on the logging facility.)
Bug: chromium:1292951
PiperOrigin-RevId: 479384741
Change-Id: Id450438ea3781ce25137366ca16757e810020ad4
Diffstat (limited to 'absl/log/internal/conditions.cc')
-rw-r--r-- | absl/log/internal/conditions.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/log/internal/conditions.cc b/absl/log/internal/conditions.cc index 70f2acef..a9f4966f 100644 --- a/absl/log/internal/conditions.cc +++ b/absl/log/internal/conditions.cc @@ -37,7 +37,7 @@ uint32_t LossyIncrement(std::atomic<uint32_t>* counter) { } // namespace bool LogEveryNState::ShouldLog(int n) { - return n != 0 && (LossyIncrement(&counter_) % n) == 0; + return n > 0 && (LossyIncrement(&counter_) % static_cast<uint32_t>(n)) == 0; } bool LogFirstNState::ShouldLog(int n) { |