[vlc-commits] [Git][videolan/vlc][master] 2 commits: include: vlc_arrays: actually return const
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Sep 28 08:19:06 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
db52b962 by Marvin Scholz at 2025-09-28T08:03:42+00:00
include: vlc_arrays: actually return const
Instead of just returning a pointer to the element, use a const
function for the const case, so that the compiler properly diagnoses
the type mismatch if assigned to a non-const variable.
- - - - -
de32bc52 by Marvin Scholz at 2025-09-28T08:03:42+00:00
input: do not discard const qualifier
- - - - -
2 changed files:
- include/vlc_arrays.h
- src/input/stream_extractor.c
Changes:
=====================================
include/vlc_arrays.h
=====================================
@@ -279,10 +279,16 @@ static inline size_t vlc_array_count( const vlc_array_t * p_array )
}
#ifndef __cplusplus
+static inline const void *vlc_array_item_at_index( const vlc_array_t *ar,
+ size_t idx )
+{
+ return ar->pp_elems[idx];
+}
+
# define vlc_array_item_at_index(ar, idx) \
_Generic((ar), \
- const vlc_array_t *: ((ar)->pp_elems[idx]), \
- vlc_array_t *: ((ar)->pp_elems[idx]))
+ const vlc_array_t *: (vlc_array_item_at_index)(ar, idx), \
+ vlc_array_t *: (void *)(vlc_array_item_at_index)(ar, idx))
#else
static inline void *vlc_array_item_at_index( vlc_array_t *ar, size_t idx )
{
=====================================
src/input/stream_extractor.c
=====================================
@@ -392,7 +392,7 @@ stream_extractor_AttachParsed( stream_t** source, const struct mrl_info *mrli )
while( idx < count )
{
- char* id = vlc_array_item_at_index( &mrli->identifiers, idx );
+ const char* id = vlc_array_item_at_index( &mrli->identifiers, idx );
if( vlc_stream_extractor_Attach( source, id, NULL,
(char const **) mrli->volumes.pp_elems,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/90a6f422e18492f297410a9e915c0c22802e1d25...de32bc527bc98d72a163b8e557f152e76181a949
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/90a6f422e18492f297410a9e915c0c22802e1d25...de32bc527bc98d72a163b8e557f152e76181a949
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