diff mbox series

[FFmpeg-devel,15/15] avformt/webmdashenc: Use av_strstart instead of strncmp

Message ID 20210224115341.794293-15-andreas.rheinhardt@gmail.com
State Accepted
Commit 546e3964ddd3762b22860cc581e23ba6d1443a95
Headers show
Series [FFmpeg-devel,01/15] avformat/movenc: Remove always true check
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 24, 2021, 11:53 a.m. UTC
It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/webmdashenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 04f8cbe39d..332d0466e1 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -133,7 +133,7 @@  static int subsegment_alignment(AVFormatContext *s, const AdaptationSet *as)
     for (i = 1; i < as->nb_streams; i++) {
         AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
                                             CUE_TIMESTAMPS, NULL, 0);
-        if (!ts || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
+        if (!ts || !av_strstart(ts->value, gold->value, NULL)) return 0;
     }
     return 1;
 }
@@ -152,7 +152,7 @@  static int bitstream_switching(AVFormatContext *s, const AdaptationSet *as)
                                                    TRACK_NUMBER, NULL, 0);
         AVCodecParameters *par = st->codecpar;
         if (!track_num ||
-            strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) ||
+            !av_strstart(track_num->value, gold_track_num->value, NULL) ||
             gold_par->codec_id != par->codec_id ||
             gold_par->extradata_size != par->extradata_size ||
             memcmp(gold_par->extradata, par->extradata, par->extradata_size)) {