fix a few warnings/places where the clang static analyzer complains
This commit is contained in:
parent
cab8e3c46f
commit
8a1c8115ca
|
@ -126,16 +126,6 @@ static int handle_expose(void *data, xcb_connection_t *conn, xcb_expose_event_t
|
|||
static int handle_key_release(void *ignored, xcb_connection_t *conn, xcb_key_release_event_t *event) {
|
||||
printf("releasing %d, state raw = %d\n", event->detail, event->state);
|
||||
|
||||
/* See the documentation of xcb_key_symbols_get_keysym for this one.
|
||||
* Basically: We get either col 0 or col 1, depending on whether shift is
|
||||
* pressed. */
|
||||
int col = (event->state & XCB_MOD_MASK_SHIFT);
|
||||
|
||||
/* If modeswitch is currently active, we need to look in group 2 or 3,
|
||||
* respectively. */
|
||||
if (modeswitch_active)
|
||||
col += 2;
|
||||
|
||||
xcb_keysym_t sym = xcb_key_press_lookup_keysym(symbols, event, event->state);
|
||||
if (sym == XK_Mode_switch) {
|
||||
printf("Mode switch disabled\n");
|
||||
|
|
|
@ -216,7 +216,7 @@ static int handle_expose(xcb_connection_t *conn, xcb_expose_event_t *event) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *pattern = strdup("-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1");
|
||||
char *pattern = sstrdup("-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1");
|
||||
int o, option_index = 0;
|
||||
enum { TYPE_ERROR = 0, TYPE_WARNING = 1 } bar_type = TYPE_ERROR;
|
||||
|
||||
|
@ -232,7 +232,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
char *options_string = "b:f:m:t:vh";
|
||||
|
||||
prompt = strdup("Please do not run this program.");
|
||||
prompt = sstrdup("Please do not run this program.");
|
||||
|
||||
while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
|
||||
switch (o) {
|
||||
|
@ -241,11 +241,11 @@ int main(int argc, char *argv[]) {
|
|||
return 0;
|
||||
case 'f':
|
||||
FREE(pattern);
|
||||
pattern = strdup(optarg);
|
||||
pattern = sstrdup(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
FREE(prompt);
|
||||
prompt = strdup(optarg);
|
||||
prompt = sstrdup(optarg);
|
||||
break;
|
||||
case 't':
|
||||
bar_type = (strcasecmp(optarg, "warning") == 0 ? TYPE_WARNING : TYPE_ERROR);
|
||||
|
@ -432,5 +432,7 @@ int main(int argc, char *argv[]) {
|
|||
free(event);
|
||||
}
|
||||
|
||||
FREE(pattern);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *which) {
|
|||
return;
|
||||
}
|
||||
|
||||
LOG("should move window to workspace with number %d\n", which);
|
||||
LOG("should move window to workspace %s\n", which);
|
||||
/* get the workspace */
|
||||
Con *output, *workspace = NULL;
|
||||
|
||||
|
@ -835,7 +835,7 @@ void cmd_workspace_number(I3_CMD, char *which) {
|
|||
child->num == parsed_num);
|
||||
|
||||
if (!workspace) {
|
||||
LOG("There is no workspace with number %d, creating a new one.\n", parsed_num);
|
||||
LOG("There is no workspace with number %ld, creating a new one.\n", parsed_num);
|
||||
ysuccess(true);
|
||||
/* terminate the which string after the endposition of the number */
|
||||
*endptr = '\0';
|
||||
|
@ -1421,6 +1421,10 @@ void cmd_layout(I3_CMD, char *layout_str) {
|
|||
layout = L_SPLITV;
|
||||
else if (strcmp(layout_str, "splith") == 0)
|
||||
layout = L_SPLITH;
|
||||
else {
|
||||
ELOG("Unknown layout \"%s\", this is a mismatch between code and parser spec.\n", layout_str);
|
||||
return;
|
||||
}
|
||||
|
||||
DLOG("changing layout to %s (%d)\n", layout_str, layout);
|
||||
|
||||
|
|
|
@ -1260,6 +1260,9 @@ bool con_fullscreen_permits_focusing(Con *con) {
|
|||
while (fs && fs->fullscreen_mode == CF_NONE)
|
||||
fs = fs->parent;
|
||||
|
||||
/* fs must be non-NULL since the workspace con doesn’t have CF_NONE and
|
||||
* there always has to be a workspace con in the hierarchy. */
|
||||
assert(fs != NULL);
|
||||
/* The most common case is we hit the workspace level. In this
|
||||
* situation, changing focus is also harmless. */
|
||||
assert(fs->fullscreen_mode != CF_NONE);
|
||||
|
|
|
@ -493,7 +493,7 @@ void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
|
|||
confine_to, border_t border, callback_t callback, const void *extra)
|
||||
{
|
||||
uint32_t new_x, new_y;
|
||||
Rect old_rect;
|
||||
Rect old_rect = { 0, 0, 0, 0 };
|
||||
if (con != NULL)
|
||||
memcpy(&old_rect, &(con->rect), sizeof(Rect));
|
||||
|
||||
|
|
|
@ -758,7 +758,7 @@ static int add_subscription(void *extra, const unsigned char *s,
|
|||
#endif
|
||||
ipc_client *client = extra;
|
||||
|
||||
DLOG("should add subscription to extra %p, sub %.*s\n", client, len, s);
|
||||
DLOG("should add subscription to extra %p, sub %.*s\n", client, (int)len, s);
|
||||
int event = client->num_events;
|
||||
|
||||
client->num_events++;
|
||||
|
|
|
@ -291,7 +291,7 @@ void handle_key_press(xcb_key_press_event_t *event) {
|
|||
command_failed = false;
|
||||
yajl_status state = yajl_parse(handle, reply, length);
|
||||
if (state != yajl_status_ok) {
|
||||
ELOG("Could not parse my own reply. That's weird. reply is %.*s\n", length, reply);
|
||||
ELOG("Could not parse my own reply. That's weird. reply is %.*s\n", (int)length, reply);
|
||||
} else {
|
||||
if (command_failed)
|
||||
start_commanderror_nagbar();
|
||||
|
|
|
@ -139,7 +139,7 @@ static int json_string(void *ctx, const unsigned char *val, size_t len) {
|
|||
#else
|
||||
static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
|
||||
#endif
|
||||
LOG("string: %.*s for key %s\n", len, val, last_key);
|
||||
LOG("string: %.*s for key %s\n", (int)len, val, last_key);
|
||||
if (parsing_swallows) {
|
||||
/* TODO: the other swallowing keys */
|
||||
if (strcasecmp(last_key, "class") == 0) {
|
||||
|
|
|
@ -424,7 +424,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
optind++;
|
||||
}
|
||||
LOG("Command is: %s (%d bytes)\n", payload, strlen(payload));
|
||||
DLOG("Command is: %s (%zd bytes)\n", payload, strlen(payload));
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH");
|
||||
if (!socket_path) {
|
||||
ELOG("Could not get i3 IPC socket path\n");
|
||||
|
@ -660,7 +660,6 @@ int main(int argc, char *argv[]) {
|
|||
Output *output = NULL;
|
||||
if (!(pointerreply = xcb_query_pointer_reply(conn, pointercookie, NULL))) {
|
||||
ELOG("Could not query pointer position, using first screen\n");
|
||||
output = get_first_output();
|
||||
} else {
|
||||
DLOG("Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
|
||||
output = get_output_containing(pointerreply->root_x, pointerreply->root_y);
|
||||
|
|
Loading…
Reference in New Issue