[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: interop_sw: remove unused priv variable
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Jul 29 19:38:09 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1240743f by Alexandre Janniaux at 2023-07-29T19:10:20+00:00
opengl: interop_sw: remove unused priv variable
The variable was not used anymore.
../../modules/video_output/opengl/interop_sw.c: In function ‘interop_yuv_base_init’:
../../modules/video_output/opengl/interop_sw.c:439:18: warning: unused variable ‘priv’ [-Wunused-variable]
439 | struct priv *priv = interop->priv;
| ^~~~
- - - - -
562f1732 by Alexandre Janniaux at 2023-07-29T19:10:20+00:00
opengl: sampler: limit the values of number of texture
The compiler cannot assert that the texture count is less than 10
because the value from the sampler could change with the different
function calls.
Fix the value for once and ensure it doesn't go higher than 9 even in
release build.
This fixes the following truncation warnings:
../../modules/video_output/opengl/sampler.c: In function ‘sampler_base_fetch_locations’:
../../modules/video_output/opengl/sampler.c:271:48: warning: ‘%1u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Wformat-truncation=]
271 | snprintf(name, sizeof(name), "Textures[%1u]", i);
| ^~~
../../modules/video_output/opengl/sampler.c:271:38: note: directive argument in the range [0, 4294967294]
271 | snprintf(name, sizeof(name), "Textures[%1u]", i);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:906,
from ../../include/vlc_common.h:50,
from ../../modules/video_output/opengl/sampler.h:28,
from ../../modules/video_output/opengl/sampler.c:25:
In function ‘snprintf’,
inlined from ‘sampler_base_fetch_locations’ at ../../modules/video_output/opengl/sampler.c:271:9:
/usr/include/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 12 and 21 bytes into a destination of size 12
54 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
- - - - -
2 changed files:
- modules/video_output/opengl/interop_sw.c
- modules/video_output/opengl/sampler.c
Changes:
=====================================
modules/video_output/opengl/interop_sw.c
=====================================
@@ -436,8 +436,6 @@ static int
interop_yuv_base_init(struct vlc_gl_interop *interop, GLenum tex_target,
vlc_fourcc_t chroma, const vlc_chroma_description_t *desc)
{
- struct priv *priv = interop->priv;
-
(void) chroma;
struct interop_formats
=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -261,10 +261,14 @@ sampler_base_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
assert(priv->uloc.ConvMatrix != -1);
}
- struct vlc_gl_format *glfmt = &sampler->glfmt;
-
- assert(glfmt->tex_count < 10); /* to guarantee variable names length */
- for (unsigned int i = 0; i < glfmt->tex_count; ++i)
+ const struct vlc_gl_format *glfmt = &sampler->glfmt;
+ /* To guarantee variable names length, we need to fix the number
+ * of texture from now on. */
+ const unsigned tex_count = glfmt->tex_count;
+ if (tex_count >= 10)
+ vlc_assert_unreachable();
+
+ for (unsigned i = 0; i < tex_count; ++i)
{
char name[sizeof("Textures[X]")];
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b48cb210192aafe8707e32c06868fcb926067cc...562f17326fb8b92856e57a522e96a5491c128ab2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b48cb210192aafe8707e32c06868fcb926067cc...562f17326fb8b92856e57a522e96a5491c128ab2
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