From 87f5574e3969c3b1269cfe09a7165f2b54ef0fa3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 16 Dec 2014 13:35:14 +0100 Subject: [PATCH] rectangle: clear rectangle struct before use --- ext/directfb/dfbvideosink.c | 8 ++++++-- ext/sdl/sdlvideosink.c | 4 +++- ext/wayland/wlwindow.c | 6 ++++-- sys/directdraw/gstdirectdrawsink.c | 20 ++++++++++++-------- sys/pvr2d/gstpvrvideosink.c | 3 ++- sys/vdpau/gstvdpvideopostprocess.c | 7 +++---- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c index dfe49c3d54..bafe4bade5 100644 --- a/ext/directfb/dfbvideosink.c +++ b/ext/directfb/dfbvideosink.c @@ -1744,7 +1744,9 @@ gst_dfbvideosink_show_frame (GstBaseSink * bsink, GstBuffer * buf) { GstDfbVideoSink *dfbvideosink = NULL; DFBResult res; - GstVideoRectangle dst, src, result; + GstVideoRectangle dst = { 0, }; + GstVideoRectangle src = { 0, }; + GstVideoRectangle result; GstFlowReturn ret = GST_FLOW_OK; gboolean mem_cpy = TRUE; GstMetaDfbSurface *meta; @@ -1975,7 +1977,9 @@ gst_dfbvideosink_navigation_send_event (GstNavigation * navigation, { GstDfbVideoSink *dfbvideosink = GST_DFBVIDEOSINK (navigation); GstEvent *event; - GstVideoRectangle src, dst, result; + GstVideoRectangle dst = { 0, }; + GstVideoRectangle src = { 0, }; + GstVideoRectangle result; double x, y, old_x, old_y; GstPad *pad = NULL; diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c index 5c1217f877..7f05dcad83 100644 --- a/ext/sdl/sdlvideosink.c +++ b/ext/sdl/sdlvideosink.c @@ -944,7 +944,9 @@ gst_sdlvideosink_navigation_send_event (GstNavigation * navigation, { GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (navigation); GstEvent *event; - GstVideoRectangle src, dst, result; + GstVideoRectangle dst = { 0, }; + GstVideoRectangle src = { 0, }; + GstVideoRectangle result; double x, y, old_x, old_y; GstPad *pad = NULL; diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c index ab7eddabb1..a964335f5f 100644 --- a/ext/wayland/wlwindow.c +++ b/ext/wayland/wlwindow.c @@ -237,7 +237,8 @@ gst_wl_window_is_toplevel (GstWlWindow * window) static void gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) { - GstVideoRectangle src, res; + GstVideoRectangle src = { 0, }; + GstVideoRectangle res; /* center the video_subsurface inside area_subsurface */ src.w = window->video_width; @@ -256,7 +257,8 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) struct wl_region *region; region = wl_compositor_create_region (window->display->compositor); - wl_region_add(region, 0, 0, window->render_rectangle.w, window->render_rectangle.h); + wl_region_add (region, 0, 0, window->render_rectangle.w, + window->render_rectangle.h); wl_surface_set_input_region (window->area_surface, region); wl_region_destroy (region); } diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c index 811d812db2..99140f2125 100644 --- a/sys/directdraw/gstdirectdrawsink.c +++ b/sys/directdraw/gstdirectdrawsink.c @@ -92,7 +92,8 @@ static gboolean gst_ddrawvideosink_get_format_from_caps (GstDirectDrawSink * static void gst_directdraw_sink_center_rect (GstDirectDrawSink * ddrawsink, RECT src, RECT dst, RECT * result); static const char *DDErrorString (HRESULT hr); -static long FAR PASCAL WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +static long FAR PASCAL WndProc (HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam); /* surfaces management functions */ static void gst_directdraw_sink_surface_destroy (GstDirectDrawSink * ddrawsink, @@ -209,9 +210,11 @@ gst_directdraw_sink_navigation_send_event (GstNavigation * navigation, { GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (navigation); GstEvent *event; - GstVideoRectangle src, dst, result; + GstVideoRectangle src = { 0, }; + GstVideoRectangle dst = { 0, }; + GstVideoRectangle result; RECT rect; - gdouble x, y, old_x, old_y, xscale = 1.0, yscale=1.0; + gdouble x, y, old_x, old_y, xscale = 1.0, yscale = 1.0; GstPad *pad = NULL; src.w = GST_VIDEO_SINK_WIDTH (ddrawsink); @@ -519,7 +522,7 @@ gst_directdraw_sink_init (GstDirectDrawSink * ddrawsink, ddrawsink->video_window = NULL; ddrawsink->our_video_window = TRUE; ddrawsink->previous_wndproc = NULL; - ddrawsink->previous_user_data = (LONG_PTR)NULL; + ddrawsink->previous_user_data = (LONG_PTR) NULL; ddrawsink->last_buffer = NULL; ddrawsink->caps = NULL; ddrawsink->window_thread = NULL; @@ -1575,14 +1578,15 @@ WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* Temporarily restore the previous user_data */ if (ddrawsink->previous_user_data) - SetWindowLongPtr ( hWnd, GWLP_USERDATA, ddrawsink->previous_user_data ); + SetWindowLongPtr (hWnd, GWLP_USERDATA, ddrawsink->previous_user_data); /* Call previous WndProc */ - ret = CallWindowProc ( - ddrawsink->previous_wndproc, hWnd, message, wParam, lParam); + ret = + CallWindowProc (ddrawsink->previous_wndproc, hWnd, message, wParam, + lParam); /* Point the user_data back to our ddraw_sink */ - SetWindowLongPtr ( hWnd, GWLP_USERDATA, (LONG_PTR)ddrawsink ); + SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) ddrawsink); } else { /* if there was no previous custom WndProc, call Window's default one */ ret = DefWindowProc (hWnd, message, wParam, lParam); diff --git a/sys/pvr2d/gstpvrvideosink.c b/sys/pvr2d/gstpvrvideosink.c index 7dc30c1b05..6d117fb90c 100644 --- a/sys/pvr2d/gstpvrvideosink.c +++ b/sys/pvr2d/gstpvrvideosink.c @@ -564,7 +564,8 @@ gst_pvrvideosink_blit (GstPVRVideoSink * pvrvideosink, GstBuffer * buffer) } if (pvrvideosink->keep_aspect) { - GstVideoRectangle src, dst; + GstVideoRectangle src = { 0, }; + GstVideoRectangle dst = { 0, }; src.w = GST_VIDEO_SINK_WIDTH (pvrvideosink); src.h = GST_VIDEO_SINK_HEIGHT (pvrvideosink); diff --git a/sys/vdpau/gstvdpvideopostprocess.c b/sys/vdpau/gstvdpvideopostprocess.c index 483e74a544..b7b68798c9 100644 --- a/sys/vdpau/gstvdpvideopostprocess.c +++ b/sys/vdpau/gstvdpvideopostprocess.c @@ -674,9 +674,8 @@ gst_vdp_vpp_drain (GstVdpVideoPostProcess * vpp) GstVdpOutputBuffer *outbuf; GstStructure *structure; - GstVideoRectangle src_r = { 0, } - , dest_r = { - 0,}; + GstVideoRectangle src_r = { 0, }; + GstVideoRectangle dest_r = { 0, }; VdpRect rect; GstVdpDevice *device; @@ -705,7 +704,7 @@ gst_vdp_vpp_drain (GstVdpVideoPostProcess * vpp) goto invalid_caps; if (vpp->force_aspect_ratio) { - GstVideoRectangle res_r; + GstVideoRectangle res_r = { 0, }; gst_video_sink_center_rect (src_r, dest_r, &res_r, TRUE); rect.x0 = res_r.x;