fix -Wmaybe-unused and -Wstringop-truncation warnings
This commit is contained in:
parent
d06e87eb8d
commit
8fe28d1a95
@ -340,8 +340,9 @@ int i3_send_msg(uint32_t type, const char *payload) {
|
||||
memcpy(walk, &type, sizeof(uint32_t));
|
||||
walk += sizeof(uint32_t);
|
||||
|
||||
if (payload != NULL)
|
||||
strncpy(walk, payload, len);
|
||||
if (payload != NULL) {
|
||||
memcpy(walk, payload, len);
|
||||
}
|
||||
|
||||
swrite(i3_connection->fd, buffer, to_write);
|
||||
|
||||
|
@ -39,6 +39,9 @@ static bool tiling_resize_for_border(Con *con, border_t border, xcb_button_press
|
||||
case BORDER_BOTTOM:
|
||||
search_direction = D_DOWN;
|
||||
break;
|
||||
default:
|
||||
ELOG("BUG: invalid border value %d\n", border);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = resize_find_tiling_participants(&first, &second, search_direction, false);
|
||||
|
@ -1325,7 +1325,7 @@ void cmd_focus_direction(I3_CMD, const char *direction_str) {
|
||||
HANDLE_EMPTY_MATCH;
|
||||
CMD_FOCUS_WARN_CHILDREN;
|
||||
|
||||
direction_t direction;
|
||||
direction_t direction = D_LEFT;
|
||||
position_t position;
|
||||
bool auto_direction = true;
|
||||
if (strcmp(direction_str, "prev") == 0) {
|
||||
|
@ -919,7 +919,7 @@ parse_file_result_t parse_file(struct parser_ctx *ctx, const char *f, IncludedFi
|
||||
continuation = NULL;
|
||||
}
|
||||
|
||||
strncpy(buf + strlen(buf), buffer, strlen(buffer) + 1);
|
||||
strcpy(buf + strlen(buf), buffer);
|
||||
|
||||
/* Skip comments and empty lines. */
|
||||
if (skip_line || comment) {
|
||||
@ -1043,7 +1043,7 @@ parse_file_result_t parse_file(struct parser_ctx *ctx, const char *f, IncludedFi
|
||||
} else {
|
||||
/* Copy until the next variable, then copy its value */
|
||||
strncpy(destwalk, walk, distance);
|
||||
strncpy(destwalk + distance, nearest->value, strlen(nearest->value));
|
||||
strcpy(destwalk + distance, nearest->value);
|
||||
walk += distance + strlen(nearest->key);
|
||||
destwalk += distance + strlen(nearest->value);
|
||||
}
|
||||
|
@ -340,6 +340,11 @@ int sd_notify(int unset_environment, const char *state) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (strlen(e) > sizeof(sockaddr.un.sun_path)) {
|
||||
r = -EINVAL;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
@ -347,7 +352,7 @@ int sd_notify(int unset_environment, const char *state) {
|
||||
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sa.sa_family = AF_UNIX;
|
||||
strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
|
||||
strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path) - 1);
|
||||
|
||||
if (sockaddr.un.sun_path[0] == '@')
|
||||
sockaddr.un.sun_path[0] = 0;
|
||||
|
3
src/x.c
3
src/x.c
@ -731,6 +731,9 @@ void x_draw_decoration(Con *con) {
|
||||
/* Make sure the icon does not escape title boundaries */
|
||||
icon_offset_x = min(deco_width - icon_size - icon_padding - title_padding, title_offset_x + predict_text_width(title) + icon_padding);
|
||||
break;
|
||||
default:
|
||||
ELOG("BUG: invalid config.title_align value %d\n", config.title_align);
|
||||
return;
|
||||
}
|
||||
|
||||
draw_util_text(title, dest_surface,
|
||||
|
Loading…
x
Reference in New Issue
Block a user