From 4d7634da9e47435c6e2758078377dd64a341bed9 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 5 Jul 2015 23:26:40 -0700 Subject: [PATCH] GUAC-1172: Remove use of stdbool.h and bool from guac_json - FreeRDP is not compatible with use of the standard bool. --- src/common/guac_json.c | 16 ++++++++-------- src/common/guac_json.h | 18 ++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/common/guac_json.c b/src/common/guac_json.c index 2125906c..4359d89c 100644 --- a/src/common/guac_json.c +++ b/src/common/guac_json.c @@ -48,10 +48,10 @@ void guac_common_json_flush(guac_client* client, guac_stream* stream, } -bool guac_common_json_write(guac_client* client, guac_stream* stream, +int guac_common_json_write(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* buffer, int length) { - bool blob_written = false; + int blob_written = 0; /* * Append to and flush the JSON buffer as necessary to write the given @@ -67,7 +67,7 @@ bool guac_common_json_write(guac_client* client, guac_stream* stream, /* Flush if more room is needed */ if (json_state->size + blob_length > sizeof(json_state->buffer)) { guac_common_json_flush(client, stream, json_state); - blob_written = true; + blob_written = 1; } /* Append data to JSON buffer */ @@ -86,11 +86,11 @@ bool guac_common_json_write(guac_client* client, guac_stream* stream, } -bool guac_common_json_write_string(guac_client* client, +int guac_common_json_write_string(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* str) { - bool blob_written = false; + int blob_written = 0; /* Write starting quote */ blob_written |= guac_common_json_write(client, stream, @@ -132,11 +132,11 @@ bool guac_common_json_write_string(guac_client* client, } -bool guac_common_json_write_property(guac_client* client, guac_stream* stream, +int guac_common_json_write_property(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* name, const char* value) { - bool blob_written = false; + int blob_written = 0; /* Write leading comma if not first property */ if (json_state->properties_written != 0) @@ -173,7 +173,7 @@ void guac_common_json_begin_object(guac_client* client, guac_stream* stream, } -bool guac_common_json_end_object(guac_client* client, guac_stream* stream, +int guac_common_json_end_object(guac_client* client, guac_stream* stream, guac_common_json_state* json_state) { /* Write final brace of JSON object */ diff --git a/src/common/guac_json.h b/src/common/guac_json.h index 4bab9684..6e0d82d8 100644 --- a/src/common/guac_json.h +++ b/src/common/guac_json.h @@ -25,8 +25,6 @@ #include "config.h" -#include - #include #include @@ -97,9 +95,9 @@ void guac_common_json_flush(guac_client* client, guac_stream* stream, * The number of bytes in the buffer. * * @return - * true if at least one blob was written, false otherwise. + * Non-zero if at least one blob was written, zero otherwise. */ -bool guac_common_json_write(guac_client* client, guac_stream* stream, +int guac_common_json_write(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* buffer, int length); /** @@ -123,9 +121,9 @@ bool guac_common_json_write(guac_client* client, guac_stream* stream, * The string to write. * * @return - * true if at least one blob was written, false otherwise. + * Non-zero if at least one blob was written, zero otherwise. */ -bool guac_common_json_write_string(guac_client* client, +int guac_common_json_write_string(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* str); @@ -152,9 +150,9 @@ bool guac_common_json_write_string(guac_client* client, * The value of the property to write. * * @return - * true if at least one blob was written, false otherwise. + * Non-zero if at least one blob was written, zero otherwise. */ -bool guac_common_json_write_property(guac_client* client, guac_stream* stream, +int guac_common_json_write_property(guac_client* client, guac_stream* stream, guac_common_json_state* json_state, const char* name, const char* value); @@ -192,9 +190,9 @@ void guac_common_json_begin_object(guac_client* client, guac_stream* stream, * The state object whose in-progress JSON object should be terminated. * * @return - * true if at least one blob was written, false otherwise. + * Non-zero if at least one blob was written, zero otherwise. */ -bool guac_common_json_end_object(guac_client* client, guac_stream* stream, +int guac_common_json_end_object(guac_client* client, guac_stream* stream, guac_common_json_state* json_state); #endif