Skip to content
Snippets Groups Projects
Commit 44c2aa7b authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Jean-Baptiste Kempf
Browse files

picture_pool: fix uninitialized warnings

In the case count=0, the loop is not processed and the picture array's
single element is not initialized, leading to a warning. We don't use
count=0 anyway so remove the case.

Fix the warnings (<unknown> is the VLA):

../../src/misc/picture_pool.c: In function ‘picture_pool_NewFromFormat’:
../../src/misc/picture_pool.c:140:28: warning: ‘<unknown>’ may be used uninitialized [-Wmaybe-uninitialized]
  140 |     picture_pool_t *pool = picture_pool_New(count, picture);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/misc/picture_pool.c:102:17: note: by argument 2 of type ‘picture_t * const*’ to ‘picture_pool_New’ declared here
  102 | picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
      |                 ^~~~~~~~~~~~~~~~
parent 53e91250
No related branches found
No related tags found
Loading
Pipeline #151505 passed with stages
in 47 minutes and 30 seconds
......@@ -128,7 +128,10 @@ picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt,
unsigned count)
{
picture_t *picture[count ? count : 1];
if (count == 0)
vlc_assert_unreachable();
picture_t *picture[count];
unsigned i;
for (i = 0; i < count; i++) {
......@@ -151,7 +154,10 @@ error:
picture_pool_t *picture_pool_Reserve(picture_pool_t *master, unsigned count)
{
picture_t *picture[count ? count : 1];
if (count == 0)
vlc_assert_unreachable();
picture_t *picture[count];
unsigned i;
for (i = 0; i < count; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment