Minor changes to build against json-c 0.13.x

I'm not convinced my change to CMakeLists is the correct way to squelch
the json-c version error when building on a system with version
numbers greater than 0.12.1. 0.13.x+ is supposed to be backwards
compatible. Rest of the changes involve replacing int with size_t
where necessary to suppress -Werror=sign-compare on gcc 8.
This commit is contained in:
Jae Jang 2018-04-06 20:59:28 -04:00
parent 8e06985cc1
commit 0ed0c824e9
6 changed files with 8 additions and 8 deletions

View file

@ -50,7 +50,7 @@ static json_object *get_focused_container_r(json_object *c) {
} else {
json_object *nodes, *node, *child;
json_object_object_get_ex(c, "nodes", &nodes);
int i;
size_t i;
for (i = 0; i < json_object_array_length(nodes); i++) {
node = json_object_array_get_idx(nodes, i);
@ -83,7 +83,7 @@ char *get_focused_output() {
if (!outputs) {
sway_abort("Unabled to get focused output. No nodes in tree.");
}
for (int i = 0; i < json_object_array_length(outputs); i++) {
for (size_t i = 0; i < json_object_array_length(outputs); i++) {
output = json_object_array_get_idx(outputs, i);
if (get_focused_container_r(output)) {
@ -131,7 +131,7 @@ json_object *get_output_container(const char *output) {
json_object *outputs, *json_output, *name;
json_object_object_get_ex(tree, "nodes", &outputs);
for (int i = 0; i < json_object_array_length(outputs); i++) {
for (size_t i = 0; i < json_object_array_length(outputs); i++) {
json_output = json_object_array_get_idx(outputs, i);
json_object_object_get_ex(json_output, "name", &name);