diff mbox series

[FFmpeg-devel] avformat/apngenc: Use UINT16_MAX instead of USHRT_MAX

Message ID AM7PR03MB6660EB34296215DB66F0669D8F909@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit e5199eebb44fa5b63dcec06d38cab515eaa52b6c
Headers show
Series [FFmpeg-devel] avformat/apngenc: Use UINT16_MAX instead of USHRT_MAX | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 7, 2021, 10:58 a.m. UTC
The latter needn't be 16 bits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Will apply this tonight unless there are objections.

 libavformat/apngenc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index c97c475274..767074ecf3 100644
--- a/libavformat/apngenc.c
+++ b/libavformat/apngenc.c
@@ -91,9 +91,9 @@  static int apng_write_header(AVFormatContext *format_context)
         return AVERROR(EINVAL);
     }
 
-    if (apng->last_delay.num > USHRT_MAX || apng->last_delay.den > USHRT_MAX) {
+    if (apng->last_delay.num > UINT16_MAX || apng->last_delay.den > UINT16_MAX) {
         av_reduce(&apng->last_delay.num, &apng->last_delay.den,
-                  apng->last_delay.num, apng->last_delay.den, USHRT_MAX);
+                  apng->last_delay.num, apng->last_delay.den, UINT16_MAX);
         av_log(format_context, AV_LOG_WARNING,
                "Last frame delay is too precise. Reducing to %d/%d (%f).\n",
                apng->last_delay.num, apng->last_delay.den, (double)apng->last_delay.num / apng->last_delay.den);
@@ -191,7 +191,7 @@  static int flush_packet(AVFormatContext *format_context, AVPacket *packet)
                 if (packet) {
                     int64_t delay_num_raw = (packet->dts - apng->prev_packet->dts) * codec_stream->time_base.num;
                     int64_t delay_den_raw = codec_stream->time_base.den;
-                    if (!av_reduce(&delay.num, &delay.den, delay_num_raw, delay_den_raw, USHRT_MAX) &&
+                    if (!av_reduce(&delay.num, &delay.den, delay_num_raw, delay_den_raw, UINT16_MAX) &&
                         !apng->framerate_warned) {
                         av_log(format_context, AV_LOG_WARNING,
                                "Frame rate is too high or specified too precisely. Unable to copy losslessly.\n");
@@ -281,9 +281,9 @@  static void apng_deinit(AVFormatContext *s)
 #define ENC AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
     { "plays", "Number of times to play the output: 0 - infinite loop, 1 - no loop", OFFSET(plays),
-      AV_OPT_TYPE_INT, { .i64 = 1 }, 0, UINT_MAX, ENC },
+      AV_OPT_TYPE_INT, { .i64 = 1 }, 0, UINT16_MAX, ENC },
     { "final_delay", "Force delay after the last frame", OFFSET(last_delay),
-      AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, USHRT_MAX, ENC },
+      AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, UINT16_MAX, ENC },
     { NULL },
 };