diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs.c | 1 | ||||
-rw-r--r-- | src/internal.h | 2 | ||||
-rw-r--r-- | src/librcc.c | 56 | ||||
-rw-r--r-- | src/librcc.h | 14 | ||||
-rw-r--r-- | src/lng.c | 2 | ||||
-rw-r--r-- | src/lngconfig.c | 4 | ||||
-rw-r--r-- | src/lngconfig.h | 4 | ||||
-rw-r--r-- | src/opt.c | 4 | ||||
-rw-r--r-- | src/rccconfig.c | 4 | ||||
-rw-r--r-- | src/rccenca.c | 7 | ||||
-rw-r--r-- | src/rcciconv.c | 72 | ||||
-rw-r--r-- | src/rcciconv.h | 6 | ||||
-rw-r--r-- | src/rcclist.c | 6 | ||||
-rw-r--r-- | src/rcclocale.c | 34 | ||||
-rw-r--r-- | src/rccstring.c | 2 | ||||
-rw-r--r-- | src/rccstring.h | 9 | ||||
-rw-r--r-- | src/recode.c | 77 | ||||
-rw-r--r-- | src/xml.c | 4 |
19 files changed, 200 insertions, 109 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 72cf0ec..b45d4b1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ librcc_la_SOURCES = librcc.c \ engine.c engine.h \ rccstring.c rccstring.h \ xml.c xml.h \ + rcciconv.c rcciconv.h \ fs.c fs.h \ recode.c recode.h \ internal.h @@ -7,6 +7,7 @@ #include <mntent.h> #include "internal.h" +#include "rcciconv.h" #ifndef strndup static char *rccStrndup(const char *str, size_t n) { diff --git a/src/internal.h b/src/internal.h index c943384..24e9cc8 100644 --- a/src/internal.h +++ b/src/internal.h @@ -7,6 +7,8 @@ #include "engine.h" #include "lngconfig.h" +#define STRNLEN(str,n) (n?strnlen(str,n):strlen(str)) + struct rcc_context_t { char locale_variable[RCC_MAX_VARIABLE_CHARS+1]; diff --git a/src/librcc.c b/src/librcc.c index 684e76a..d6acc72 100644 --- a/src/librcc.c +++ b/src/librcc.c @@ -9,6 +9,7 @@ #include "rcclist.h" + int rccInit() { /*DS: Load addition languages from config! */ return rccEncaInit(); @@ -18,7 +19,7 @@ void rccFree() { rccEncaFree(); } -rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale) { +rcc_context rccCreateContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags) { int err; unsigned int i; @@ -27,9 +28,21 @@ rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, u rcc_class_ptr *classes; rcc_language_config configs; iconv_t *from, *to; + + if (!max_languages) { + if (flags&RCC_NO_DEFAULT_CONFIGURATION) max_languages = RCC_MAX_LANGUAGES; + else { + for (i=0;rcc_default_languages[i].sn;i++); + max_languages = i; + } + } - if (!max_languages) max_languages = RCC_MAX_LANGUAGES; - if (!max_classes) max_classes = RCC_MAX_CLASSES; + if (!max_classes) { + if (defclasses) { + for (i=0;defclasses[i].name;i++); + max_classes = i; + } else max_classes = RCC_MAX_CLASSES; + } ctx = (rcc_context)malloc(sizeof(struct rcc_context_t)); languages = (rcc_language_ptr*)malloc((max_languages+1)*sizeof(rcc_language_ptr)); @@ -49,6 +62,8 @@ rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, u return NULL; } + ctx->configuration_lock = 0; + ctx->aliases[0] = NULL; for (i=0;rcc_default_aliases[i].alias;i++) rccRegisterLanguageAlias(ctx, rcc_default_aliases + i); @@ -87,17 +102,20 @@ rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, u ctx->current_language = 0; - if (locale) { - if (strlen(locale)>=RCC_MAX_VARIABLE_CHARS) { + if (locale_variable) { + if (strlen(locale_variable)>=RCC_MAX_VARIABLE_CHARS) { rccFree(ctx); return NULL; } - strcpy(ctx->locale_variable, locale); + strcpy(ctx->locale_variable, locale_variable); } else { strcpy(ctx->locale_variable, RCC_LOCALE_VARIABLE); } - if (flags&RCC_DEFAULT_CONFIGURATION) { + if (flags&RCC_NO_DEFAULT_CONFIGURATION) { + rccRegisterLanguage(ctx, rcc_default_languages); + ctx->current_config = NULL; + } else { for (i=0;rcc_default_languages[i].sn;i++) rccRegisterLanguage(ctx, rcc_default_languages+i); @@ -107,15 +125,21 @@ rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, u } ctx->current_config = rccGetCurrentConfig(ctx); - } else { - rccRegisterLanguage(ctx, rcc_default_languages); - ctx->current_config = NULL; } + + if (defclasses) { + for (i=0;defclasses[i].name;i++) + rccRegisterClass(ctx, defclasses+i); + + if (max_classes < i) { + rccFree(ctx); + return NULL; + } + } for (i=0;i<RCC_MAX_OPTIONS;i++) ctx->options[i] = 0; - ctx->configuration_lock = 0; ctx->configure = 1; return ctx; @@ -153,14 +177,14 @@ void rccFreeContext(rcc_context ctx) { unsigned int i; if (ctx) { - rccFreeEngine(&ctx->engine_ctx); + rccEngineFree(&ctx->engine_ctx); rccFreeIConv(ctx); if (ctx->iconv_from) free(ctx->iconv_from); if (ctx->iconv_to) free(ctx->iconv_to); if (ctx->configs) { for (i=0;i<ctx->max_languages;i++) - rccFreeConfig(ctx->configs+i); + rccConfigFree(ctx->configs+i); free(ctx->configs); } if (ctx->classes) free(ctx->classes); @@ -234,13 +258,15 @@ rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias } rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl) { + puts("yes"); if ((!ctx)||(!cl)) return -1; if (ctx->configuration_lock) return -3; if (ctx->n_classes == ctx->max_classes) return -2; + puts(" -----> New class"); ctx->configure = 1; - ctx->classes[ctx->n_languages++] = cl; - ctx->classes[ctx->n_languages] = NULL; + ctx->classes[ctx->n_classes++] = cl; + ctx->classes[ctx->n_classes] = NULL; return ctx->n_classes-1; } diff --git a/src/librcc.h b/src/librcc.h index 2e06911..6e40130 100644 --- a/src/librcc.h +++ b/src/librcc.h @@ -31,6 +31,7 @@ typedef int rcc_class_id; typedef struct rcc_context_t *rcc_context; typedef struct rcc_engine_context_t *rcc_engine_context; typedef struct rcc_language_config_t *rcc_language_config; +typedef const struct rcc_class_t *rcc_class_ptr; #ifdef __cplusplus extern "C" { @@ -43,8 +44,8 @@ void rccFree(); **************************** Initialization ************************************ *******************************************************************************/ typedef unsigned int rcc_init_flags; -#define RCC_DEFAULT_CONFIGURATION 1 -rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale); +#define RCC_NO_DEFAULT_CONFIGURATION 1 +rcc_context rccCreateContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr classes, rcc_init_flags flags); void rccFreeContext(rcc_context ctx); int rccLockConfiguration(rcc_context ctx, unsigned int lock_code); @@ -112,7 +113,6 @@ typedef enum rcc_class_type_t { RCC_CLASS_KNOWN, RCC_CLASS_FS } rcc_class_type; -typedef const struct rcc_class_t rcc_class; struct rcc_class_t { const char *name; @@ -120,7 +120,7 @@ struct rcc_class_t { const rcc_class_type class_type; const char *fullname; }; -typedef rcc_class *rcc_class_ptr; +typedef const struct rcc_class_t rcc_class; typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1]; rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl); @@ -161,8 +161,6 @@ rcc_option_value rccGetOption(rcc_context ctx, rcc_option option); int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value); /* lngconfig.c */ -int rccConfigInit(rcc_language_config config, rcc_context ctx); -int rccConfigFree(rcc_language_config config); const char *rccConfigGetEngineName(rcc_language_config config, rcc_engine_id engine_id); const char *rccConfigGetCharsetName(rcc_language_config config, rcc_charset_id charset_id); @@ -260,8 +258,8 @@ char *rccFS(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *fsp *******************************************************************************/ /* xml.c */ -int rccSave(rcc_context ctx); -int rccLoad(rcc_context ctx); +int rccSave(rcc_context ctx, const char *name); +int rccLoad(rcc_context ctx, const char *name); #ifdef __cplusplus } @@ -48,6 +48,7 @@ static rcc_language_id rccGetDefaultLanguage(rcc_context ctx) { } rcc_language_id rccGetRealLanguage(rcc_context ctx, rcc_language_id language_id) { + printf("CRL: %i\n", language_id); if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return -1; if (language_id) return language_id; return rccGetDefaultLanguage(ctx); @@ -76,6 +77,7 @@ const char *rccGetSelectedLanguageName(rcc_context ctx) { rcc_language_id rccGetCurrentLanguage(rcc_context ctx) { if (!ctx) return -1; + printf("CL: %i\n", ctx->current_language); return rccGetRealLanguage(ctx, ctx->current_language); } diff --git a/src/lngconfig.c b/src/lngconfig.c index 5de0fae..ad87189 100644 --- a/src/lngconfig.c +++ b/src/lngconfig.c @@ -134,7 +134,7 @@ rcc_language_config rccGetConfig(rcc_context ctx, rcc_language_id language_id) { language_id = rccGetRealLanguage(ctx, language_id); if (language_id < 0) return NULL; if (!ctx->configs[language_id].charset) { - if (rccInitConfig(ctx->configs+language_id, ctx)) return NULL; + if (rccConfigInit(ctx->configs+language_id, ctx)) return NULL; } ctx->configs[language_id].language = ctx->languages[language_id]; @@ -343,6 +343,8 @@ rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char } /* + rcc_option_value options[RCC_MAX_OPTIONS]; + int rccConfigInit(rcc_language_config config, rcc_context ctx) { for (i=0;i<RCC_MAX_OPTIONS;i++) config->options[i] = 0; diff --git a/src/lngconfig.h b/src/lngconfig.h index ced4784..4e9681c 100644 --- a/src/lngconfig.h +++ b/src/lngconfig.h @@ -7,10 +7,12 @@ struct rcc_language_config_t { rcc_engine_id engine; rcc_charset_id *charset; - rcc_option_value options[RCC_MAX_OPTIONS]; }; typedef struct rcc_language_config_t rcc_language_config_s; rcc_engine_ptr rccConfigGetEnginePointer(rcc_language_config config, rcc_engine_id engine_id); +int rccConfigInit(rcc_language_config config, rcc_context ctx); +int rccConfigFree(rcc_language_config config); + #endif /* _RCC_LNGCONFIG_H */ @@ -3,13 +3,13 @@ #include "internal.h" #include "opt.h" -rcc_option_value rccConfigGetOption(rcc_context ctx, rcc_option option) { +rcc_option_value rccGetOption(rcc_context ctx, rcc_option option) { if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1; return ctx->options[option]; } -int rccConfigSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) { +int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) { if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1; if (ctx->options[option] != value) { diff --git a/src/rccconfig.c b/src/rccconfig.c index c77b27a..6d0a372 100644 --- a/src/rccconfig.c +++ b/src/rccconfig.c @@ -34,13 +34,13 @@ rcc_language rcc_default_languages[] = { NULL }}, {"ru", {"Default","KOI8-R","CP1251","UTF-8","IBM866","MACCYRILLIC","ISO8859-5", NULL}, { - &rcc_russian_engine, &rcc_default_engine, + &rcc_russian_engine, NULL }}, {"uk", {"Default","KOI8-U","CP1251","UTF-8","IBM855","MACCYRILLIC","ISO8859-5","CP1125", NULL}, { - &rcc_russian_engine, &rcc_default_engine, + &rcc_russian_engine, NULL }}, {"be", {"Default", "UTF-8", "CP1251", "IBM866", "ISO-8859-5", "KOI8-UNI", "maccyr" "IBM855", NULL},{ diff --git a/src/rccenca.c b/src/rccenca.c index 20e1eb4..1aabf7a 100644 --- a/src/rccenca.c +++ b/src/rccenca.c @@ -59,7 +59,7 @@ rcc_charset_id rccEnca(rcc_engine_context ctx, const char *buf, int len) { if ((!internal)||(!buf)) return -1; - len = STRLEN(buf, len); + len = STRNLEN(buf, len); ee = enca_analyse_const((EncaAnalyser)ctx->internal,buf,len); if (ee.charset<0) return -1; @@ -145,7 +145,10 @@ int rccEncaInit() { for (j=0;engines[j];j++) if (j >= RCC_MAX_ENGINES) continue; - charsets = enca_get_language_charsets(rcc_default_languages[i].sn, &n_charsets); + if (strlen(rcc_default_languages[i].sn)==2) + charsets = enca_get_language_charsets(rcc_default_languages[i].sn, &n_charsets); + else + charsets = NULL; if (charsets) { memcpy(enca_engines+i, &rcc_enca_engine, sizeof(rcc_engine)); for (k=0;enca_engines[i].charsets[k];k++); diff --git a/src/rcciconv.c b/src/rcciconv.c new file mode 100644 index 0000000..d309a5f --- /dev/null +++ b/src/rcciconv.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <iconv.h> + +#include "internal.h" +#include "rcciconv.h" + +static void rccIConvCopySymbol(char **in_buf, int *in_left, char **out_buf, int *out_left) { + if ((out_left>0)&&(in_left>0)) { + (**out_buf)=(**in_buf); + (*out_buf)++; + (*in_buf)++; + (*in_left)--; + (*out_left)--; + } +} + +static int rccIConvUTFBytes(unsigned char c) { + int j; + if (c<128) return 1; + + for (j=6;j>=0;j--) + if ((c&(1<<j))==0) break; + + if ((j==0)||(j==6)) return 1; + return 6-j; +} + +int rccIConv(rcc_context ctx, iconv_t icnv, const char *buf, int len) { + char *in_buf, *out_buf, *res, err; + int in_left, out_left, olen; + int ub, utf_mode=0; + int errors=0; + + if ((!buf)||(!ctx)||(icnv == (iconv_t)-1)) return -1; + + len = STRNLEN(buf,len); + + if (iconv(icnv, NULL, NULL, NULL, NULL) == -1) return -1; + +loop_restart: + errors = 0; + in_buf = (char*)buf; /*DS*/ + in_left = len; + out_buf = ctx->tmpbuffer; + out_left = RCC_MAX_STRING_CHARS; + +loop: + err=iconv(icnv, &in_buf, &in_left, &out_buf, &out_left); + if (err<0) { + if (errno==E2BIG) { + *(int*)(ctx->tmpbuffer+(RCC_MAX_STRING_CHARS-sizeof(int)))=0; + } else if (errno==EILSEQ) { + if (errors++<RCC_MAX_ERRORS) { + for (ub=utf_mode?rccIConvUTFBytes(*in_buf):1;ub>0;ub--) + rccIConvCopySymbol(&in_buf, &in_left, &out_buf, &out_left); + if (in_left>0) goto loop; + } else if (!utf_mode) { + utf_mode = 1; + goto loop_restart; + } else { + return -1; + } + } else { + return -1; + } + } + + return RCC_MAX_STRING_CHARS - out_left; +} diff --git a/src/rcciconv.h b/src/rcciconv.h new file mode 100644 index 0000000..1c899a9 --- /dev/null +++ b/src/rcciconv.h @@ -0,0 +1,6 @@ +#ifndef _RCC_ICONV_H +#define _RCC_ICONV_H + +int rccIConv(rcc_context ctx, iconv_t icnv, const char *buf, int len); + +#endif /* _RCC_ICONV_H */ diff --git a/src/rcclist.c b/src/rcclist.c index dc26d7e..522077e 100644 --- a/src/rcclist.c +++ b/src/rcclist.c @@ -8,11 +8,17 @@ rcc_language_ptr *rccGetLanguageList(rcc_context ctx) { rcc_charset *rccGetCharsetList(rcc_context ctx, rcc_language_id language_id) { if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL; + if (!language_id) language_id = rccGetCurrentLanguage(ctx); + printf("=====> LanguageID: %i\n", language_id); + return ctx->languages[language_id]->charsets; } rcc_engine_ptr *rccGetEngineList(rcc_context ctx, rcc_language_id language_id) { if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL; + if (!language_id) language_id = rccGetCurrentLanguage(ctx); + printf("=====> LanguageID: %i\n", language_id); + return ctx->languages[language_id]->engines; } diff --git a/src/rcclocale.c b/src/rcclocale.c index d2ff610..d3efaa6 100644 --- a/src/rcclocale.c +++ b/src/rcclocale.c @@ -1,7 +1,12 @@ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_CODESET +# include <langinfo.h> +#endif + #include "rccconfig.h" static int rccLocaleGetClassByName(const char *locale) { @@ -22,25 +27,27 @@ static int rccLocaleGetClassByName(const char *locale) { return -1; } -static int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n) { - unsigned int i; +int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n) { + unsigned int i, j; int locale_class; const char *l; + printf("Locale: %p\n", lv); if (!lv) return -1; locale_class = rccLocaleGetClassByName(lv); if (locale_class >= 0) { l = setlocale(locale_class, NULL); + puts(l); if (!l) return -1; else if ((strcmp(l,"C")==0)||(strcmp(l,"POSIX")==0)) return -1; - } return -1; + } else return -1; for (i=0;((l[i])&&(l[i]!='.'));i++); - for (i=0;rcc_default_aliases[i].alias;i++) - if (strncmp(l,rcc_default_aliases[i].alias,i)==0) { - l = rcc_default_aliases[i].alias; + for (j=0;rcc_default_aliases[j].alias;j++) + if (strncmp(l,rcc_default_aliases[j].alias,i)==0) { + l = rcc_default_aliases[j].alias; break; } @@ -49,6 +56,8 @@ static int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n) { strncpy(result,l,i); result[i]=0; + puts("------------------->"); + puts(result); return 0; } @@ -61,6 +70,19 @@ int rccLocaleGetCharset(char *result, const char *lv, unsigned int n) { if (!lv) return -1; locale_class = rccLocaleGetClassByName(lv); + + if (locale_class == LC_CTYPE) { + l = getenv("CHARSET"); +#ifdef HAVE_CODESET + if (!l) l = nl_langinfo(CODESET); +#endif + if (l) { + if (strlen(l)>=n) return -1; + strcpy(result, l); + return 0; + } + } + if (locale_class >= 0) { l = setlocale(locale_class, NULL); if (!l) return -1; diff --git a/src/rccstring.c b/src/rccstring.c index e2db6be..e03a22f 100644 --- a/src/rccstring.c +++ b/src/rccstring.c @@ -39,7 +39,7 @@ rcc_language_id rccStringCheck(const rcc_string str) { } const char *rccStringGet(const rcc_string str) { - if (rccStringCheck(str)) return str + sizeof(rcc_string_header); + if (rccStringCheck(str)) return (const char *)str + sizeof(rcc_string_header); return (const char *)str; } diff --git a/src/rccstring.h b/src/rccstring.h index eceab96..4f7d411 100644 --- a/src/rccstring.h +++ b/src/rccstring.h @@ -4,4 +4,13 @@ rcc_string rccCreateString(rcc_language_id language_id, const char *buf, int len, int *rlen); void rccStringFree(rcc_string str); +rcc_language_id rccStringCheck(const rcc_string str); +const char *rccStringGet(const rcc_string str); +char *rccStringExtract(const rcc_string buf, int len, int *rlen); + +int rccStringCmp(const rcc_string str1, const rcc_string str2); +int rccStringNCmp(const rcc_string str1, const rcc_string str2, size_t n); +int rccStringCaseCmp(const rcc_string str1, const rcc_string str2); +int rccStringNCaseCmp(const rcc_string str1, const rcc_string str2, size_t n); + #endif /* _RCC_STRING_H */ diff --git a/src/recode.c b/src/recode.c index be4d98c..80b59eb 100644 --- a/src/recode.c +++ b/src/recode.c @@ -1,80 +1,15 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <locale.h> -#include <errno.h> -#include <iconv.h> #include "internal.h" +#include "rcciconv.h" #include "fs.h" #include "lng.h" #include "rccstring.h" #include "rccconfig.h" -static void rccIConvCopySymbol(char **in_buf, int *in_left, char **out_buf, int *out_left) { - if ((out_left>0)&&(in_left>0)) { - (**out_buf)=(**in_buf); - (*out_buf)++; - (*in_buf)++; - (*in_left)--; - (*out_left)--; - } -} - -static int rccIConvUTFBytes(unsigned char c) { - int j; - if (c<128) return 1; - - for (j=6;j>=0;j--) - if ((c&bit(j))==0) break; - - if ((j==0)||(j==6)) return 1; - return 6-j; -} - -static int rccIConv(rcc_context ctx, iconv_t icnv, const char *buf, int len) { - char *in_buf, *out_buf, *res, err; - int in_left, out_left, olen; - int ub, utf_mode=0; - int errors=0; - - if ((!buf)||(!ctx)||(icnv == (iconv_t)-1)) return -1; - - len = STRNLEN(buf,len); - - if (iconv(icnv, NULL, NULL, NULL, NULL) == -1) return -1; - -loop_restart: - errors = 0; - in_buf = (char*)buf; /*DS*/ - in_left = len; - out_buf = ctx->tmpbuffer; - out_left = RCC_MAX_STRING_CHARS; - -loop: - err=iconv(icnv, &in_buf, &in_left, &out_buf, &out_left); - if (err<0) { - if (errno==E2BIG) { - *(int*)(ctx->tmpbuffer+(RCC_MAX_STRING_CHARS-sizeof(int)))=0; - } else if (errno==EILSEQ) { - if (errors++<RCC_MAX_ERRORS) { - for (ub=utf_mode?rccIConvUTFBytes(*in_buf):1;ub>0;ub--) - rccIConvCopySymbol(&in_buf, &in_left, &out_buf, &out_left); - if (in_left>0) goto loop; - } else if (!utf_mode) { - utf_mode = 1; - goto loop_restart; - } else { - return -1; - } - } else { - return -1; - } - } - - return RCC_MAX_STRING_CHARS - out_left; -} static rcc_charset_id rccIConvAuto(rcc_context ctx, rcc_class_id class_id, const char *buf, int len) { @@ -86,7 +21,7 @@ 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)||(!stricmp(engine->title, "off"))||(!strcmp(engine->title, "dissable"))) return -1; + if ((!engine)||(!engine->func)||(!strcasecmp(engine->title, "off"))||(!strcasecmp(engine->title, "dissable"))) return -1; return engine->func(&ctx->engine_ctx, buf, len); } @@ -105,6 +40,10 @@ rcc_string rccFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, int err = rccConfigure(ctx); if (err) return NULL; + // Checking if rcc_string passed + language_id = rccStringCheck((const rcc_string)buf); + if (language_id) return NULL; + language_id = rccGetCurrentLanguage(ctx); // DS: Learning. check database (language_id) @@ -139,7 +78,7 @@ char *rccTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, int le if ((!ctx)||(class_id<0)||(class_id>=ctx->n_classes)||(!buf)) return NULL; - language_id = rccCheckString(ctx, buf); + language_id = rccStringCheck(buf); if (!language_id) return NULL; err = rccConfigure(ctx); @@ -189,7 +128,7 @@ char *rccRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char if (from_charset_id>0) { from_charset = rccGetAutoCharsetName(ctx, from_charset_id); to_charset = rccGetCurrentCharsetName(ctx, to); - if ((from_charset)&&(to_charset)&&(!stricmp(from_charset, to_charset))) return NULL; + if ((from_charset)&&(to_charset)&&(!strcasecmp(from_charset, to_charset))) return NULL; } else { from_charset_id = rccGetCurrentCharset(ctx, from); to_charset_id = rccGetCurrentCharset(ctx, to); @@ -5,10 +5,10 @@ /* Load and Then Save */ /* flock */ -int rccSave(rcc_context ctx) { +int rccSave(rcc_context ctx, const char *name) { return 0; } -int rccLoad(rcc_context ctx) { +int rccLoad(rcc_context ctx, const char *name) { return 0; } |