diff options
author | David Robillard <d@drobilla.net> | 2020-09-27 15:41:23 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-09-27 15:41:23 +0200 |
commit | efbc456d41a634aa9b89b0333b26071f503bd5f3 (patch) | |
tree | 37c00f365d4d8a3b6075096c59dbfd5191226b17 | |
parent | 734e1b81413a948a0948c9ea8fee278b2ff3645b (diff) | |
download | suil-efbc456d41a634aa9b89b0333b26071f503bd5f3.tar.gz suil-efbc456d41a634aa9b89b0333b26071f503bd5f3.tar.bz2 suil-efbc456d41a634aa9b89b0333b26071f503bd5f3.zip |
Separate declarations and initialize all variables
-rw-r--r-- | .clang-tidy | 2 | ||||
-rw-r--r-- | src/x11_in_gtk2.c | 12 | ||||
-rw-r--r-- | src/x11_in_gtk3.c | 16 |
3 files changed, 16 insertions, 14 deletions
diff --git a/.clang-tidy b/.clang-tidy index 6daa935..67e8ba9 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,11 +4,9 @@ Checks: > -*-uppercase-literal-suffix, -bugprone-suspicious-string-compare, -clang-analyzer-core.CallAndMessage, - -cppcoreguidelines-init-variables, -hicpp-signed-bitwise, -llvm-header-guard, -readability-else-after-return, - -readability-isolate-declaration, -readability-non-const-parameter, WarningsAsErrors: '*' HeaderFilterRegex: '.*' diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c index 61dcb04..1364a40 100644 --- a/src/x11_in_gtk2.c +++ b/src/x11_in_gtk2.c @@ -206,7 +206,7 @@ forward_key_event(SuilX11Wrapper* socket, GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(socket->plug)); GdkScreen* screen = gdk_visual_get_screen(gdk_window_get_visual(window)); - Window target_window; + Window target_window = 0; if (gdk_event->any.window == window) { // Event sent up to the plug window, forward it up to the parent GtkWidget* widget = GTK_WIDGET(socket->instance->host_widget); @@ -309,10 +309,12 @@ forward_size_request(SuilX11Wrapper* socket, (unsigned)width, (unsigned)height); // Get actual widget geometry - Window root; - int wx, wy; - unsigned int ww, wh; - unsigned int ignored; + Window root = 0; + int wx = 0; + int wy = 0; + unsigned int ww = 0; + unsigned int wh = 0; + unsigned int ignored = 0; XGetGeometry(GDK_WINDOW_XDISPLAY(window), (Window)socket->instance->ui_widget, &root, diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c index 06620c6..aa59c05 100644 --- a/src/x11_in_gtk3.c +++ b/src/x11_in_gtk3.c @@ -161,7 +161,7 @@ forward_key_event(SuilX11Wrapper* socket, GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(socket->plug)); GdkScreen* screen = gdk_visual_get_screen(gdk_window_get_visual(window)); - Window target_window; + Window target_window = 0; if (gdk_event->any.window == window) { // Event sent up to the plug window, forward it up to the parent GtkWidget* widget = GTK_WIDGET(socket->instance->host_widget); @@ -232,10 +232,12 @@ forward_size_request(SuilX11Wrapper* socket, (unsigned)width, (unsigned)height); // Get actual widget geometry - Window root; - int wx, wy; - unsigned int ww, wh; - unsigned int ignored; + Window root = 0; + int wx = 0; + int wy = 0; + unsigned int ww = 0; + unsigned int wh = 0; + unsigned int ignored = 0; XGetGeometry(GDK_WINDOW_XDISPLAY(window), (Window)socket->instance->ui_widget, &root, @@ -279,7 +281,7 @@ suil_x11_wrapper_get_preferred_width(GtkWidget* widget, GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(self->plug)); XSizeHints hints; memset(&hints, 0, sizeof(hints)); - long supplied; + long supplied = 0; XGetWMNormalHints(GDK_WINDOW_XDISPLAY(window), (Window)self->instance->ui_widget, &hints, @@ -303,7 +305,7 @@ suil_x11_wrapper_get_preferred_height(GtkWidget* widget, GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(self->plug)); XSizeHints hints; memset(&hints, 0, sizeof(hints)); - long supplied; + long supplied = 0; XGetWMNormalHints(GDK_WINDOW_XDISPLAY(window), (Window)self->instance->ui_widget, &hints, |