From: Tony Crisci Date: Fri, 15 Apr 2016 07:27:43 +0000 (-0400) Subject: Cast con id as uintptr_t (#2298) X-Git-Tag: 4.13~92 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F2293%2Fhead;p=i3%2Fi3 Cast con id as uintptr_t (#2298) Use `uintptr_t` to cast the con id to int instead of `long int`. This type is guaranteed to hold the pointer as an int regardless of platform. fixes #2283 --- diff --git a/src/commands.c b/src/commands.c index 405bb429..403c3b3a 100644 --- a/src/commands.c +++ b/src/commands.c @@ -9,6 +9,7 @@ * commands.c: all command functions (see commands_parser.c) * */ +#include #include #include @@ -1625,7 +1626,7 @@ void cmd_open(I3_CMD) { ystr("success"); y(bool, true); ystr("id"); - y(integer, (long int)con); + y(integer, (uintptr_t)con); y(map_close); cmd_output->needs_tree_render = true; diff --git a/src/ipc.c b/src/ipc.c index 566fe52a..2bd5f59d 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -12,6 +12,7 @@ #include "all.h" #include "yajl_utils.h" +#include #include #include #include @@ -217,7 +218,7 @@ static void dump_binding(yajl_gen gen, Binding *bind) { void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { y(map_open); ystr("id"); - y(integer, (long int)con); + y(integer, (uintptr_t)con); ystr("type"); switch (con->type) { @@ -444,7 +445,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { ystr("focus"); y(array_open); TAILQ_FOREACH(node, &(con->focus_head), focused) { - y(integer, (long int)node); + y(integer, (uintptr_t)node); } y(array_close);