Skip to content

Commit

Permalink
Fix wconversion with old gcc (e.g. 4.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
FSMaxB committed Mar 18, 2017
1 parent 4ec6e76 commit 466eb8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ static cJSON_bool print_array(const cJSON * const item, const size_t depth, cons
update_offset(output_buffer);
if (current_element->next)
{
length = format ? 2 : 1;
length = (size_t) (format ? 2 : 1);
output_pointer = ensure(output_buffer, length + 1, hooks);
if (output_pointer == NULL)
{
Expand Down Expand Up @@ -1362,7 +1362,7 @@ static cJSON_bool print_object(const cJSON * const item, const size_t depth, con
}

/* Compose the output: */
length = format ? 2 : 1; /* fmt: {\n */
length = (size_t) (format ? 2 : 1); /* fmt: {\n */
output_pointer = ensure(output_buffer, length + 1, hooks);
if (output_pointer == NULL)
{
Expand Down Expand Up @@ -1400,7 +1400,7 @@ static cJSON_bool print_object(const cJSON * const item, const size_t depth, con
}
update_offset(output_buffer);

length = format ? 2 : 1;
length = (size_t) (format ? 2 : 1);
output_pointer = ensure(output_buffer, length, hooks);
if (output_pointer == NULL)
{
Expand All @@ -1421,7 +1421,7 @@ static cJSON_bool print_object(const cJSON * const item, const size_t depth, con
update_offset(output_buffer);

/* print comma if not last */
length = (size_t) (format ? 1 : 0) + (current_item->next ? 1 : 0);
length = (size_t) ((format ? 1 : 0) + (current_item->next ? 1 : 0));
output_pointer = ensure(output_buffer, length + 1, hooks);
if (output_pointer == NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions cJSON_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ static void cJSONUtils_InplaceDecodePointerString(unsigned char *string)

for (; *string; (void)s2++, string++)
{
*s2 = (*string != '~')
*s2 = (unsigned char) ((*string != '~')
? (*string)
: ((*(++string) == '0')
? '~'
: '/');
: '/'));
}

*s2 = '\0';
Expand Down

0 comments on commit 466eb8e

Please sign in to comment.