diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-04-25 16:18:26 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-04-25 16:37:58 +0400 |
commit | 5b69df96fe25e4ddffc1d58cccc01f11e0e79bcc (patch) | |
tree | 78560fd5a7db7516273fd68b7a1afbe78316e62a | |
parent | d8ead56b9c793d36065fb68945854606d942ecdd (diff) | |
download | gtk+-5b69df96fe25e4ddffc1d58cccc01f11e0e79bcc.tar.gz |
gdk/win32: fix `hr` set but not used
A number of warnings are produced:
[23/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkinput-dmanipulation.c.obj
../gdk/win32/gdkinput-dmanipulation.c: In function 'reset_viewport':
../gdk/win32/gdkinput-dmanipulation.c:354:11: warning: variable 'hr' set but not used [-Wunused-but-set-variable]
354 | HRESULT hr;
| ^~
Try to do something sensible instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | gdk/win32/gdkinput-dmanipulation.c | 13 | ||||
-rw-r--r-- | gdk/win32/gdkprivate-win32.h | 1 |
2 files changed, 7 insertions, 7 deletions
diff --git a/gdk/win32/gdkinput-dmanipulation.c b/gdk/win32/gdkinput-dmanipulation.c index 942db6cdc2..fe3215a3fb 100644 --- a/gdk/win32/gdkinput-dmanipulation.c +++ b/gdk/win32/gdkinput-dmanipulation.c @@ -354,12 +354,13 @@ reset_viewport (IDirectManipulationViewport *viewport) HRESULT hr; hr = IDirectManipulationViewport_GetPrimaryContent (viewport, iid, (void**)&content); - HR_CHECK (hr); + HR_CHECK_GOTO (hr, failed); hr = IDirectManipulationContent_SyncContentTransform (content, identity, G_N_ELEMENTS (identity)); - HR_CHECK (hr); + HR_CHECK_GOTO (hr, failed); +failed: IUnknown_Release (content); } @@ -384,7 +385,7 @@ create_viewport (GdkSurface *surface, { DIRECTMANIPULATION_CONFIGURATION configuration = 0; HWND hwnd = GDK_SURFACE_HWND (surface); - IDirectManipulationViewportEventHandler *handler; + IDirectManipulationViewportEventHandler *handler = NULL; DWORD cookie = 0; HRESULT hr; @@ -500,7 +501,7 @@ void gdk_dmanipulation_initialize_surface (GdkSurface *surface) hr = IDirectManipulationManager_Activate (dmanipulation_manager, GDK_SURFACE_HWND (surface)); - HR_CHECK (hr); + HR_CHECK_RETURN (hr); } void gdk_dmanipulation_finalize_surface (GdkSurface *surface) @@ -536,11 +537,11 @@ void gdk_dmanipulation_maybe_add_contact (GdkSurface *surface, hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_pan, pointer_id); - HR_CHECK (hr); + HR_CHECK_RETURN (hr); hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_zoom, pointer_id); - HR_CHECK (hr); + HR_CHECK_RETURN (hr); } } diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index acde8a058c..3452a8e55f 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -276,7 +276,6 @@ void _gdk_other_api_failed (const char *where, #define HR_CHECK_RETURN(hr) { if G_UNLIKELY (FAILED (hr)) return; } #define HR_CHECK_RETURN_VAL(hr, val) { if G_UNLIKELY (FAILED (hr)) return val; } -#define HR_CHECK(hr) #define HR_CHECK_GOTO(hr, label) { if G_UNLIKELY (FAILED (hr)) goto label; } extern LRESULT CALLBACK _gdk_win32_surface_procedure (HWND, UINT, WPARAM, LPARAM); |