summaryrefslogtreecommitdiff
path: root/absl/flags
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-09-01 10:08:26 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-01 10:09:08 -0700
commitfa108c444f18f6345b78090af47ec5fb4a7c2c36 (patch)
treeb85fec244098d41964f1d2b5709c45bbd5638a2b /absl/flags
parent847fa56a5422c20a6f471e67ac0bca004ff5eac5 (diff)
Rollback of 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: 471561809 Change-Id: I7abd6d83706f5ca135f1ce3458192a498a6280b9
Diffstat (limited to 'absl/flags')
-rw-r--r--absl/flags/internal/flag.cc4
-rw-r--r--absl/flags/internal/usage.cc3
2 files changed, 4 insertions, 3 deletions
diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc
index cc656f9d..55892d77 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_.
- ptrdiff_t offset = flags_internal::ValueOffset(op_);
+ size_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 {
- size_t size = Sizeof(op_);
+ int size = Sizeof(op_);
// Attempt to read using the sequence lock.
if (ABSL_PREDICT_TRUE(seq_lock_.TryRead(dst, AtomicBufferValue(), size))) {
return;
diff --git a/absl/flags/internal/usage.cc b/absl/flags/internal/usage.cc
index a3b13ed3..949709e8 100644
--- a/absl/flags/internal/usage.cc
+++ b/absl/flags/internal/usage.cc
@@ -148,7 +148,8 @@ class FlagHelpPrettyPrinter {
}
// Write the token, ending the string first if necessary/possible.
- if (!new_line && (line_len_ + token.size() >= max_line_len_)) {
+ if (!new_line &&
+ (line_len_ + static_cast<int>(token.size()) >= max_line_len_)) {
EndLine();
new_line = true;
}