summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-24 01:47:52 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-24 01:47:52 +0000
commitcfaef1b6c9f33fbaa114628cf513d129bdff3c1c (patch)
treeb5207f980062d0aaaa2515f76983f5386408a298 /src
parentcd75d05e2a72eff41d6eedb61bc89ca2e1cd185d (diff)
downloadlibrcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.gz
librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.bz2
librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.xz
librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.zip
Fixes
- Dummy UI plugin - GTK2 UI plugin - Fixed typo: 'const rcc_string' -> 'rcc_const_string' - Fix: Disable BDB recoding in case if recoding switched off
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/librcc.h6
-rw-r--r--src/recode.c12
3 files changed, 11 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5c105f3..50c6836 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,7 @@ librcc_la_SOURCES = librcc.c \
internal.h
include_HEADERS = librcc.h
-INCLUDES = -I../src -DLIBRCC_DATA_DIR=\"${pkgdatadir}\" @XML_INCLUDES@ @DLOPEN_INCLUDES@ @RCD_INCLUDES@ @ENCA_INCLUDES@ @BDB_INCLUDES@
+AM_CPPFLAGS = -I../src -DLIBRCC_DATA_DIR=\"${pkgdatadir}\" @XML_INCLUDES@ @DLOPEN_INCLUDES@ @RCD_INCLUDES@ @ENCA_INCLUDES@ @BDB_INCLUDES@
librcc_la_LIBADD = @XML_LIBS@ @DLOPEN_LIBS@ @RCD_LIBS@ @ENCA_LIBS@ @BDB_LIBS@
librcc_la_LDFLAGS = -version-info @LIBRCC_VERSION_INFO@
diff --git a/src/librcc.h b/src/librcc.h
index 6b28813..a70d6df 100644
--- a/src/librcc.h
+++ b/src/librcc.h
@@ -952,7 +952,7 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf,
* @param rlen in rlen the size of recoded string will be returned.
* @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory.
*/
-char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, size_t *rlen);
+char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen);
/**
* Recode string between different encoding classes. The conversion is relays on rccSizedFrom
* and rccSizedTo functions.
@@ -1008,7 +1008,7 @@ rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char
* @param rlen in rlen the size of recoded string will be returned.
* @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory.
*/
-char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string buf, size_t *rlen);
+char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen);
/**
* Recode string between specified encoding class and encoding.
*
@@ -1023,7 +1023,7 @@ char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string b
* @param rlen in rlen the size of recoded string will be returned.
* @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory.
*/
-char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const rcc_string buf, size_t len, size_t *rlen);
+char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen);
/**
* Recode string between specified encoding and encoding class.
*
diff --git a/src/recode.c b/src/recode.c
index 4016186..a1b7f31 100644
--- a/src/recode.c
+++ b/src/recode.c
@@ -48,6 +48,10 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf,
ret = rccStringSizedCheck(buf, len);
if (ret) return NULL;
+ language_id = rccGetCurrentLanguage(ctx);
+ if (language_id == (rcc_language_id)-1) return NULL;
+ if (!strcasecmp(ctx->languages[language_id]->sn, "off")) return NULL;
+
usedb4 = rccGetOption(ctx, RCC_OPTION_LEARNING_MODE);
if (usedb4&RCC_OPTION_LEARNING_FLAG_USE) {
@@ -61,8 +65,6 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf,
err = rccConfigure(ctx);
if (err) return NULL;
- language_id = rccGetCurrentLanguage(ctx);
-
charset_id = rccIConvAuto(ctx, class_id, buf, len);
if (charset_id != (rcc_autocharset_id)-1) icnv = ctx->iconv_auto[charset_id];
else icnv = ctx->iconv_from[class_id];
@@ -84,7 +86,7 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf,
return result;
}
-char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, size_t *rlen) {
+char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen) {
int err;
size_t newlen;
char *result;
@@ -280,7 +282,7 @@ rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char
return rccCreateString(language_id, buf, len);
}
-char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string buf, size_t *rlen) {
+char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen) {
rcc_iconv icnv;
size_t res;
@@ -304,7 +306,7 @@ char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string b
}
/* Convert from class_id to Charset */
-char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const rcc_string buf, size_t len, size_t *rlen) {
+char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen) {
size_t res;
rcc_iconv icnv;
const char *str;