From 7cc2d22ab5389cf45a0f43ac7fb09338fcb686fb Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 8 Dec 2015 23:33:26 +0900 Subject: [PATCH] Fix compile error with gcc --- lib/nghttp2_stream.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/nghttp2_stream.c b/lib/nghttp2_stream.c index 0e265c06..3e848d8e 100644 --- a/lib/nghttp2_stream.c +++ b/lib/nghttp2_stream.c @@ -123,7 +123,7 @@ static void stream_next_cycle(nghttp2_stream *stream, uint64_t last_cycle) { stream->last_writelen * NGHTTP2_MAX_WEIGHT + stream->pending_penalty; stream->cycle = last_cycle + penalty / (uint32_t)stream->weight; - stream->pending_penalty = penalty % (uint32_t)stream->weight; + stream->pending_penalty = (uint32_t)(penalty % (uint32_t)stream->weight); } static int stream_obq_push(nghttp2_stream *dep_stream, nghttp2_stream *stream) { @@ -258,9 +258,10 @@ void nghttp2_stream_change_weight(nghttp2_stream *stream, int32_t weight) { /* Compute old stream->pending_penalty we used to calculate stream->cycle */ - stream->pending_penalty = (stream->pending_penalty + (uint32_t)old_weight - - (wlen_penalty % (uint32_t)old_weight)) % - (uint32_t)old_weight; + stream->pending_penalty = + (uint32_t)((stream->pending_penalty + (uint32_t)old_weight - + (wlen_penalty % (uint32_t)old_weight)) % + (uint32_t)old_weight); last_cycle = stream->cycle - (wlen_penalty + stream->pending_penalty) / (uint32_t)old_weight;