fix a few warnings/places where the clang static analyzer complains

This commit is contained in:
Michael Stapelberg
2012-08-05 16:34:38 +02:00
parent cab8e3c46f
commit 8a1c8115ca
9 changed files with 20 additions and 22 deletions

View File

@ -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);

View File

@ -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 doesnt 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);

View File

@ -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));

View File

@ -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++;

View File

@ -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();

View File

@ -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) {

View File

@ -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);