diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-08 14:45:55 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-08 14:45:55 +0000 |
commit | fdfe5b42f687fbf3d4537541cc1b0bd9b8c2c090 (patch) | |
tree | 81d199b6fbbb11d3f310668e5bdabf9129e5f41f /src/recode.c | |
parent | 232dbc756390d30a86ae6de0cc84600eddb1c0b2 (diff) | |
download | librcc-fdfe5b42f687fbf3d4537541cc1b0bd9b8c2c090.tar.gz librcc-fdfe5b42f687fbf3d4537541cc1b0bd9b8c2c090.tar.bz2 librcc-fdfe5b42f687fbf3d4537541cc1b0bd9b8c2c090.tar.xz librcc-fdfe5b42f687fbf3d4537541cc1b0bd9b8c2c090.zip |
08.07.2005
Diffstat (limited to 'src/recode.c')
-rw-r--r-- | src/recode.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/recode.c b/src/recode.c index 4c1c5bd..f071f33 100644 --- a/src/recode.c +++ b/src/recode.c @@ -8,6 +8,7 @@ #include "lng.h" #include "rccstring.h" #include "rccconfig.h" +#include "rccdb4.h" @@ -20,8 +21,8 @@ static rcc_charset_id rccIConvAuto(rcc_context ctx, rcc_class_id class_id, const class_type = rccGetClassType(ctx, class_id); if ((class_type == RCC_CLASS_STANDARD)||((class_type == RCC_CLASS_FS)&&(rccGetOption(ctx, RCC_AUTODETECT_FS_TITLES)))) { - engine = rccGetEnginePointer(ctx, rccGetCurrentEngine(ctx)); - if ((!engine)||(!engine->func)||(!strcasecmp(engine->title, "off"))||(!strcasecmp(engine->title, "dissable"))) return -1; + engine = rccGetCurrentEnginePointer(ctx); + if ((!engine)||(!engine->func)) return (rcc_charset_id)-1; return engine->func(&ctx->engine_ctx, buf, len); } @@ -42,6 +43,13 @@ rcc_string rccFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, size } if ((class_id<0)||(class_id>=ctx->n_classes)||(!buf)) return NULL; + + string = rccDb4GetKey(ctx->db4ctx, buf, len); + if (string) { + puts("Got a string"); + return string; + } + err = rccConfigure(ctx); if (err) return NULL; @@ -50,7 +58,7 @@ rcc_string rccFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, size if (ret) return NULL; language_id = rccGetCurrentLanguage(ctx); - // DS: Learning. check database (language_id) + // DS: Learning. check database (language_id, check if language_id initialized) charset_id = rccIConvAuto(ctx, class_id, buf, len); if (charset_id != (rcc_charset_id)-1) icnv = ctx->iconv_auto[charset_id]; @@ -96,8 +104,10 @@ char *rccTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, size_t language_id = rccStringGetLanguage(buf); utfstring = rccStringGetString(buf); + /* COnfigure is only required in case of current language */ err = rccConfigure(ctx); if (err) return NULL; + /* Do something even in case of error (Language can be changed) */ icnv = ctx->iconv_to[class_id]; |