diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-19 22:25:43 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-19 22:25:43 +0000 |
commit | 2cdfde517e53ae2c7c3393a505e1f127e714fc59 (patch) | |
tree | 85a0ee488bcfa68a5a773293677670c3a382bf94 /src | |
parent | 055bdab4f515b1e93155fccbe03fac43a007aa0e (diff) | |
download | librcc-2cdfde517e53ae2c7c3393a505e1f127e714fc59.tar.gz librcc-2cdfde517e53ae2c7c3393a505e1f127e714fc59.tar.bz2 librcc-2cdfde517e53ae2c7c3393a505e1f127e714fc59.tar.xz librcc-2cdfde517e53ae2c7c3393a505e1f127e714fc59.zip |
Fixes
- Fixed several errors in doxygen documentation
- Initializing locale in rcclocale (if setlocale return 'C')
- Calling Configure before anything else in rccRecode
Diffstat (limited to 'src')
-rw-r--r-- | src/librcc.h | 42 | ||||
-rw-r--r-- | src/lngconfig.c | 2 | ||||
-rw-r--r-- | src/rcclocale.c | 8 | ||||
-rw-r--r-- | src/recode.c | 3 |
4 files changed, 32 insertions, 23 deletions
diff --git a/src/librcc.h b/src/librcc.h index 7f3c823..a72274a 100644 --- a/src/librcc.h +++ b/src/librcc.h @@ -236,28 +236,28 @@ typedef rcc_language_alias_ptr rcc_language_alias_list[RCC_MAX_ALIASES+1]; /** * Register new language in supplied working context * @param ctx is working context ( or default one if NULL supplied ) - * @language is pointer on language description (shouldn't be freed before library deinitialization). + * @param language is pointer on language description (shouldn't be freed before library deinitialization). * @return registered language id or -1 in case of a error. */ rcc_language_id rccRegisterLanguage(rcc_context ctx, rcc_language *language); /** * Register new encoding belonging to language in supplied working context - * @param ctx is working context ( or default one if NULL supplied ) - * @charset is pointer on charset name (shouldn't be freed before library deinitialization). + * @param language is language charset should be added to ( or default one if NULL supplied ) + * @param charset is pointer on charset name (shouldn't be freed before library deinitialization). * @return registered charset id or -1 in case of a error. */ rcc_charset_id rccLanguageRegisterCharset(rcc_language *language, rcc_charset charset); /** * Register new Engine in supplied working context - * @param ctx is working context ( or default one if NULL supplied ) - * @engine is pointer on engine description (shouldn't be freed before library deinitialization). + * @param language is language charset should be added to ( or default one if NULL supplied ) + * @param engine is pointer on engine description (shouldn't be freed before library deinitialization). * @return registered engine id or -1 in case of a error. */ rcc_engine_id rccLanguageRegisterEngine(rcc_language *language, rcc_engine *engine); /** * Register new language alias in supplied working context * @param ctx is working context ( or default one if NULL supplied ) - * @alias is pointer on alias description (shouldn't be freed before library deinitialization). + * @param alias is pointer on alias description (shouldn't be freed before library deinitialization). * @return registered alias id or -1 in case of a error. */ rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias); @@ -335,14 +335,14 @@ typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1]; /** * Register additional class * @param ctx is working context ( or default one if NULL supplied ) - * @cl is pointer on the class description (shouldn't be freed before library deinitialization). + * @param cl is pointer on the class description (shouldn't be freed before library deinitialization). * @return registered class id or -1 in case of a error. */ rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl); /** * Determines 'class type' of supplied class. * @param ctx is working context ( or default one if NULL supplied ) - * @class_id is class id + * @param class_id is class id * @return class type or -1 in case of a error. */ rcc_class_type rccGetClassType(rcc_context ctx, rcc_class_id class_id); @@ -407,7 +407,7 @@ typedef struct rcc_option_range_t { * Determines name of the supplied language. * * @param ctx is working context ( or default one if NULL supplied ) - * @language_id is 'language id' of desired language. For default language the 'default' value will be returned. + * @param language_id is 'language id' of desired language. For default language the 'default' value will be returned. * @return language name or NULL in case of a error. */ const char *rccGetLanguageName(rcc_context ctx, rcc_language_id language_id); @@ -415,7 +415,7 @@ const char *rccGetLanguageName(rcc_context ctx, rcc_language_id language_id); * Finds language id by the supplied name. * * @param ctx is working context ( or default one if NULL supplied ) - * @parm is language name + * @param name is language name * @return language id [0-n] or -1 if not found. */ rcc_language_id rccGetLanguageByName(rcc_context ctx, const char *name); @@ -429,7 +429,7 @@ rcc_language_id rccGetLanguageByName(rcc_context ctx, const char *name); * - 3. If one of the previous steps is failed, select first available language (id=1). Usually it should be 'LibRCC off'. * * @param ctx is working context ( or default one if NULL supplied ) - * @language_id is language id + * @param language_id is language id * @return resolved language id [1-n] or -1 in case of error. */ rcc_language_id rccGetRealLanguage(rcc_context ctx, rcc_language_id language_id); @@ -438,7 +438,7 @@ rcc_language_id rccGetRealLanguage(rcc_context ctx, rcc_language_id language_id) * @see rccGetRealLanguage * * @param ctx is working context ( or default one if NULL supplied ) - * @language_id is language id + * @param language_id is language id * @return resolved language name or NULL in case of error. */ const char *rccGetRealLanguageName(rcc_context ctx, rcc_language_id language_id); @@ -522,7 +522,7 @@ int rccOptionSetDefault(rcc_context ctx, rcc_option option); * * @param ctx is working context ( or default one if NULL supplied ) * @param option is option - * @param is option value + * @param value is option value * @return non-zero value in case of erros */ int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value); @@ -546,7 +546,6 @@ rcc_option_range *rccOptionGetRange(rcc_context ctx, rcc_option option); /** * Get short name of supplied option. * - * @param ctx is working context ( or default one if NULL supplied ) * @param option is option * @return option range or NULL in case of error */ @@ -555,7 +554,6 @@ const char *rccGetOptionName(rcc_option option); /** * Get short name of supplied option value. * - * @param ctx is working context ( or default one if NULL supplied ) * @param option is option * @param value is value of #option * @return option value name or NULL in case of error @@ -564,15 +562,13 @@ const char *rccGetOptionValueName(rcc_option option, rcc_option_value value); /** * Get option by short name. * - * @param ctx is working context ( or default one if NULL supplied ) - * @parm is option name + * @param name is option name * @return option or -1 in case of error */ rcc_option rccGetOptionByName(const char *name); /** * Get option value by short name. * - * @param ctx is working context ( or default one if NULL supplied ) * @param option is option * @param name is value name * @return option value or -1 in case of error @@ -643,7 +639,7 @@ const char *rccConfigGetCharsetName(rcc_language_config config, rcc_charset_id c * Function finds engine id by the supplied name. * * @param config is language configuration - * @parm is engine name + * @param name is engine name * @return engine id [0-n] or -1 if not found */ rcc_engine_id rccConfigGetEngineByName(rcc_language_config config, const char *name); @@ -651,7 +647,7 @@ rcc_engine_id rccConfigGetEngineByName(rcc_language_config config, const char *n * Function finds encoding id by the supplied name. * * @param config is language configuration - * @parm is encoding name + * @param name is encoding name * @return encoding id [0-n] or -1 if not found. */ rcc_charset_id rccConfigGetCharsetByName(rcc_language_config config, const char *name); @@ -925,7 +921,7 @@ void rccIConvClose(rcc_iconv icnv); * @param outbuf is preallocated output buffer * @param outsize is size of output buffer (striped string will be returned if buffer to small) * @param buf is data for recoding - * @param len is size of data + * @param size is size of the data * @return number of recoded bytes in output buffer or -1 in the case of error */ size_t rccIConvRecode(rcc_iconv icnv, char *outbuf, size_t outsize, const char *buf, size_t size); @@ -984,7 +980,9 @@ char *rccSizedRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const * @param ctx is working context ( or default one if NULL supplied ) * @param from is source encoding class * @param to is destination encoding class - * @param buf is original file name + * @param fspath is path to the filesystem where file are located. + * @param path is file path + * @param filename is file name * @result is recoded file name or NULL if recoding is not required or failed. It is up to the caller to free memory. */ char *rccFS(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *fspath, const char *path, const char *filename); diff --git a/src/lngconfig.c b/src/lngconfig.c index 5ffdd75..efb2c1a 100644 --- a/src/lngconfig.c +++ b/src/lngconfig.c @@ -229,7 +229,7 @@ rcc_language_config rccGetConfig(rcc_context ctx, rcc_language_id language_id) { language_id = rccGetRealLanguage(ctx, language_id); if (language_id == (rcc_language_id)-1) return NULL; if (!strcasecmp(ctx->languages[language_id]->sn, "off")) return NULL; - + if (!ctx->configs[language_id].charset) { if (rccConfigInit(ctx->configs+language_id, ctx)) return NULL; } diff --git a/src/rcclocale.c b/src/rcclocale.c index 7bfa54b..c0b4e63 100644 --- a/src/rcclocale.c +++ b/src/rcclocale.c @@ -41,6 +41,10 @@ int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n) { locale_class = rccLocaleGetClassByName(lv); if (locale_class >= 0) { l = setlocale(locale_class, NULL); + if (!strcasecmp(l,"C")) { + setlocale(LC_ALL, ""); + l = setlocale(locale_class, NULL); + } } else { if (!strcasecmp(lv, "LANG")) l = getenv("LANG"); else if (!strcasecmp(lv, "LANGUAGE")) l = getenv("LANGUAGE"); @@ -88,6 +92,10 @@ int rccLocaleGetCharset(char *result, const char *lv, unsigned int n) { if (locale_class >= 0) { l = setlocale(locale_class, NULL); + if (!strcasecmp(l,"C")) { + setlocale(LC_ALL, ""); + l = setlocale(locale_class, NULL); + } if (!l) return -1; } else return -1; diff --git a/src/recode.c b/src/recode.c index 435e1a6..4016186 100644 --- a/src/recode.c +++ b/src/recode.c @@ -153,6 +153,7 @@ char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, s } char *rccSizedRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen) { + int err; rcc_string stmp; char *result; const char *from_charset, *to_charset; @@ -183,6 +184,8 @@ char *rccSizedRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const } } + err = rccConfigure(ctx); + if (err) return NULL; from_charset_id = rccIConvAuto(ctx, from, buf, len); if (from_charset_id != (rcc_charset_id)-1) { |