aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/timer_heap.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 /src/core/lib/iomgr/timer_heap.cc
parent194436342137924b4fb7429bede037a4b5ec7edb (diff)
Autofix c casts to c++ casts
Diffstat (limited to 'src/core/lib/iomgr/timer_heap.cc')
-rw-r--r--src/core/lib/iomgr/timer_heap.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/lib/iomgr/timer_heap.cc b/src/core/lib/iomgr/timer_heap.cc
index 632928fafa..9aedfd3755 100644
--- a/src/core/lib/iomgr/timer_heap.cc
+++ b/src/core/lib/iomgr/timer_heap.cc
@@ -35,7 +35,7 @@
its argument. */
static void adjust_upwards(grpc_timer** first, uint32_t i, grpc_timer* t) {
while (i > 0) {
- uint32_t parent = (uint32_t)(((int)i - 1) / 2);
+ uint32_t parent = static_cast<uint32_t>((static_cast<int>(i) - 1) / 2);
if (first[parent]->deadline <= t->deadline) break;
first[i] = first[parent];
first[i]->heap_index = i;
@@ -74,14 +74,14 @@ static void maybe_shrink(grpc_timer_heap* heap) {
if (heap->timer_count >= 8 &&
heap->timer_count <= heap->timer_capacity / SHRINK_FULLNESS_FACTOR / 2) {
heap->timer_capacity = heap->timer_count * SHRINK_FULLNESS_FACTOR;
- heap->timers = (grpc_timer**)gpr_realloc(
- heap->timers, heap->timer_capacity * sizeof(grpc_timer*));
+ heap->timers = static_cast<grpc_timer**>(gpr_realloc(
+ heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
}
}
static void note_changed_priority(grpc_timer_heap* heap, grpc_timer* timer) {
uint32_t i = timer->heap_index;
- uint32_t parent = (uint32_t)(((int)i - 1) / 2);
+ uint32_t parent = static_cast<uint32_t>((static_cast<int>(i) - 1) / 2);
if (heap->timers[parent]->deadline > timer->deadline) {
adjust_upwards(heap->timers, i, timer);
} else {
@@ -99,8 +99,8 @@ int grpc_timer_heap_add(grpc_timer_heap* heap, grpc_timer* timer) {
if (heap->timer_count == heap->timer_capacity) {
heap->timer_capacity =
GPR_MAX(heap->timer_capacity + 1, heap->timer_capacity * 3 / 2);
- heap->timers = (grpc_timer**)gpr_realloc(
- heap->timers, heap->timer_capacity * sizeof(grpc_timer*));
+ heap->timers = static_cast<grpc_timer**>(gpr_realloc(
+ heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
}
timer->heap_index = heap->timer_count;
adjust_upwards(heap->timers, heap->timer_count, timer);