GstVideoScaler: Initialised scaling functions to get rid of compiler messages

E.g.

video-scaler.c: In function 'gst_video_scaler_horizontal':
video-scaler.c:1332:3: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   func (scale, src, dest, dest_offset, width, n_elems);
   ^

video-scaler.c: In function 'gst_video_scaler_vertical':
video-scaler.c:1373:3: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   func (scale, src_lines, dest, dest_offset, width, n_elems);
   ^

GCC's analyses seem to be correct, for the simple fact that if you pass
get_functions a known format, but no hscale or vscale, it'll return
True without having done anything.
Some callers check for the scale values to be not NULL, but then
hscale->resampler.max_taps could return 0.
A different approach to the one presented in this patch is to check
for those max_taps, too, before calling get_functions.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=752051
This commit is contained in:
Tobias Mueller 2015-07-02 07:36:12 +02:00 committed by Wim Taymans
parent 51019c16e1
commit 190c7f1928

View file

@ -1316,14 +1316,15 @@ gst_video_scaler_horizontal (GstVideoScaler * scale, GstVideoFormat format,
gpointer src, gpointer dest, guint dest_offset, guint width)
{
gint n_elems;
GstVideoScalerHFunc func;
GstVideoScalerHFunc func = NULL;
g_return_if_fail (scale != NULL);
g_return_if_fail (src != NULL);
g_return_if_fail (dest != NULL);
g_return_if_fail (dest_offset + width <= scale->resampler.out_size);
if (!get_functions (scale, NULL, format, &func, NULL, &n_elems, &width))
if (!get_functions (scale, NULL, format, &func, NULL, &n_elems, &width)
|| func == NULL)
goto no_func;
if (scale->tmpwidth < width)
@ -1357,20 +1358,22 @@ gst_video_scaler_vertical (GstVideoScaler * scale, GstVideoFormat format,
gpointer src_lines[], gpointer dest, guint dest_offset, guint width)
{
gint n_elems;
GstVideoScalerVFunc func;
GstVideoScalerVFunc func = NULL;
g_return_if_fail (scale != NULL);
g_return_if_fail (src_lines != NULL);
g_return_if_fail (dest != NULL);
g_return_if_fail (dest_offset < scale->resampler.out_size);
if (!get_functions (NULL, scale, format, NULL, &func, &n_elems, &width))
if (!get_functions (NULL, scale, format, NULL, &func, &n_elems, &width)
|| func == NULL)
goto no_func;
if (scale->tmpwidth < width)
realloc_tmplines (scale, n_elems, width);
func (scale, src_lines, dest, dest_offset, width, n_elems);
return;
no_func:
@ -1410,8 +1413,8 @@ gst_video_scaler_2d (GstVideoScaler * hscale, GstVideoScaler * vscale,
guint width, guint height)
{
gint n_elems;
GstVideoScalerHFunc hfunc;
GstVideoScalerVFunc vfunc;
GstVideoScalerHFunc hfunc = NULL;
GstVideoScalerVFunc vfunc = NULL;
gint i;
g_return_if_fail (src != NULL);