/* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */
- while ((walk - input) <= len) {
+ while ((size_t)(walk - input) <= len) {
/* Skip whitespace before every token, newlines are relevant since they
* separate configuration directives. */
while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
int main(int argc, char *argv[]) {
socket_path = getenv("I3SOCK");
int o, option_index = 0;
- int message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
+ uint32_t message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
char *payload = NULL;
bool quiet = false;
uint32_t top_end_x;
uint32_t bottom_start_x;
uint32_t bottom_end_x;
- } __attribute__((__packed__)) strut_partial = {0,};
+ } __attribute__((__packed__)) strut_partial = {};
strut_partial.top = font.height + 6;
strut_partial.top_start_x = 0;
#include "common.h"
/* Global variables for child_*() */
-i3bar_child child = { 0 };
+i3bar_child child = {};
/* stdin- and sigchild-watchers */
ev_io *stdin_io;
const size_t len = namelen + strlen("workspace \"\"") + 1;
char *buffer = scalloc(len+num_quotes);
strncpy(buffer, "workspace \"", strlen("workspace \""));
- int inpos, outpos;
+ size_t inpos, outpos;
for (inpos = 0, outpos = strlen("workspace \"");
inpos < namelen;
inpos++, outpos++) {
uint32_t top_end_x;
uint32_t bottom_start_x;
uint32_t bottom_end_x;
- } __attribute__((__packed__)) strut_partial = {0,};
+ } __attribute__((__packed__)) strut_partial = {};
switch (config.position) {
case POS_NONE:
break;
outputs_walk->bargc,
MAX(0, (int16_t)(statusline_width - outputs_walk->rect.w + 4)), 0,
MAX(0, (int16_t)(outputs_walk->rect.w - statusline_width - traypx - 4)), 3,
- MIN(outputs_walk->rect.w - traypx - 4, statusline_width), font.height + 2);
+ MIN(outputs_walk->rect.w - traypx - 4, (int)statusline_width), font.height + 2);
}
if (!config.disable_ws) {
* if there is no output which contains these coordinates.
*
*/
-Output *get_output_containing(int x, int y);
+Output *get_output_containing(unsigned int x, unsigned int y);
/*
* In contained_by_output, we check if any active output contains part of the container.
#endif
ssize_t linksize;
- while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) {
+ while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size);
}
.type = message_type
};
- int sent_bytes = 0;
+ size_t sent_bytes = 0;
int n = 0;
/* This first loop is basically unnecessary. No operating system has
continue;
bool skip = false;
- for (int c = 0; c < window->nr_assignments; c++) {
+ for (uint32_t c = 0; c < window->nr_assignments; c++) {
if (window->ran_assignments[c] != current)
continue;
return tiling_resize_for_border(con, BORDER_TOP, event);
}
- if (event->event_x >= 0 && event->event_x <= bsr.x &&
- event->event_y >= bsr.y && event->event_y <= con->rect.height + bsr.height)
+ if (event->event_x >= 0 && event->event_x <= (int32_t)bsr.x &&
+ event->event_y >= (int32_t)bsr.y && event->event_y <= (int32_t)(con->rect.height + bsr.height))
return tiling_resize_for_border(con, BORDER_LEFT, event);
- if (event->event_x >= (con->window_rect.x + con->window_rect.width) &&
- event->event_y >= bsr.y && event->event_y <= con->rect.height + bsr.height)
+ if (event->event_x >= (int32_t)(con->window_rect.x + con->window_rect.width) &&
+ event->event_y >= (int32_t)bsr.y && event->event_y <= (int32_t)(con->rect.height + bsr.height))
return tiling_resize_for_border(con, BORDER_RIGHT, event);
- if (event->event_y >= (con->window_rect.y + con->window_rect.height))
+ if (event->event_y >= (int32_t)(con->window_rect.y + con->window_rect.height))
return tiling_resize_for_border(con, BORDER_BOTTOM, event);
return false;
/* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */
- while ((walk - input) <= len) {
+ while ((size_t)(walk - input) <= len) {
/* skip whitespace and newlines before every token */
while ((*walk == ' ' || *walk == '\t' ||
*walk == '\r' || *walk == '\n') && *walk != '\0')
}
xcb_keycode_t *walk = bind->translated_to;
- for (int i = 0; i < bind->number_keycodes; i++)
+ for (uint32_t i = 0; i < bind->number_keycodes; i++)
grab_keycode_for_binding(conn, bind, *walk++);
}
}
return NULL;
}
-static const long get_long(const char *identifier) {
+static long get_long(const char *identifier) {
for (int c = 0; c < 10; c++) {
if (stack[c].identifier == NULL)
break;
/* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */
- while ((walk - input) <= len) {
+ while ((size_t)(walk - input) <= len) {
/* Skip whitespace before every token, newlines are relevant since they
* separate configuration directives. */
while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
y(map_close);
/* Skip the rest of this line, but continue parsing. */
- while ((walk - input) <= len && *walk != '\n')
+ while ((size_t)(walk - input) <= len && *walk != '\n')
walk++;
free(position);
sasprintf(&exepath, "/proc/%d/exe", getpid());
- while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) {
+ while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size);
}
free(exepath);
sasprintf(&exepath, "/proc/%s/exe", pid_from_atom);
- while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) {
+ while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size);
}
* Looks in outputs for the Output whose start coordinates are x, y
*
*/
-static Output *get_screen_at(int x, int y) {
+static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)
* a bitmask of the nearest borders (BORDER_LEFT, BORDER_RIGHT, …) */
border_t corner = 0;
- if (event->event_x <= (con->rect.width / 2))
+ if (event->event_x <= (int16_t)(con->rect.width / 2))
corner |= BORDER_LEFT;
else corner |= BORDER_RIGHT;
int cursor = 0;
- if (event->event_y <= (con->rect.height / 2)) {
+ if (event->event_y <= (int16_t)(con->rect.height / 2)) {
corner |= BORDER_TOP;
cursor = (corner & BORDER_LEFT) ?
XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER;
struct property_handler_t *handler = NULL;
xcb_get_property_reply_t *propr = NULL;
- for (int c = 0; c < sizeof(property_handlers) / sizeof(struct property_handler_t); c++) {
+ for (size_t c = 0; c < sizeof(property_handlers) / sizeof(struct property_handler_t); c++) {
if (property_handlers[c].atom != atom)
continue;
/* If there is no space for the current message in the ringbuffer, we
* need to wrap and write to the beginning again. */
- if (len >= (logbuffer_size - (logwalk - logbuffer))) {
+ if (len >= (size_t)(logbuffer_size - (logwalk - logbuffer))) {
loglastwrap = logwalk;
logwalk = logbuffer + sizeof(i3_shmlog_header);
store_log_markers();
cwindow->dock = W_DOCK_BOTTOM;
} else {
DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n");
- if (geom->y < (search_at->rect.height / 2)) {
+ if (geom->y < (int16_t)(search_at->rect.height / 2)) {
DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n",
geom->y, (search_at->rect.height / 2));
cwindow->dock = W_DOCK_TOP;
* if there is no output which contains these coordinates.
*
*/
-Output *get_output_containing(int x, int y) {
+Output *get_output_containing(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active)
return NULL;
}
- int written = 0;
+ size_t written = 0;
while (written < length) {
int n = write(fd, payload + written, length - written);
/* TODO: correct error-handling */
}
written += n;
#if YAJL_MAJOR >= 2
- printf("written: %d of %zd\n", written, length);
+ DLOG("written: %zd of %zd\n", written, length);
#else
- printf("written: %d of %d\n", written, length);
+ DLOG("written: %d of %d\n", written, length);
#endif
}
close(fd);
FREE(win->class_class);
win->class_instance = sstrdup(new_class);
- if ((strlen(new_class) + 1) < xcb_get_property_value_length(prop))
+ if ((strlen(new_class) + 1) < (size_t)xcb_get_property_value_length(prop))
win->class_class = sstrdup(new_class + strlen(new_class) + 1);
else win->class_class = NULL;
LOG("WM_CLASS changed to %s (instance), %s (class)\n",
* Looks in outputs for the Output whose start coordinates are x, y
*
*/
-static Output *get_screen_at(int x, int y) {
+static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)