diff options
Diffstat (limited to 'include/json_lib.h')
-rw-r--r-- | include/json_lib.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/json_lib.h b/include/json_lib.h index 6d802860cff..853c4a6f7fa 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -373,6 +373,9 @@ int json_find_paths_first(json_engine_t *je, json_find_paths_t *state, int json_find_paths_next(json_engine_t *je, json_find_paths_t *state); +#define JSON_ERROR_OUT_OF_SPACE (-1) +#define JSON_ERROR_ILLEGAL_SYMBOL (-2) + /* Converst JSON string constant into ordinary string constant which can involve unpacking json escapes and changing character set. @@ -385,10 +388,13 @@ int json_unescape(CHARSET_INFO *json_cs, uchar *res, uchar *res_end); /* - Converst ordinary string constant into JSON string constant. - which can involve appropriate escaping and changing character set. - Returns negative integer in the case of an error, - the length of the result otherwise. + Convert a string constant into JSON string constant. + This can involve appropriate escaping and changing the character set. + Returns the length of the result on success, + on error returns a negative error code. + Some error codes: + JSON_ERROR_OUT_OF_SPACE Not enough space in the provided buffer + JSON_ERROR_ILLEGAL_SYMBOL Source symbol cannot be represented in JSON */ int json_escape(CHARSET_INFO *str_cs, const uchar *str, const uchar *str_end, CHARSET_INFO *json_cs, uchar *json, uchar *json_end); |