diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2010-01-07 23:00:22 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2010-01-07 23:00:22 +0800 |
commit | 8e2d99abd7bb55112898bd90e3affb660b4915a0 (patch) | |
tree | ca216b6fde912109edadafe8ebefa0cbefaf306d /multibytecodec.c | |
parent | 601fa11a8eba8d032c1491f79d0974f24fba7613 (diff) |
uniconv: try to improve the interface
Diffstat (limited to 'multibytecodec.c')
-rw-r--r-- | multibytecodec.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/multibytecodec.c b/multibytecodec.c index 85d2e7f..58ee647 100644 --- a/multibytecodec.c +++ b/multibytecodec.c @@ -142,23 +142,26 @@ mbcs_decode_init(MultibyteCodecState *state) state->codec->decinit(&state->state, state->codec->config); } -void +int mbcs_decode_reset(MultibyteCodecState *state) { if (state->codec->decreset) - state->codec->decreset(&state->state, state->codec->config); + return state->codec->decreset(&state->state, + state->codec->config); + return 0; } int mbcs_encode(MultibyteCodecState *state, const ucs4_t** inbuf, size_t inlen, - char** outbuf, size_t outlen) + char** outbuf, size_t outlen, + int flags) { return state->codec->encode(&state->state, state->codec->config, inbuf, inlen, (unsigned char **)outbuf, outlen, - MBENC_FLUSH); + flags); } void @@ -168,11 +171,12 @@ mbcs_encode_init(MultibyteCodecState *state) state->codec->encinit(&state->state, state->codec->config); } -void +int mbcs_encode_reset(MultibyteCodecState *state, char **outbuf, int outleft) { if (state->codec->encreset) - state->codec->encreset(&state->state, state->codec->config, - (unsigned char **)outbuf, outleft); + return state->codec->encreset(&state->state, state->codec->config, + (unsigned char **)outbuf, outleft); + return 0; } |