Adding basic support for length delimited strings#889
Open
ste-lam wants to merge 1 commit intoDaveGamble:masterfrom
Open
Adding basic support for length delimited strings#889ste-lam wants to merge 1 commit intoDaveGamble:masterfrom
ste-lam wants to merge 1 commit intoDaveGamble:masterfrom
Conversation
e432da0 to
755622d
Compare
- cJSON_CreateRawWithLength: create a cJSON_Raw from a length limited input string - cJSON_CreateStringWithLength: create a cJSON_String from a length limited input string
5c89f9b to
f3a3201
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds basic support for applications that do not use c-strings but length delimited strings.
Here you need to create a temporary c-string copy to transfer the string to cjson.
To avoid this superfluous temporary copy, this PR adds two new public functions (with new tests):
JSON_AddXToObject functions have intentionally not been added.
Nullbytes within length-limited strings are still interpreted as null-termination, which is limitation as long as cjson uses c-strings internally.