[vlc-commits] [Git][videolan/vlc][master] 6 commits: egl_gbm: use ARRAY_SIZE

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Dec 4 04:27:14 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
aec09001 by Tristan Matthews at 2025-12-04T04:01:31+00:00
egl_gbm: use ARRAY_SIZE

- - - - -
16b2747e by Tristan Matthews at 2025-12-04T04:01:31+00:00
xkb: use ARRAY_SIZE

- - - - -
dabda80c by Tristan Matthews at 2025-12-04T04:01:31+00:00
alsa: use ARRAY_SIZE

- - - - -
458ebdbc by Tristan Matthews at 2025-12-04T04:01:31+00:00
audiounit_ios: use ARRAY_SIZE

- - - - -
e0d20400 by Tristan Matthews at 2025-12-04T04:01:31+00:00
opensles: use ARRAY_SIZE

- - - - -
ce896f40 by Tristan Matthews at 2025-12-04T04:01:31+00:00
aout: filters: use ARRAY_SIZE

- - - - -


6 changed files:

- modules/audio_output/alsa.c
- modules/audio_output/android/opensles.c
- modules/audio_output/apple/audiounit_ios.m
- modules/video_output/opengl/egl_gbm.c
- modules/video_output/xcb/xkb.c
- src/audio_output/filters.c


Changes:

=====================================
modules/audio_output/alsa.c
=====================================
@@ -545,7 +545,7 @@ static int Map2Mask (vlc_object_t *obj, const snd_pcm_chmap_t *restrict map)
         const unsigned pos = map->pos[i];
         uint_fast16_t vlc_chan = 0;
 
-        if (pos < sizeof (vlc_chans) / sizeof (vlc_chans[0]))
+        if (pos < ARRAY_SIZE(vlc_chans))
             vlc_chan = vlc_chans[pos];
         if (vlc_chan == 0)
         {


=====================================
modules/audio_output/android/opensles.c
=====================================
@@ -477,14 +477,14 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     static const SLboolean req2[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };
 
         result = CreateAudioPlayer(sys->engineEngine, &sys->playerObject, &audioSrc,
-                                    &audioSnk, sizeof(ids2) / sizeof(*ids2),
+                                    &audioSnk, ARRAY_SIZE(ids2),
                                     ids2, req2);
     if (unlikely(result != SL_RESULT_SUCCESS)) {
         /* Try again with a more sensible samplerate */
         fmt->i_rate = 44100;
         format_pcm.samplesPerSec = ((SLuint32) 44100 * 1000) ;
         result = CreateAudioPlayer(sys->engineEngine, &sys->playerObject, &audioSrc,
-                &audioSnk, sizeof(ids2) / sizeof(*ids2),
+                &audioSnk, ARRAY_SIZE(ids2),
                 ids2, req2);
     }
     CHECK_OPENSL_ERROR("Failed to create audio player");


=====================================
modules/audio_output/apple/audiounit_ios.m
=====================================
@@ -362,7 +362,7 @@ static int DeviceSelect(audio_output_t *p_aout, const char *psz_id)
 
     if (psz_id)
     {
-        for (unsigned int i = 0; i < sizeof(au_devs) / sizeof(au_devs[0]); ++i)
+        for (unsigned int i = 0; i < ARRAY_SIZE(au_devs); ++i)
         {
             if (!strcmp(psz_id, au_devs[i].psz_id))
             {
@@ -427,7 +427,7 @@ Open(vlc_object_t *obj)
 
     aout_SoftVolumeInit( aout );
 
-    for (unsigned int i = 0; i< sizeof(au_devs) / sizeof(au_devs[0]); ++i)
+    for (unsigned int i = 0; i< ARRAY_SIZE(au_devs); ++i)
         aout_HotplugReport(aout, au_devs[i].psz_id, au_devs[i].psz_name);
 
     return VLC_SUCCESS;


=====================================
modules/video_output/opengl/egl_gbm.c
=====================================
@@ -386,7 +386,7 @@ static bool OpenDrmDevice(vlc_gl_t* gl, drmDevice* device)
     drmDevice* devices[64];
     char* render_node = NULL;
 
-    int n = drmGetDevices2(0, devices, sizeof(devices) / sizeof(devices[0]));
+    int n = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
     for (int i = 0; i < n; ++i)
     {
         drmDevice* dev = devices[i];


=====================================
modules/video_output/xcb/xkb.c
=====================================
@@ -65,14 +65,14 @@ static uint_fast32_t vlc_xkb_convert_keysym(uint_fast32_t sym)
         return sym - 0x1000000;
 
 #if 0
-    for (size_t i = 0; i < sizeof (tab) / sizeof (tab[0]); i++)
+    for (size_t i = 0; i < ARRAY_SIZE(tab); i++)
         if (i > 0 && tab[i-1].x11 >= tab[i].x11)
         {
             fprintf (stderr, "key %x and %x are not ordered properly\n",
                      tab[i-1].x11, tab[i].x11);
             abort ();
         }
-    for (size_t i = 0; i < sizeof (old) / sizeof (old[0]); i++)
+    for (size_t i = 0; i < ARRAY_SIZE(old); i++)
         if (i > 0 && old[i-1].x11 >= old[i].x11)
         {
             fprintf (stderr, "key %x and %x are not ordered properly\n",
@@ -82,13 +82,11 @@ static uint_fast32_t vlc_xkb_convert_keysym(uint_fast32_t sym)
 #endif
 
     /* Special keys */
-    res = bsearch (&sym, tab, sizeof (tab) / sizeof (tab[0]), sizeof (tab[0]),
-                   keysymcmp);
+    res = bsearch (&sym, tab, ARRAY_SIZE(tab), sizeof (tab[0]), keysymcmp);
     if (res != NULL)
         return res->vlc;
     /* Legacy X11 symbols outside the Unicode range */
-    res = bsearch (&sym, old, sizeof (old) / sizeof (old[0]), sizeof (old[0]),
-                   keysymcmp);
+    res = bsearch (&sym, old, ARRAY_SIZE(old), sizeof (old[0]), keysymcmp);
     if (res != NULL)
         return res->vlc;
 


=====================================
src/audio_output/filters.c
=====================================
@@ -453,7 +453,7 @@ static int AppendFilter(vlc_object_t *obj, const char *type, const char *name,
                         const audio_sample_format_t *restrict outfmt,
                         config_chain_t *cfg)
 {
-    const unsigned max = sizeof (filters->tab) / sizeof (filters->tab[0]);
+    const unsigned max = ARRAY_SIZE(filters->tab);
     if (filters->count >= max)
     {
         msg_Err (obj, "maximum of %u filters reached", max);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3f82b8c29ab12e81614101745e5abe3a6827fb29...ce896f409fd7234a1d8150e6bad7969f8a267a0f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3f82b8c29ab12e81614101745e5abe3a6827fb29...ce896f409fd7234a1d8150e6bad7969f8a267a0f
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