[vlc-commits] [Git][videolan/vlc][master] 9 commits: modules: avformat: use ARRAY_SIZE

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Nov 18 07:46:46 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e54216d1 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: avformat: use ARRAY_SIZE

- - - - -
30b4eef0 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: asf: use array initializer for hex chars

This buffer is not used as a string so does not need to be NUL
terminated.

- - - - -
67ea40c6 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: rtp: use array initializer for hex chars

This buffer is not used as a string so does not need to be NUL
terminated.

- - - - -
fc831ab5 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: rtp: use uint_fast8_t for the loop variable as well

- - - - -
e3164ea1 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: aiff: rename and use array init for chunk id

Rename psz_name to chunk_id as clearly this is not a pointer to a zero
terminated string. Also use an array initializer instead of a string
literal, as we do not expect it to be NUL terminated.

- - - - -
247f5ecc by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: vpx: ensure thread count can't be negative

Also resolves a warning about type conversion in the ternary and avoid
evaluating vlc_GetCPUCount twice.

- - - - -
44a8d6c5 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: xcb: silence unused variables warnings

- - - - -
5b1e9782 by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: pva: do not read possibly uninitialized memory

- - - - -
2f7222ba by Marvin Scholz at 2025-11-18T07:32:17+00:00
modules: xcb: silence unused variable warning without xkb-common

- - - - -


8 changed files:

- modules/codec/vpx.c
- modules/demux/aiff.c
- modules/demux/asf/libasf.c
- modules/demux/avformat/demux.c
- modules/demux/pva.c
- modules/stream_out/rtpfmt.c
- modules/video_output/xcb/render.c
- modules/video_output/xcb/window.c


Changes:

=====================================
modules/codec/vpx.c
=====================================
@@ -339,8 +339,10 @@ static int OpenDecoder(vlc_object_t *p_this)
     dec->p_sys = sys;
 
     int i_thread_count = var_InheritInteger(p_this, "vpx-threads");
+    if (i_thread_count <= 0)
+        i_thread_count = vlc_GetCPUCount();
     struct vpx_codec_dec_cfg deccfg = {
-        .threads = i_thread_count ? i_thread_count : __MIN(vlc_GetCPUCount(), 16)
+        .threads = __MIN(i_thread_count, 16)
     };
 
     msg_Dbg(p_this, "VP%d: using libvpx version %s (build options %s)",


=====================================
modules/demux/aiff.c
=====================================
@@ -119,18 +119,18 @@ static int ReadTextChunk( demux_t *p_demux,  uint64_t i_chunk_size, uint32_t i_d
         return VLC_EGENERIC;
 
     static const struct {
-        const char  psz_name[4];
+        const char  chunk_id[4];
         int         i_meta;
     } p_dsc[4] = {
-        { "NAME", vlc_meta_Title },
-        { "AUTH", vlc_meta_Artist },
-        { "(c) ", vlc_meta_Copyright },
-        { "ANNO", vlc_meta_Description }
+        { {'N', 'A', 'M', 'E'}, vlc_meta_Title },
+        { {'A', 'U', 'T', 'H'}, vlc_meta_Artist },
+        { {'(', 'c', ')', ' '}, vlc_meta_Copyright },
+        { {'A', 'N', 'N', 'O'}, vlc_meta_Description }
     };
 
     for( size_t i = 0; i < ARRAY_SIZE( p_dsc ); i++ )
     {
-        if( memcmp(p_peek, p_dsc[i].psz_name, 4) )
+        if( memcmp(p_peek, p_dsc[i].chunk_id, 4) )
             continue;
 
         char *psz_value = malloc( i_data_size + 1 );


=====================================
modules/demux/asf/libasf.c
=====================================
@@ -1287,7 +1287,8 @@ static int ASF_ReadObject_extended_content_description( stream_t *s,
         else if( i_type == ASF_METADATA_TYPE_BYTE )
         {
             /* Byte array */
-            static const char hex[16] = "0123456789ABCDEF";
+            static const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+                                         '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
             p_ec->ppsz_value[i] = malloc( 2*i_size + 1 );
             if( p_ec->ppsz_value[i] )


=====================================
modules/demux/avformat/demux.c
=====================================
@@ -1207,7 +1207,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             vlc_meta_t *p_meta = va_arg( args, vlc_meta_t * );
             AVDictionary *dict = p_sys->ic->metadata;
 
-            for( unsigned i = 0; i < sizeof(names) / sizeof(*names); i++)
+            for( unsigned i = 0; i < ARRAY_SIZE(names); i++)
             {
                 AVDictionaryEntry *e = av_dict_get( dict, names[i], NULL, 0 );
                 if( e != NULL && e->value != NULL && IsUTF8(e->value) )


=====================================
modules/demux/pva.c
=====================================
@@ -408,10 +408,14 @@ static void ParsePES( demux_t *p_demux )
     size_t hdr_read = block_ChainExtract( p_pes, hdr, ARRAY_SIZE(hdr) );
 
     /* See §2.4.3.6 of ISO 13818-1 */
-    if( hdr_read < 9 || hdr[0] != 0 || hdr[1] != 0 || hdr[2] != 1 )
-    {
-        msg_Warn( p_demux, "invalid hdr [0x%2.2x:%2.2x:%2.2x:%2.2x]",
-                  hdr[0], hdr[1],hdr[2],hdr[3] );
+    if( hdr_read < 9 ) {
+        msg_Warn( p_demux, "invalid hdr size (%zu)", hdr_read);
+        block_ChainRelease( p_pes );
+        return;
+    }
+    if( hdr[0] != 0 || hdr[1] != 0 || hdr[2] != 1 ) {
+        msg_Warn( p_demux, "invalid hdr [0x%2.2x:%2.2x:%2.2x]",
+                  hdr[0], hdr[1], hdr[2] );
         block_ChainRelease( p_pes );
         return;
     }


=====================================
modules/stream_out/rtpfmt.c
=====================================
@@ -158,7 +158,8 @@ static char *rtp_xiph_b64_oob_config(void *p_extra, size_t i_extra,
 
 static void sprintf_hexa( char *s, const uint8_t *p_data, int i_data )
 {
-    static const char hex[16] = "0123456789abcdef";
+    static const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+                                 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 
     for( int i = 0; i < i_data; i++ )
     {
@@ -1045,7 +1046,7 @@ static int rtp_packetize_eac3(sout_stream_id_sys_t *id, block_t *in)
     uint_fast8_t frag_count = (in->i_buffer + mtu - 1) / mtu - 1;
     uint8_t frame_type = frag_count > 0;
 
-    for (unsigned int i = 0; i < frag_count; i++) {
+    for (uint_fast8_t i = 0; i < frag_count; i++) {
         bool last = i == (frag_count - 1);
         size_t len = last ? in->i_buffer : mtu;
         block_t *out = block_Alloc(14 + len);


=====================================
modules/video_output/xcb/render.c
=====================================
@@ -121,6 +121,7 @@ static void RenderRegion(vout_display_t *vd, const vlc_render_subpicture *subpic
     unsigned sw = reg->place.width;
     unsigned sh = reg->place.height;
     xcb_rectangle_t rects[] = { { 0, 0, sw, sh }, };
+    VLC_UNUSED(subpic);
 
     xcb_create_pixmap(conn, 32, sys->drawable.subpic, sys->root,
         pic->format.i_width, pic->format.i_height);
@@ -416,8 +417,6 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
 
 static int Control(vout_display_t *vd, int query)
 {
-    vout_display_sys_t *sys = vd->sys;
-
     switch (query) {
         case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:


=====================================
modules/video_output/xcb/window.c
=====================================
@@ -895,6 +895,8 @@ static int OpenCommon(vlc_window_t *wnd, char *display, xcb_connection_t *conn,
         InitKeyboardExtension(wnd);
     else
         sys->xkb.ctx = NULL;
+#else
+    VLC_UNUSED(events);
 #endif
 
     if (InitRandR(wnd) == VLC_SUCCESS) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5513cf900aaf59b048c3404fd3662f9a301259f...2f7222ba64e5118518cacb5917b61a69dc4842b2

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5513cf900aaf59b048c3404fd3662f9a301259f...2f7222ba64e5118518cacb5917b61a69dc4842b2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list