aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-03-05 09:58:05 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-03-05 16:35:10 -0800
commit7fed69b7ad10a06c2eedaaf0279f44f2bab0d85c (patch)
treecab05136a7422d5ce317fe7e7aa4f959f7e9f125 /test/cpp
parent673439d5bd2d1711c10e8c4d29ceee3e67d585fd (diff)
Use static_cast rather than reinterpret_cast whenever possible
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/qps/client_async.cc4
-rw-r--r--test/cpp/qps/server_async.cc6
-rw-r--r--test/cpp/util/slice_test.cc4
3 files changed, 6 insertions, 8 deletions
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index e3fba36a7a..8215ecbf55 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -50,9 +50,9 @@ class ClientRpcContext {
// next state, return false if done. Collect stats when appropriate
virtual bool RunNextState(bool, HistogramEntry* entry) = 0;
virtual void StartNewClone(CompletionQueue* cq) = 0;
- static void* tag(ClientRpcContext* c) { return reinterpret_cast<void*>(c); }
+ static void* tag(ClientRpcContext* c) { return static_cast<void*>(c); }
static ClientRpcContext* detag(void* t) {
- return reinterpret_cast<ClientRpcContext*>(t);
+ return static_cast<ClientRpcContext*>(t);
}
virtual void Start(CompletionQueue* cq, const ClientConfig& config) = 0;
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index b88b88445c..f1dfea24d8 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -240,11 +240,9 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
private:
std::mutex mu_;
};
- static void* tag(ServerRpcContext* func) {
- return reinterpret_cast<void*>(func);
- }
+ static void* tag(ServerRpcContext* func) { return static_cast<void*>(func); }
static ServerRpcContext* detag(void* tag) {
- return reinterpret_cast<ServerRpcContext*>(tag);
+ return static_cast<ServerRpcContext*>(tag);
}
class ServerRpcContextUnaryImpl final : public ServerRpcContext {
diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc
index c2e55f3374..5f0b9c17cc 100644
--- a/test/cpp/util/slice_test.cc
+++ b/test/cpp/util/slice_test.cc
@@ -67,7 +67,7 @@ TEST_F(SliceTest, StaticBuf) {
TEST_F(SliceTest, SliceNew) {
char* x = new char[strlen(kContent) + 1];
strcpy(x, kContent);
- Slice spp(x, strlen(x), [](void* p) { delete[] reinterpret_cast<char*>(p); });
+ Slice spp(x, strlen(x), [](void* p) { delete[] static_cast<char*>(p); });
CheckSlice(spp, kContent);
}
@@ -86,7 +86,7 @@ TEST_F(SliceTest, SliceNewWithUserData) {
strcpy(t->x, kContent);
Slice spp(t->x, strlen(t->x),
[](void* p) {
- auto* t = reinterpret_cast<stest*>(p);
+ auto* t = static_cast<stest*>(p);
delete[] t->x;
delete t;
},