diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-29 03:26:28 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-29 03:26:28 +0000 |
commit | e3f702e83a26468ee44f3f342a7a40a252f4603c (patch) | |
tree | 5ff76e9d11a9fdbdb493683d0f0840f46c67b6f8 /src/rcciconv.c | |
parent | cfaef1b6c9f33fbaa114628cf513d129bdff3c1c (diff) | |
download | librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.gz librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.bz2 librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.xz librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.zip |
Translation
- Language Translation using libtranslate is implemented
- Autoengine sets current charset (option)
Diffstat (limited to 'src/rcciconv.c')
-rw-r--r-- | src/rcciconv.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/rcciconv.c b/src/rcciconv.c index 65b32b3..d9903de 100644 --- a/src/rcciconv.c +++ b/src/rcciconv.c @@ -92,7 +92,28 @@ loop: return outsize - out_left; } -size_t rccIConv(rcc_context ctx, rcc_iconv icnv, const char *buf, size_t len) { +char *rccIConv(rcc_iconv icnv, const char *buf, size_t len, size_t *rlen) { + char *res; + size_t size; + char tmpbuffer[RCC_MAX_STRING_CHARS+1]; + + size = rccIConvRecode(icnv, tmpbuffer, RCC_MAX_STRING_CHARS, buf, len); + if (size != (size_t)-1) { + res = (char*)malloc((size+1)*sizeof(char)); + if (!res) return res; + + if (rlen) *rlen = size; + memcpy(res, tmpbuffer, size); + res[size] = 0; + + return res; + } + + return NULL; +} + +size_t rccIConvInternal(rcc_context ctx, rcc_iconv icnv, const char *buf, size_t len) { if (!ctx) return (size_t)-1; return rccIConvRecode(icnv, ctx->tmpbuffer, RCC_MAX_STRING_CHARS, buf, len); } + |