summaryrefslogtreecommitdiff
path: root/absl/flags/internal/flag.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-09-01 09:19:13 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-01 09:19:53 -0700
commit847fa56a5422c20a6f471e67ac0bca004ff5eac5 (patch)
treeca3c7f6dc33390e9e752932e3540404c743ca9b6 /absl/flags/internal/flag.cc
parentb308bc06514600e9dedc16442fa5099050090d94 (diff)
Fix "unsafe narrowing" warnings in absl, 8/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 .cc files in */internal/.) Bug: chromium:1292951 PiperOrigin-RevId: 471549854 Change-Id: Id685d0e4666212926f4e001b8ef4930b6a33a4cc
Diffstat (limited to 'absl/flags/internal/flag.cc')
-rw-r--r--absl/flags/internal/flag.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc
index 55892d77..cc656f9d 100644
--- a/absl/flags/internal/flag.cc
+++ b/absl/flags/internal/flag.cc
@@ -406,7 +406,7 @@ template <typename StorageT>
StorageT* FlagImpl::OffsetValue() const {
char* p = reinterpret_cast<char*>(const_cast<FlagImpl*>(this));
// The offset is deduced via Flag value type specific op_.
- size_t offset = flags_internal::ValueOffset(op_);
+ ptrdiff_t offset = flags_internal::ValueOffset(op_);
return reinterpret_cast<StorageT*>(p + offset);
}
@@ -486,7 +486,7 @@ bool FlagImpl::ReadOneBool() const {
}
void FlagImpl::ReadSequenceLockedData(void* dst) const {
- int size = Sizeof(op_);
+ size_t size = Sizeof(op_);
// Attempt to read using the sequence lock.
if (ABSL_PREDICT_TRUE(seq_lock_.TryRead(dst, AtomicBufferValue(), size))) {
return;