Skip to content

adding string length to string objects#470

Open
alljoynsville wants to merge 4 commits intoDaveGamble:masterfrom
alljoynsville:master
Open

adding string length to string objects#470
alljoynsville wants to merge 4 commits intoDaveGamble:masterfrom
alljoynsville:master

Conversation

@alljoynsville
Copy link

there is an isssue with the strings in this library.
on one hand when parsing the string it's parsed from " till "
on the other hand when you want to actually get the data it's aviable
but if you had something like this: "data\u0000\n" it's a problem since
the \0 is before the end of the string.
To solve the zero teminrated string i added an extra value
stringvalue_len that can be retrived using a function that holds the
length of the pased string. The length takes into account the parsing of
special escaped chars.

Eyal Gal added 3 commits May 24, 2020 20:38
there is an isssue with the strings in this library.
on one hand when parsing the string it's parsed from \" till \"
on the other hand when you want to actually get the data it's aviable
but if you had something like this: "data\u0000\n" it's a problem since
the \0 is before the end of the string.
To solve the zero teminrated string i added an extra value
stringvalue_len that can be retrived using a function that holds the
length of the pased string. The length takes into account the parsing of
special escaped chars.
/* The item's number, if type==cJSON_Number */
double valuedouble;

uint64_t valueint64;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the cJSON struct and add new feature of C99 is a break change, it will cause incompatibility with C89. I think it should be implemented in v2.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crap... the int64 is a temp feature i added since i need int64 support and i think it's implemented badly as i need it now and didn't have time to architect it properly.
i'll open a new PR without it, maybe from a side branch.
I was sure the PR will not change after a commit to the tip of the master :-\

@Alanscut Alanscut added this to the 2.0.0 milestone Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants