From 537c4b33fdf6e143243d5a0d286eeb247362e806 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 18 Jul 2005 15:22:28 +0000 Subject: API Improvements - Removed 'rlen' return parameters there not necessary for multibyte encodings - Two versions of recode functions: rccRecode -> rccRecode, rccSizedRecode - Class Types: CONST, SKIP_SAVELOAD - New recode functions: rccToCharset, rccFromCharset - More new recode functions: rccRecodeToCharset, rccRecodeFromCharset, rccRecodeCharsets - New function: rccGetCompiledConfiguration - All warnings are fixed - Perform "File Name" search only if there are non ISO8859-1 chars in the name. - Do not copy invalid characters, - skip them. - Fixed error in rccRecode with 'Recoding Cache' switched On. - Strip leading and trailing spaces in rccDB4 get/set --- src/rccenca.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/rccenca.c') diff --git a/src/rccenca.c b/src/rccenca.c index 8a439bc..8263742 100644 --- a/src/rccenca.c +++ b/src/rccenca.c @@ -1,4 +1,5 @@ #include +#include #include "internal.h" #include "plugin.h" @@ -14,7 +15,9 @@ # endif /* RCC_ENCA_DYNAMIC */ #endif /* RCC_ENCA_SUPPORT */ +#ifdef RCC_ENCA_DYNAMIC static rcc_library_handle enca_handle = NULL; +#endif /* RCC_ENCA_DYNAMIC */ static rcc_engine *enca_engines = NULL; rcc_engine_internal rccEncaInitContext(rcc_engine_context ctx) { @@ -49,7 +52,7 @@ void rccEncaFreeContext(rcc_engine_context ctx) { #endif /* RCC_ENCA_SUPPORT */ } -rcc_charset_id rccEnca(rcc_engine_context ctx, const char *buf, int len) { +rcc_autocharset_id rccEnca(rcc_engine_context ctx, const char *buf, int len) { #ifdef RCC_ENCA_SUPPORT rcc_engine_internal internal; const char *charset; @@ -58,9 +61,7 @@ rcc_charset_id rccEnca(rcc_engine_context ctx, const char *buf, int len) { internal = rccEngineGetInternal(ctx); if ((!internal)||(!buf)) return (rcc_charset_id)-1; - len = STRNLEN(buf, len); - - ee = enca_analyse_const((EncaAnalyser)ctx->internal,buf,len); + ee = enca_analyse_const((EncaAnalyser)ctx->internal,buf,len?len:strlen(buf)); if (ee.charset<0) return (rcc_charset_id)-1; charset = enca_charset_name(ee.charset, ENCA_NAME_STYLE_ICONV); -- cgit v1.2.3