MCPcopy Create free account
hub / github.com/MariaDB/server / json_unescape

Function json_unescape

strings/json_lib.c:1788–1813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1786
1787
1788int json_unescape(CHARSET_INFO *json_cs,
1789 const uchar *json_str, const uchar *json_end,
1790 CHARSET_INFO *res_cs, uchar *res, uchar *res_end)
1791{
1792 json_string_t s;
1793 const uchar *res_b= res;
1794
1795 json_string_setup(&s, json_cs, json_str, json_end);
1796 while (json_read_string_const_chr(&s) == 0)
1797 {
1798 int c_len;
1799 if ((c_len= my_ci_wc_mb(res_cs, s.c_next, res, res_end)) > 0)
1800 {
1801 res+= c_len;
1802 continue;
1803 }
1804 if (c_len == MY_CS_ILUNI)
1805 {
1806 return JSON_ERROR_ILLEGAL_SYMBOL;
1807 }
1808 /* Result buffer is too small. */
1809 return JSON_ERROR_OUT_OF_SPACE;
1810 }
1811
1812 return s.error==JE_EOS ? (int)(res - res_b) : JSON_ERROR_OUT_OF_SPACE;
1813}
1814
1815
1816/* When we need to replace a character with the escaping. */

Callers 8

json_unescape_jsonFunction · 0.85
json_unescape_to_stringFunction · 0.85
st_append_jsonFunction · 0.85
val_strMethod · 0.85
get_str_valueMethod · 0.85

Calls 2

json_string_setupFunction · 0.85

Tested by

no test coverage detected