From e194ed01ffd58d5c4087c14f1e4ddd4e8873106d Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 1 Jun 2020 09:09:40 +0000 Subject: [PATCH] added mio_jsonwr_writerawuchars() --- mio/lib/json.c | 21 ++++++++++++++++++++- mio/lib/mio-json.h | 23 +++++++++++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/mio/lib/json.c b/mio/lib/json.c index eb74fce..779b755 100644 --- a/mio/lib/json.c +++ b/mio/lib/json.c @@ -1148,8 +1148,27 @@ jsonwr->pretty = 1; return 0; } -int mio_jsonwr_writerawbytes (mio_jsonwr_t* jsonwr, const mio_uint8_t* dptr, mio_oow_t dlen) +int mio_jsonwr_writerawuchars (mio_jsonwr_t* jsonwr, const mio_uch_t* dptr, mio_oow_t dlen) +{ + WRITE_UCHARS (jsonwr, 0, dptr, dlen); + return 0; +} + +int mio_jsonwr_writerawucstr (mio_jsonwr_t* jsonwr, const mio_uch_t* dptr) +{ + WRITE_UCHARS (jsonwr, 0, dptr, mio_count_ucstr(dptr)); + return 0; +} + +int mio_jsonwr_writerawbchars (mio_jsonwr_t* jsonwr, const mio_bch_t* dptr, mio_oow_t dlen) { WRITE_BYTES_NOESC (jsonwr, dptr, dlen); return 0; } + +int mio_jsonwr_writerawbcstr (mio_jsonwr_t* jsonwr, const mio_bch_t* dptr) +{ + WRITE_BYTES_NOESC (jsonwr, dptr, mio_count_bcstr(dptr)); + return 0; +} + diff --git a/mio/lib/mio-json.h b/mio/lib/mio-json.h index f4d0af5..7e3e3dd 100644 --- a/mio/lib/mio-json.h +++ b/mio/lib/mio-json.h @@ -309,11 +309,26 @@ MIO_EXPORT int mio_jsonwr_write ( #define mio_jsonwr_writestringwithbcstr(jsonwr,dptr) mio_jsonwr_write(jsonwr, MIO_JSON_INST_STRING, 0, dptr, mio_count_bcstr(dptr)) +MIO_EXPORT int mio_jsonwr_writerawuchars ( + mio_jsonwr_t* jsonwr, + const mio_uch_t* dptr, + mio_oow_t dlen +); -MIO_EXPORT int mio_jsonwr_writerawbytes ( - mio_jsonwr_t* jsonwr, - const mio_uint8_t* dptr, - mio_oow_t dlen +MIO_EXPORT int mio_jsonwr_writerawucstr ( + mio_jsonwr_t* jsonwr, + const mio_uch_t* dptr +); + +MIO_EXPORT int mio_jsonwr_writerawbchars ( + mio_jsonwr_t* jsonwr, + const mio_bch_t* dptr, + mio_oow_t dlen +); + +MIO_EXPORT int mio_jsonwr_writerawbcstr ( + mio_jsonwr_t* jsonwr, + const mio_bch_t* dptr ); #if defined(__cplusplus)