summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-12-07 08:54:32 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-12-07 08:55:26 -0800
commite9787e7d1d46e2b9687b150f18c76d85c2eaee71 (patch)
tree00d5b9e078c6ae63a44287b4c836ead7edaa93e0 /absl
parent5736d76ae60c1746cf6fe60466df655c91bf7a7b (diff)
Add some missing copts and linkopts in logging and fix the warnings
PiperOrigin-RevId: 493617276 Change-Id: Ia7fb938c7abfba10e5b62f43f3cf71fb99b132f5
Diffstat (limited to 'absl')
-rw-r--r--absl/log/internal/BUILD.bazel2
-rw-r--r--absl/log/internal/proto.cc11
2 files changed, 8 insertions, 5 deletions
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<char> *buf) {
for (size_t s = 0; s < size; s++) {
- (*buf)[s] = (value & 0x7f) | (s + 1 == size ? 0 : 0x80);
+ (*buf)[s] = static_cast<char>((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<char> *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<char>(value & 0xff);
value >>= 8;
}
buf->remove_prefix(sizeof(value));
@@ -77,7 +77,7 @@ bool Encode32Bit(uint64_t tag, uint32_t value, absl::Span<char> *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<char>(value & 0xff);
value >>= 8;
}
buf->remove_prefix(sizeof(value));
@@ -143,8 +143,9 @@ ABSL_MUST_USE_RESULT absl::Span<char> EncodeMessageStart(
void EncodeMessageLength(absl::Span<char> msg, const absl::Span<char> *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<uint64_t>(buf->data() - msg.data()) - length_size,
+ length_size, &msg);
}
namespace {