From c8032d552d112bc950069e04b80b0677fe4d8eb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fernando=20Tarl=C3=A1=20Cardoso=20Lemos?= Date: Fri, 25 Feb 2011 21:45:52 -0300 Subject: [PATCH] Correct minor issues reported by the analyzer. Found with the Clang Static Analyzer. --- i3bar/src/ipc.c | 3 ++- i3bar/src/xcb.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/i3bar/src/ipc.c b/i3bar/src/ipc.c index 206b1b72..dc2255ea 100644 --- a/i3bar/src/ipc.c +++ b/i3bar/src/ipc.c @@ -248,7 +248,8 @@ int i3_send_msg(uint32_t type, const char *payload) { memcpy(walk, &type, sizeof(uint32_t)); walk += sizeof(uint32_t); - strncpy(walk, payload, len); + if (payload != NULL) + strncpy(walk, payload, len); uint32_t written = 0; diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index f33a69cd..8d4f60b5 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -51,7 +51,7 @@ xcb_charinfo_t *font_table; /* These are only relevant for XKB, which we only need for grabbing modifiers */ Display *xkb_dpy; int xkb_event_base; -int mod_pressed; +int mod_pressed = 0; /* Because the statusline is the same on all outputs, we have * global buffer to render it on */ @@ -409,7 +409,7 @@ void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { */ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { XkbEvent ev; - int modstate; + int modstate = 0; DLOG("Got XKB-Event!\n"); -- 2.39.5