diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-21 10:56:56 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-21 10:56:56 -0400 |
commit | 034358dbfd07e013417bafcbcc819ddad90a2f21 (patch) | |
tree | f31d5042629c27a6fbba0cb73f2b93433dce247a /sway | |
parent | 7ecb55f218666ec5c30371eeb9e5982a487fdb4b (diff) | |
parent | 8dfaf6265be52a582cc990f4332808d55063766f (diff) |
Merge pull request #110 from minus7/sign-comparsion-fix
fixed #108 signed/unsigned comparison
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 4 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/ipc.c | 8 | ||||
-rw-r--r-- | sway/layout.c | 2 | ||||
-rw-r--r-- | sway/log.c | 12 |
5 files changed, 16 insertions, 12 deletions
diff --git a/sway/commands.c b/sway/commands.c index cb96703e..e90a40a3 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -106,7 +106,7 @@ static bool cmd_bindsym(struct sway_config *config, int argc, char **argv) { // Check for a modifier key int j; bool is_mod = false; - for (j = 0; j < sizeof(modifiers) / sizeof(struct modifier_key); ++j) { + for (j = 0; j < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++j) { if (strcasecmp(modifiers[j].name, split->items[i]) == 0) { binding->modifiers |= modifiers[j].mod; is_mod = true; @@ -261,7 +261,7 @@ static bool cmd_floating_mod(struct sway_config *config, int argc, char **argv) // set modifer keys for (i = 0; i < split->length; ++i) { - for (j = 0; j < sizeof(modifiers) / sizeof(struct modifier_key); ++j) { + for (j = 0; j < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++j) { if (strcasecmp(modifiers[j].name, split->items[i]) == 0) { config->floating_mod |= modifiers[j].mod; } diff --git a/sway/config.c b/sway/config.c index 0afb0205..1ebd95ff 100644 --- a/sway/config.c +++ b/sway/config.c @@ -107,7 +107,7 @@ static char *get_config_path() { char *test = NULL; int i; - for (i = 0; i < sizeof(search_paths) / sizeof(char *); ++i) { + for (i = 0; i < (int)(sizeof(search_paths) / sizeof(char *)); ++i) { test = strdup(search_paths[i]); test = do_var_replacement(temp_config, test); sway_log(L_DEBUG, "Checking for config at %s", test); @@ -121,11 +121,15 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { } int read_available; - ioctl(client_fd, FIONREAD, &read_available); + if (ioctl(client_fd, FIONREAD, &read_available) == -1) { + sway_log_errno(L_INFO, "Unable to read IPC socket buffer size"); + ipc_client_disconnect(client); + return 0; + } // Wait for the rest of the command payload in case the header has already been read if (client->payload_length > 0) { - if (read_available >= client->payload_length) { + if ((uint32_t)read_available >= client->payload_length) { ipc_client_handle_command(client); } else { diff --git a/sway/layout.c b/sway/layout.c index 7eaa9ea4..573c6f70 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -114,7 +114,7 @@ void move_container(swayc_t *container,swayc_t* root,enum movement_direction dir sway_log(L_DEBUG, "Moved window"); swayc_t *temp; int i; - uint clength = root->children->length; + int clength = root->children->length; //Rearrange for (i = 0; i < clength; ++i) { swayc_t *child = root->children->items[i]; @@ -10,7 +10,7 @@ #include <string.h> int colored = 1; -int v = 0; +log_importance_t v = L_SILENT; static const char *verbosity_colors[] = { "", // L_SILENT @@ -19,7 +19,7 @@ static const char *verbosity_colors[] = { "\x1B[1;30m", // L_DEBUG }; -void init_log(int verbosity) { +void init_log(log_importance_t verbosity) { v = verbosity; /* set FD_CLOEXEC flag to prevent programs called with exec to write into logs */ int i; @@ -46,9 +46,9 @@ void sway_abort(const char *format, ...) { sway_terminate(); } -void sway_log(int verbosity, const char* format, ...) { +void sway_log(log_importance_t verbosity, const char* format, ...) { if (verbosity <= v) { - int c = verbosity; + unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *)) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } @@ -69,9 +69,9 @@ void sway_log(int verbosity, const char* format, ...) { } } -void sway_log_errno(int verbosity, char* format, ...) { +void sway_log_errno(log_importance_t verbosity, char* format, ...) { if (verbosity <= v) { - int c = verbosity; + unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *)) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } |