From e9787e7d1d46e2b9687b150f18c76d85c2eaee71 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Wed, 7 Dec 2022 08:54:32 -0800 Subject: Add some missing copts and linkopts in logging and fix the warnings PiperOrigin-RevId: 493617276 Change-Id: Ia7fb938c7abfba10e5b62f43f3cf71fb99b132f5 --- absl/log/internal/BUILD.bazel | 2 ++ absl/log/internal/proto.cc | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'absl') diff --git a/absl/log/internal/BUILD.bazel b/absl/log/internal/BUILD.bazel index 1ad9a9d4..08276887 100644 --- a/absl/log/internal/BUILD.bazel +++ b/absl/log/internal/BUILD.bazel @@ -344,6 +344,8 @@ cc_library( name = "proto", srcs = ["proto.cc"], hdrs = ["proto.h"], + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ "//absl/base", "//absl/base:config", diff --git a/absl/log/internal/proto.cc b/absl/log/internal/proto.cc index 86c459b0..9a2b1a39 100644 --- a/absl/log/internal/proto.cc +++ b/absl/log/internal/proto.cc @@ -29,7 +29,7 @@ namespace log_internal { namespace { void EncodeRawVarint(uint64_t value, size_t size, absl::Span *buf) { for (size_t s = 0; s < size; s++) { - (*buf)[s] = (value & 0x7f) | (s + 1 == size ? 0 : 0x80); + (*buf)[s] = static_cast((value & 0x7f) | (s + 1 == size ? 0 : 0x80)); value >>= 7; } buf->remove_prefix(size); @@ -61,7 +61,7 @@ bool Encode64Bit(uint64_t tag, uint64_t value, absl::Span *buf) { } EncodeRawVarint(tag_type, tag_type_size, buf); for (size_t s = 0; s < sizeof(value); s++) { - (*buf)[s] = value & 0xff; + (*buf)[s] = static_cast(value & 0xff); value >>= 8; } buf->remove_prefix(sizeof(value)); @@ -77,7 +77,7 @@ bool Encode32Bit(uint64_t tag, uint32_t value, absl::Span *buf) { } EncodeRawVarint(tag_type, tag_type_size, buf); for (size_t s = 0; s < sizeof(value); s++) { - (*buf)[s] = value & 0xff; + (*buf)[s] = static_cast(value & 0xff); value >>= 8; } buf->remove_prefix(sizeof(value)); @@ -143,8 +143,9 @@ ABSL_MUST_USE_RESULT absl::Span EncodeMessageStart( void EncodeMessageLength(absl::Span msg, const absl::Span *buf) { if (!msg.data()) return; - const uint64_t length_size = msg.size(); - EncodeRawVarint(buf->data() - msg.data() - length_size, length_size, &msg); + const size_t length_size = msg.size(); + EncodeRawVarint(static_cast(buf->data() - msg.data()) - length_size, + length_size, &msg); } namespace { -- cgit v1.2.3