[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: demux: wav: use ARRAY_SIZE

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Sep 6 05:07:16 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
679d566b by Tristan Matthews at 2026-09-06T04:22:18+00:00
demux: wav: use ARRAY_SIZE

(cherry picked from commit 2c5a9619912a148a963f70cccb9f96f718858f81)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
c6774cd9 by Steve Lhomme at 2026-09-06T04:22:18+00:00
demux: wav|mkv: don't use the last item of pi_channels_aout

The last element is set to 0 because it's used in aout_CheckChannelReorder().
And it might decrement i_missing for an element we should not test.

Fixes #30063

(cherry picked from commit 6f91f583145d4a48cbaa77efd6cfef3c2dee2f66)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
7313c84b by Steve Lhomme at 2026-09-06T04:22:18+00:00
windows_audio: don't use the last element of pi_channels_src

It's always 0.

(cherry picked from commit 7c3fb2b8364e2bcf17178e7886b6e369cd2ff9ef)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


3 changed files:

- modules/demux/mkv/matroska_segment_parse.cpp
- modules/demux/wav.c
- modules/demux/windows_audio_commons.h


Changes:

=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -1780,7 +1780,7 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
                                     }
                                 }
                                 /* Well fill up with what we can */
-                                for( unsigned i = 0; i < ARRAY_SIZE(pi_channels_aout) && i_missing > 0; i++ )
+                                for( unsigned i = 0; pi_channels_aout[i] && i_missing > 0; i++ )
                                 {
                                     if( !( i_channel_mask & pi_channels_aout[i] ) )
                                     {


=====================================
modules/demux/wav.c
=====================================
@@ -247,7 +247,7 @@ static int Open( vlc_object_t * p_this )
                                                       AOUT_CHAN_CENTER }; */
 
                 /* Try to complete with pair */
-                for( unsigned i = 0; i < sizeof(pi_pair)/sizeof(*pi_pair); i++ )
+                for( unsigned i = 0; i < ARRAY_SIZE(pi_pair); i++ )
                 {
                     if( i_missing >= 2 && !(p_sys->i_channel_mask & pi_pair[i] ) )
                     {
@@ -256,7 +256,7 @@ static int Open( vlc_object_t * p_this )
                     }
                 }
                 /* Well fill up with what we can */
-                for( unsigned i = 0; i < sizeof(pi_channels_aout)/sizeof(*pi_channels_aout) && i_missing > 0; i++ )
+                for( unsigned i = 0; pi_channels_aout[i] && i_missing > 0; i++ )
                 {
                     if( !( p_sys->i_channel_mask & pi_channels_aout[i] ) )
                     {
@@ -293,7 +293,7 @@ static int Open( vlc_object_t * p_this )
             AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, AOUT_CHAN_REARCENTER };
 
         for( unsigned i = 0; i < p_sys->fmt.audio.i_channels &&
-             i < (sizeof(pi_default_channels) / sizeof(*pi_default_channels));
+             i < ARRAY_SIZE(pi_default_channels);
              i++ )
             p_sys->i_channel_mask |= pi_default_channels[i];
     }


=====================================
modules/demux/windows_audio_commons.h
=====================================
@@ -40,7 +40,7 @@ static inline unsigned getChannelMask( uint32_t * wvfextChannelMask, int i_chann
     unsigned i_channel_mask = 0;
     *i_match = 0;
     for( unsigned i = 0;
-         i < sizeof(pi_channels_src)/sizeof(*pi_channels_src) &&
+         pi_channels_src[i] &&
          *i_match < i_channels; i++ )
     {
         if( *wvfextChannelMask & pi_channels_src[i] )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/56ab1700d63f8b85ea4d955b53f15063487cac37...7313c84b82d6974421ae3f2b23f0260b4d62e678

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/56ab1700d63f8b85ea4d955b53f15063487cac37...7313c84b82d6974421ae3f2b23f0260b4d62e678
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list