[vlc-commits] [Git][videolan/vlc][master] 4 commits: gui: ncurses: uses ARRAY_SIZE
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Dec 1 06:49:38 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
dc4f9656 by Tristan Matthews at 2025-12-01T06:26:44+01:00
gui: ncurses: uses ARRAY_SIZE
- - - - -
f96e0e45 by Tristan Matthews at 2025-12-01T06:26:44+01:00
qt: dialogs: use ARRAY_SIZE
- - - - -
81696e13 by Tristan Matthews at 2025-12-01T06:26:44+01:00
qt: tests: use ARRAY_SIZE
- - - - -
183a2e86 by Tristan Matthews at 2025-12-01T06:26:44+01:00
skins2: x11: use ARRAY_SIZE
- - - - -
5 changed files:
- modules/gui/ncurses.c
- modules/gui/qt/dialogs/dialogs_provider.cpp
- modules/gui/qt/dialogs/open/open_panels.cpp
- modules/gui/qt/tests/vlc_stub_modules.cpp
- modules/gui/skins2/x11/x11_factory.cpp
Changes:
=====================================
modules/gui/ncurses.c
=====================================
@@ -883,7 +883,7 @@ static int DrawMessages(intf_thread_t *intf)
MainBoxWrite(sys, l++, "[%s] %s", msg->psz_module, sys->msgs[i].msg);
}
- if (++i == sizeof sys->msgs / sizeof *sys->msgs)
+ if (++i == ARRAY_SIZE(sys->msgs))
i = 0;
if (i == sys->i_msgs) /* did we loop around the ring buffer ? */
@@ -1106,7 +1106,7 @@ static char *GetDiscDevice(const char *name)
};
char *device;
- for (unsigned i = 0; i < sizeof devs / sizeof *devs; i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(devs); i++) {
size_t n = devs[i].n;
if (!strncmp(name, devs[i].s, n)) {
if (name[n] == '@' || name[n] == '\0')
@@ -1644,7 +1644,7 @@ static void MsgCallback(void *data, int type, const vlc_log_t *msg,
free(sys->msgs[sys->i_msgs].msg);
sys->msgs[sys->i_msgs].msg = text;
- if (++sys->i_msgs == (sizeof sys->msgs / sizeof *sys->msgs))
+ if (++sys->i_msgs == ARRAY_SIZE(sys->msgs))
sys->i_msgs = 0;
vlc_mutex_unlock(&sys->msg_lock);
@@ -1772,7 +1772,7 @@ static void Close(vlc_object_t *p_this)
endwin(); /* Close the ncurses interface */
vlc_LogSet(vlc_object_instance(p_this), NULL, NULL);
- for(unsigned i = 0; i < sizeof sys->msgs / sizeof *sys->msgs; i++) {
+ for(unsigned i = 0; i < ARRAY_SIZE(sys->msgs); i++) {
if (sys->msgs[i].item)
msg_Free(sys->msgs[i].item);
free(sys->msgs[i].msg);
=====================================
modules/gui/qt/dialogs/dialogs_provider.cpp
=====================================
@@ -731,7 +731,7 @@ void DialogsProvider::savePlayingToPlaylist()
QStringList filters;
QString ext = getSettings()->value( "last-playlist-ext" ).toString();
- for( size_t i = 0; i < sizeof (types) / sizeof (types[0]); i++ )
+ for( size_t i = 0; i < ARRAY_SIZE(types); i++ )
{
QString tmp = qfut( types[i].filter_name ) + " (*." + types[i].filter_patterns + ")";
if( ext == qfu( types[i].filter_patterns ) )
@@ -752,7 +752,7 @@ void DialogsProvider::savePlayingToPlaylist()
return;
/* First test if the file extension is set, and different to selected filter */
- for( size_t i = 0; i < sizeof (types) / sizeof (types[0]); i++)
+ for( size_t i = 0; i < ARRAY_SIZE(types); i++)
{
if ( file.endsWith( QString( "." ) + qfu( types[i].filter_patterns ) ) )
{
@@ -765,7 +765,7 @@ void DialogsProvider::savePlayingToPlaylist()
/* otherwise apply the selected extension */
if ( !psz_last_playlist_ext )
{
- for( size_t i = 0; i < sizeof (types) / sizeof (types[0]); i++)
+ for( size_t i = 0; i < ARRAY_SIZE(types); i++)
{
if ( selected.startsWith( qfut( types[i].filter_name ) ) )
{
=====================================
modules/gui/qt/dialogs/open/open_panels.cpp
=====================================
@@ -65,7 +65,7 @@
Combobox will automatically do autocompletion on the edit zone */
#define POPULATE_WITH_DEVS(ppsz_devlist, targetCombo) \
QStringList targetCombo ## StringList = QStringList(); \
- for ( size_t i = 0; i< sizeof(ppsz_devlist) / sizeof(*ppsz_devlist); i++ ) \
+ for ( size_t i = 0; i< ARRAY_SIZE(ppsz_devlist); i++ ) \
targetCombo ## StringList << QString( ppsz_devlist[ i ] ); \
targetCombo->addItems( QDir( "/dev/" )\
.entryList( targetCombo ## StringList, QDir::System )\
@@ -394,7 +394,7 @@ void DiscOpenPanel::onFocus()
ui.deviceCombo->clear();
wchar_t szDrives[512];
szDrives[0] = L'\0';
- if( GetLogicalDriveStringsW( sizeof( szDrives ) / sizeof( *szDrives ) - 1, szDrives ) )
+ if( GetLogicalDriveStringsW( ARRAY_SIZE(szDrives) - 1, szDrives ) )
{
wchar_t *drive = szDrives;
DWORD oldMode;
=====================================
modules/gui/qt/tests/vlc_stub_modules.cpp
=====================================
@@ -187,9 +187,7 @@ static const char * test_defaults_args[] = {
"-v", "--vout=vdummy", "--aout=adummy", "--text-renderer=tdummy", "--media-library"
};
-static const int test_defaults_nargs =
- sizeof (test_defaults_args) / sizeof (test_defaults_args[0]);
-
+static const int test_defaults_nargs = ARRAY_SIZE(test_defaults_args);
bool VLCTestingEnv::init()
{
=====================================
modules/gui/skins2/x11/x11_factory.cpp
=====================================
@@ -433,7 +433,7 @@ void X11Factory::initCursors( )
{ kResizeNESW, "bottom_left_corner" },
};
// retrieve cursors from default theme
- for( unsigned i = 0; i < sizeof(cursors) / sizeof(cursors[0]); i++ )
+ for( unsigned i = 0; i < ARRAY_SIZE(cursors); i++ )
mCursors[cursors[i].type] =
XcursorLibraryLoadCursor( display, cursors[i].name );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe65b13db01c470b34da1c647c5e6b0b395747a9...183a2e86c7e689e2c02978b5d37d33c6d4535895
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe65b13db01c470b34da1c647c5e6b0b395747a9...183a2e86c7e689e2c02978b5d37d33c6d4535895
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