| 985 | } |
| 986 | |
| 987 | int cJSON_PrintFlushed(cJSON *item, char *buf, const int len, const int fmt, flush_fn *func, void *param) |
| 988 | { |
| 989 | printbuffer p; |
| 990 | int ret; |
| 991 | |
| 992 | if (len < 0) |
| 993 | { |
| 994 | return false; |
| 995 | } |
| 996 | |
| 997 | memset(&p, 0, sizeof(p)); |
| 998 | p.buffer = (unsigned char*)buf; |
| 999 | p.length = (size_t)len; |
| 1000 | p.offset = 0; |
| 1001 | p.noalloc = true; |
| 1002 | p.flush = func; |
| 1003 | p.flush_p = param; |
| 1004 | ret = (print_value(item, 0, fmt, &p) != NULL); |
| 1005 | if (!ret || !p.offset) |
| 1006 | return ret; |
| 1007 | /* flush everything in the end */ |
| 1008 | return (p.flush)(p.buffer, p.offset + 1/* last } */, p.flush_p) > 0; |
| 1009 | } |
| 1010 | |
| 1011 | /* Parser core - when encountering text, process appropriately. */ |
| 1012 | static const unsigned char *parse_value(cJSON *item, const unsigned char *value, const unsigned char **ep) |
no test coverage detected