[x264-devel] [Git][videolan/x264][master] Silence false positive -Wformat-truncation warning

Henrik Gramner gitlab at videolan.org
Thu Feb 11 14:09:31 UTC 2021



Henrik Gramner pushed to branch master at VideoLAN / x264


Commits:
38a76c7a by Henrik Gramner at 2021-02-11T14:24:57+01:00
Silence false positive -Wformat-truncation warning

- - - - -


1 changed file:

- encoder/encoder.c


Changes:

=====================================
encoder/encoder.c
=====================================
@@ -1787,11 +1787,12 @@ x264_t *x264_encoder_open( x264_param_t *param, void *api )
                           h->sps->i_profile_idc == PROFILE_HIGH422 ?
                               (h->sps->b_constraint_set3 ? "High 4:2:2 Intra" : "High 4:2:2") :
                           h->sps->b_constraint_set3 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive";
-    char level[4];
-    snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc/10, h->sps->i_level_idc%10 );
+    char level[16];
     if( h->sps->i_level_idc == 9 || ( h->sps->i_level_idc == 11 && h->sps->b_constraint_set3 &&
         (h->sps->i_profile_idc == PROFILE_BASELINE || h->sps->i_profile_idc == PROFILE_MAIN) ) )
         strcpy( level, "1b" );
+    else
+        snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc / 10, h->sps->i_level_idc % 10 );
 
     static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" };
     x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s, %d-bit\n",



View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/38a76c7a00ca561e6b016c97662822f9a23c2ace

-- 
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/38a76c7a00ca561e6b016c97662822f9a23c2ace
You're receiving this email because of your account on code.videolan.org.




More information about the x264-devel mailing list