summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librcd.c9
-rw-r--r--src/librcd.h13
2 files changed, 18 insertions, 4 deletions
diff --git a/src/librcd.c b/src/librcd.c
index 2a99378..18681ae 100644
--- a/src/librcd.c
+++ b/src/librcd.c
@@ -1,5 +1,6 @@
#include <stdio.h>
+#define _LIBRCD_C
#include "librcd.h"
#define NF_VALUE -2
@@ -254,10 +255,16 @@ static int check_utf8(const unsigned char *buf, int len) {
}
-enum russian_charsets get_russian_charset(const char *buf,int len) {
+
+rcd_russian_charset rcdGetRussianCharset(const char *buf,int len) {
long l;
l = STRNLEN(buf,len);
if (check_utf8(buf,l)>1) return RUSSIAN_CHARSET_UTF8;
return is_win_charset2(buf,l);
}
+
+/* Compatibility */
+rcd_russian_charset get_russian_charset(const char *buf,int len) {
+ return rcdGetRussianCharset(buf, len);
+}
diff --git a/src/librcd.h b/src/librcd.h
index ced423a..bd3c2e7 100644
--- a/src/librcd.h
+++ b/src/librcd.h
@@ -5,16 +5,17 @@
extern "C" {
#endif
-enum russian_charsets {
+enum rcd_russian_charset_t {
RUSSIAN_CHARSET_WIN = 0,
RUSSIAN_CHARSET_KOI,
RUSSIAN_CHARSET_UTF8,
RUSSIAN_CHARSET_ALT
};
+typedef enum rcd_russian_charset_t rcd_russian_charset;
/*
-get_russian_charset
+rcdGetRussianCharset
Detects encoding of russian text passed in buf variable. Support
UTF-8, CP1251, CP866 and KOI8-R encoding.
@@ -29,10 +30,16 @@ get_russian_charset
3 - CP866
*/
-enum russian_charsets get_russian_charset(const char *buf,int len);
+rcd_russian_charset rcdGetRussianCharset(const char *buf, int len);
#ifdef __cplusplus
}
#endif
+/* Backward compatibility */
+#ifndef _LIBRCD_C
+# define russian_charsets rcd_russian_charset
+# define get_russian_charset rcdGetRussianCharset
+#endif /* ! _LIBRCD_C */
+
#endif /* _LIBRCD_H */