]> git.sesse.net Git - ffmpeg/commitdiff
avformat/avio: Use av_strstart instead of strncmp
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 24 Feb 2021 06:43:37 +0000 (07:43 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 28 Feb 2021 16:14:21 +0000 (17:14 +0100)
It makes the intent clearer and avoids calculating the length
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/avio.c

index fbe07e44bcfe293c491f2dde19bd15b93adeb649..8011482e769479b54eaab8cdabbc341736e39c37 100644 (file)
@@ -114,11 +114,10 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up,
             goto fail;
         }
         if (up->priv_data_class) {
-            int proto_len= strlen(up->name);
-            char *start = strchr(uc->filename, ',');
+            char *start;
             *(const AVClass **)uc->priv_data = up->priv_data_class;
             av_opt_set_defaults(uc->priv_data);
-            if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){
+            if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') {
                 int ret= 0;
                 char *p= start;
                 char sep= *++p;