[vlc-commits] [Git][videolan/vlc][master] 3 commits: playlist: remove unused player.h include

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Aug 5 17:19:42 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f6ff3cf1 by Alexandre Janniaux at 2024-08-05T16:59:41+00:00
playlist: remove unused player.h include

- - - - -
1af07e7d by Alexandre Janniaux at 2024-08-05T16:59:41+00:00
playlist: use proper type for dummy memory allocation

In tests, the allocation was useless, but the compiler would still
complain about the allocation not being the correct size. Fixes the
following warnings:

    ../../src/playlist/player.c: In function ‘vlc_playlist_PlayerInit’:
    ../../src/playlist/player.c:144:22: warning: allocation of insufficient size ‘1’ for type ‘vlc_player_t’ {aka ‘struct vlc_player_t’} with size ‘648’ [-Walloc-size]
      144 |     playlist->player = vlc_player_New(parent, VLC_PLAYER_LOCK_NORMAL);
          |                      ^
    ../../src/playlist/player.c:151:31: warning: allocation of insufficient size ‘1’ for type ‘struct vlc_player_listener_id’ with size ‘32’ [-Walloc-size]
      151 |     playlist->player_listener = vlc_player_AddListener(playlist->player,
          |                               ^

- - - - -
befc924c by Alexandre Janniaux at 2024-08-05T16:59:41+00:00
playlist: remove returned value in tests

Commit 67d14d9218dad82a9644bd440f024dc47d9ece78 introduced the macro to
mock vlc_player_SetNextMedia, but the function was returning void.
Probably a copy-paste typo from the line right above.

    In file included from ../../src/playlist/control.c:29:
    ../../src/playlist/control.c: In function ‘vlc_playlist_UpdateNextMedia’:
    ../../src/playlist/playlist.h:41:53: warning: statement with no effect [-Wunused-value]
       41 | # define vlc_player_SetNextMedia(a,b) (VLC_UNUSED(b), VLC_SUCCESS)
          |                                       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
    ../../src/playlist/control.c:456:5: note: in expansion of macro ‘vlc_player_SetNextMedia’
      456 |     vlc_player_SetNextMedia(playlist->player, media);
          |     ^~~~~~~~~~~~~~~~~~~~~~~

- - - - -


2 changed files:

- src/playlist/player.c
- src/playlist/playlist.h


Changes:

=====================================
src/playlist/player.c
=====================================
@@ -27,7 +27,6 @@
 
 #include "player.h"
 
-#include "../player/player.h"
 #include "control.h"
 #include "item.h"
 #include "notify.h"


=====================================
src/playlist/playlist.h
=====================================
@@ -31,14 +31,14 @@ typedef struct input_item_t input_item_t;
 
 #ifdef TEST_PLAYLIST
 /* mock the player in tests */
-# define vlc_player_New(a,b) (VLC_UNUSED(a), malloc(1))
+# define vlc_player_New(a,b) (VLC_UNUSED(a), malloc(sizeof (vlc_player_t)))
 # define vlc_player_Delete(p) free(p)
 # define vlc_player_Lock(p) VLC_UNUSED(p)
 # define vlc_player_Unlock(p) VLC_UNUSED(p)
-# define vlc_player_AddListener(a,b,c) (VLC_UNUSED(b), malloc(1))
+# define vlc_player_AddListener(a,b,c) (VLC_UNUSED(b), malloc(sizeof(vlc_player_listener_id)))
 # define vlc_player_RemoveListener(a,b) free(b)
 # define vlc_player_SetCurrentMedia(a,b) (VLC_UNUSED(b), VLC_SUCCESS)
-# define vlc_player_SetNextMedia(a,b) (VLC_UNUSED(b), VLC_SUCCESS)
+# define vlc_player_SetNextMedia(a,b) VLC_UNUSED(b)
 # define vlc_player_osd_Message(p, fmt...) VLC_UNUSED(p)
 #endif /* TEST_PLAYLIST */
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cb260ac1bb3050c569f9d57cc4950505c1133ab5...befc924c225a39bf49f6e4ac09d1660013ce0676

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