Update by review 2
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index 1632cc8..acd095a 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -731,7 +731,8 @@
GRPC_STATS_INC_POLLSET_KICK();
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_INFO,
- "PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p",
+ "PS:%p kick %p tls_pollset=%" PRIxPTR " tls_worker=%" PRIxPTR
+ " pollset.root_worker=%p",
pollset, specific_worker, gpr_tls_get(&g_current_thread_pollset),
gpr_tls_get(&g_current_thread_worker), pollset->root_worker);
}
diff --git a/src/core/lib/iomgr/lockfree_event.cc b/src/core/lib/iomgr/lockfree_event.cc
index 2b89fd5..b3fd8e0 100644
--- a/src/core/lib/iomgr/lockfree_event.cc
+++ b/src/core/lib/iomgr/lockfree_event.cc
@@ -96,7 +96,8 @@
* referencing it. */
gpr_atm curr = gpr_atm_acq_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
- gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this,
+ gpr_log(GPR_DEBUG,
+ "LockfreeEvent::NotifyOn: %p curr=%" PRIxPTR " closure=%p", this,
curr, closure);
}
switch (curr) {
@@ -164,7 +165,8 @@
while (true) {
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
- gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s",
+ gpr_log(GPR_DEBUG,
+ "LockfreeEvent::SetShutdown: %p curr=%" PRIxPTR " err=%s",
&state_, curr, grpc_error_string(shutdown_error));
}
switch (curr) {
@@ -213,8 +215,8 @@
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
- gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%p", &state_,
- reinterpret_cast<void*>(curr));
+ gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%" PRIxPTR, &state_,
+ curr);
}
switch (curr) {
diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc
index 4083648..034aa91 100644
--- a/src/core/lib/iomgr/unix_sockets_posix.cc
+++ b/src/core/lib/iomgr/unix_sockets_posix.cc
@@ -98,12 +98,11 @@
}
const auto* unix_addr = reinterpret_cast<const struct sockaddr_un*>(addr);
if (unix_addr->sun_path[0] == '\0' && unix_addr->sun_path[1] != '\0') {
- const struct sockaddr_un* un =
- reinterpret_cast<const struct sockaddr_un*>(resolved_addr->addr);
return absl::StrCat(
"unix-abstract:",
- absl::string_view(un->sun_path + 1,
- resolved_addr->len - sizeof(un->sun_family) - 1));
+ absl::string_view(
+ unix_addr->sun_path + 1,
+ resolved_addr->len - sizeof(unix_addr->sun_family) - 1));
}
return absl::StrCat("unix:", unix_addr->sun_path);
}
diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc
index de97b27..3e9db70 100644
--- a/src/core/lib/surface/call.cc
+++ b/src/core/lib/surface/call.cc
@@ -889,8 +889,8 @@
return call->incoming_stream_compression_algorithm;
}
-static const grpc_linked_mdelem* linked_from_md(const grpc_metadata* md) {
- return reinterpret_cast<const grpc_linked_mdelem*>(&md->internal_data);
+static grpc_linked_mdelem* linked_from_md(grpc_metadata* md) {
+ return reinterpret_cast<grpc_linked_mdelem*>(&md->internal_data);
}
static grpc_metadata* get_md_elem(grpc_metadata* metadata,
@@ -913,9 +913,8 @@
grpc_metadata_batch* batch =
&call->metadata_batch[0 /* is_receiving */][is_trailing];
for (i = 0; i < total_count; i++) {
- const grpc_metadata* md =
- get_md_elem(metadata, additional_metadata, i, count);
- grpc_linked_mdelem* l = const_cast<grpc_linked_mdelem*>(linked_from_md(md));
+ grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
+ grpc_linked_mdelem* l = linked_from_md(md);
GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data));
if (!GRPC_LOG_IF_ERROR("validate_metadata",
grpc_validate_header_key_is_legal(md->key))) {
@@ -933,10 +932,8 @@
}
if (i != total_count) {
for (int j = 0; j < i; j++) {
- const grpc_metadata* md =
- get_md_elem(metadata, additional_metadata, j, count);
- grpc_linked_mdelem* l =
- const_cast<grpc_linked_mdelem*>(linked_from_md(md));
+ grpc_metadata* md = get_md_elem(metadata, additional_metadata, j, count);
+ grpc_linked_mdelem* l = linked_from_md(md);
GRPC_MDELEM_UNREF(l->md);
}
return 0;
@@ -954,7 +951,7 @@
}
for (i = 0; i < total_count; i++) {
grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
- grpc_linked_mdelem* l = const_cast<grpc_linked_mdelem*>(linked_from_md(md));
+ grpc_linked_mdelem* l = linked_from_md(md);
grpc_error* error = grpc_metadata_batch_link_tail(batch, l);
if (error != GRPC_ERROR_NONE) {
GRPC_MDELEM_UNREF(l->md);
diff --git a/src/core/tsi/alts/frame_protector/frame_handler.cc b/src/core/tsi/alts/frame_protector/frame_handler.cc
index 905d0f2..aa90bbc 100644
--- a/src/core/tsi/alts/frame_protector/frame_handler.cc
+++ b/src/core/tsi/alts/frame_protector/frame_handler.cc
@@ -34,7 +34,7 @@
return (static_cast<uint32_t>(buffer[3]) << 24) |
(static_cast<uint32_t>(buffer[2]) << 16) |
(static_cast<uint32_t>(buffer[1]) << 8) |
- (static_cast<uint32_t>(buffer[0]));
+ static_cast<uint32_t>(buffer[0]);
}
/* Store uint32_t as a string of little endian bytes. */
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc
index 870687a..26c18a4 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc
@@ -59,7 +59,7 @@
return (static_cast<uint32_t>(buffer[3]) << 24) |
(static_cast<uint32_t>(buffer[2]) << 16) |
(static_cast<uint32_t>(buffer[1]) << 8) |
- (static_cast<uint32_t>(buffer[0]));
+ static_cast<uint32_t>(buffer[0]);
}
/* Store uint32_t as a string of little endian bytes. */
diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
index ad49ed1..e0ce641 100644
--- a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
+++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
@@ -90,7 +90,7 @@
uint32_t frame_size = (static_cast<uint32_t>(frame_size_buffer[3]) << 24) |
(static_cast<uint32_t>(frame_size_buffer[2]) << 16) |
(static_cast<uint32_t>(frame_size_buffer[1]) << 8) |
- (static_cast<uint32_t>(frame_size_buffer[0]));
+ static_cast<uint32_t>(frame_size_buffer[0]);
if (frame_size > kMaxFrameLength) {
gpr_log(GPR_ERROR, "Frame size is larger than maximum frame size");
return false;