aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr/timer_heap_test.cc
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
committerGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
commitbe82e64b3debcdb1d9ec6a149fc85af0d46bfb7e (patch)
treecc5e1234073eb250a2c319b5a4db2919fce060ea /test/core/iomgr/timer_heap_test.cc
parent194436342137924b4fb7429bede037a4b5ec7edb (diff)
Autofix c casts to c++ casts
Diffstat (limited to 'test/core/iomgr/timer_heap_test.cc')
-rw-r--r--test/core/iomgr/timer_heap_test.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc
index ed66b7df8d..08f5d632e3 100644
--- a/test/core/iomgr/timer_heap_test.cc
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -102,7 +102,7 @@ static void test1(void) {
check_valid(&pq);
for (i = 0; i < num_test_operations; ++i) {
- size_t elem_num = (size_t)rand() % num_test_elements;
+ size_t elem_num = static_cast<size_t>(rand()) % num_test_elements;
grpc_timer* el = &test_elements[elem_num];
if (!inpq[elem_num]) { /* not in pq */
GPR_ASSERT(!contains(&pq, el));
@@ -142,8 +142,8 @@ static elem_struct* search_elems(elem_struct* elems, size_t count,
search_order[i] = i;
}
for (size_t i = 0; i < count * 2; i++) {
- size_t a = (size_t)rand() % count;
- size_t b = (size_t)rand() % count;
+ size_t a = static_cast<size_t>(rand()) % count;
+ size_t b = static_cast<size_t>(rand()) % count;
GPR_SWAP(size_t, search_order[a], search_order[b]);
}
elem_struct* out = nullptr;
@@ -235,7 +235,7 @@ static void shrink_test(void) {
size_t expected_size;
/* A large random number to allow for multiple shrinkages, at least 512. */
- const size_t num_elements = (size_t)rand() % 2000 + 512;
+ const size_t num_elements = static_cast<size_t>(rand()) % 2000 + 512;
grpc_timer_heap_init(&pq);
@@ -265,7 +265,7 @@ static void shrink_test(void) {
4 times the Size and not less than 2 times, but never goes below 16. */
expected_size = pq.timer_count;
while (pq.timer_count > 0) {
- const size_t which = (size_t)rand() % pq.timer_count;
+ const size_t which = static_cast<size_t>(rand()) % pq.timer_count;
grpc_timer* te = pq.timers[which];
grpc_timer_heap_remove(&pq, te);
gpr_free(te);