From e25448235a73589888a3f178344382e3d68ea9ed Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Tue, 14 Apr 2015 23:55:00 -0700 Subject: [PATCH] fix MSVC size_t->int conversion warning use size_t for 'total_frames' and compute average with float arith. Change-Id: Ibf16edb38405b0d525bec38c246cf874668c994e --- src/mux/anim_encode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mux/anim_encode.c b/src/mux/anim_encode.c index e88330ae..770fe422 100644 --- a/src/mux/anim_encode.c +++ b/src/mux/anim_encode.c @@ -1248,7 +1248,7 @@ static WebPMuxError OptimizeSingleFrame(WebPAnimEncoder* const enc, int WebPAnimEncoderAssemble(WebPAnimEncoder* enc, WebPData* webp_data) { WebPMux* mux; WebPMuxError err; - int total_frames; // Muxed frames + cached (but not yet muxed) frames. + size_t total_frames; // Muxed frames + cached (but not yet muxed) frames. if (enc == NULL) { return 0; @@ -1270,8 +1270,8 @@ int WebPAnimEncoderAssemble(WebPAnimEncoder* enc, WebPData* webp_data) { if (!enc->got_null_frame_ && total_frames > 1 && enc->count_ > 0) { // set duration of the last frame to be avg of durations of previous frames. - const int average_duration = - (enc->prev_timestamp_ - enc->first_timestamp_) / (total_frames - 1); + const double delta_time = enc->prev_timestamp_ - enc->first_timestamp_; + const int average_duration = (int)(delta_time / (total_frames - 1)); SetPreviousDuration(enc, average_duration); }