summaryrefslogtreecommitdiff
path: root/net-libs/grpc/files/grpc-1.14.2-gcc8-fixes.patch
blob: cb61b5f26fee67956340f57e7312fe55738d5c44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From 9c7db45da9a6ddc5d65cd19704539579eb31d2ce Mon Sep 17 00:00:00 2001
From: Georgy Yakovlev <gyakovlev@gentoo.org>
Date: Wed, 12 Sep 2018 10:35:45 -0700
Subject: [PATCH] Fix failures with gcc-8

Based on this PR https://github.com/grpc/grpc/pull/15443
---
 src/core/ext/filters/client_channel/client_channel.cc          | 2 +-
 .../client_channel/lb_policy/grpclb/load_balancer_api.cc       | 3 ++-
 src/core/ext/transport/chttp2/transport/flow_control.cc        | 2 +-
 src/core/lib/surface/channel.cc                                | 2 +-
 src/core/tsi/alts_transport_security.cc                        | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index d2bf4f388d..503fb1ac87 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -457,7 +457,7 @@ get_service_config_from_resolver_result_locked(channel_data* chand) {
         grpc_uri* uri = grpc_uri_parse(server_uri, true);
         GPR_ASSERT(uri->path[0] != '\0');
         service_config_parsing_state parsing_state;
-        memset(&parsing_state, 0, sizeof(parsing_state));
+        memset(reinterpret_cast<void *>(&parsing_state), 0, sizeof(parsing_state));
         parsing_state.server_name =
             uri->path[0] == '/' ? uri->path + 1 : uri->path;
         service_config->ParseGlobalParams(parse_retry_throttle_params,
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
index f24281a5bf..74baf430f1 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
@@ -68,7 +68,8 @@ grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) {
   req->has_initial_request = true;
   req->initial_request.has_name = true;
   strncpy(req->initial_request.name, lb_service_name,
-          GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH);
+          GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH-1);
+  req->initial_request.name[GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH] = '\0';
   return req;
 }
 
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index 53932bcb7f..4b1862735d 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -190,7 +190,7 @@ TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
 uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
   FlowControlTrace trace("t updt sent", this, nullptr);
   const uint32_t target_announced_window =
-      static_cast<const uint32_t>(target_window());
+      static_cast<uint32_t>(target_window());
   if ((writing_anyway || announced_window_ <= target_announced_window / 2) &&
       announced_window_ != target_announced_window) {
     const uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc
index 82635d3c21..f9d89657b3 100644
--- a/src/core/lib/surface/channel.cc
+++ b/src/core/lib/surface/channel.cc
@@ -100,7 +100,7 @@ grpc_channel* grpc_channel_create_with_builder(
     return channel;
   }
 
-  memset(channel, 0, sizeof(*channel));
+  memset(reinterpret_cast<void *>(channel), 0, sizeof(*channel));
   channel->target = target;
   channel->is_client = grpc_channel_stack_type_is_client(channel_stack_type);
   size_t channel_tracer_max_nodes = 0;  // default to off
diff --git a/src/core/tsi/alts_transport_security.cc b/src/core/tsi/alts_transport_security.cc
index 2fd408103b..51f9e9e85b 100644
--- a/src/core/tsi/alts_transport_security.cc
+++ b/src/core/tsi/alts_transport_security.cc
@@ -45,7 +45,7 @@ void grpc_tsi_alts_signal_for_cq_destroy() {
 }
 
 void grpc_tsi_alts_init() {
-  memset(&g_alts_resource, 0, sizeof(alts_shared_resource));
+  memset(reinterpret_cast<void *>(&g_alts_resource), 0, sizeof(alts_shared_resource));
   gpr_mu_init(&g_alts_resource.mu);
   gpr_cv_init(&g_alts_resource.cv);
 }
-- 
2.18.0