summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-04-16 13:09:00 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-04-16 13:09:00 +0000
commit004502551bd53ae68a7dfee8bdb47831c9c39817 (patch)
treea970ee758bafaaea94d826086c514edda103075a /source3
parent5e969704801f5c0ae88a7974c8c025412a601431 (diff)
downloadsamba-004502551bd53ae68a7dfee8bdb47831c9c39817.tar.gz
samba-004502551bd53ae68a7dfee8bdb47831c9c39817.tar.bz2
samba-004502551bd53ae68a7dfee8bdb47831c9c39817.zip
Add support for the new modules system to lib/iconv.c (merge from HEAD)
(This used to be commit 64a357017a897d1920c06fc19453470ee517470d)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in88
-rw-r--r--source3/include/charset.h16
-rw-r--r--source3/lib/iconv.c281
3 files changed, 223 insertions, 162 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 6b162d7ef2..ee25d3c62c 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -144,7 +144,8 @@ VFS_MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_extd_audit.@SHLIBEXT@ bin/vfs_rec
PDB_MODULES = @PDB_MODULES@
RPC_MODULES = @RPC_MODULES@
AUTH_MODULES = @AUTH_MODULES@
-MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(AUTH_MODULES)
+CHARSET_MODULES = @CHARSET_MODULES@
+MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(AUTH_MODULES) $(CHARSET_MODULES)
######################################################################
# object file lists
@@ -171,7 +172,7 @@ LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \
nsswitch/wb_client.o nsswitch/wb_common.o \
lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o \
lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \
- lib/module.o lib/ldap_escape.o
+ lib/module.o lib/ldap_escape.o @CHARSET_STATIC@
LIB_SMBD_OBJ = lib/system_smbd.o lib/util_smbd.o
@@ -952,36 +953,99 @@ nsswitch/pam_winbind.@SHLIBEXT@: $(PAM_WINBIND_OBJ) bin/.dummy
@$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) \
@SONAMEFLAG@`basename $@` -lpam
-bin/pdb_mysql.@SHLIBEXT@: $(PDB_MYSQL_OBJ)
+bin/rhosts.@SHLIBEXT@: $(AUTH_RHOSTS_OBJ)
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_MYSQL_OBJ) @MYSQL_LIBS@ \
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_RHOSTS_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/builtin.@SHLIBEXT@: $(AUTH_BUILTIN_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_BUILTIN_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/domain.@SHLIBEXT@: $(AUTH_DOMAIN_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_DOMAIN_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/server.@SHLIBEXT@: $(AUTH_SERVER_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SERVER_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/winbind.@SHLIBEXT@: $(AUTH_WINBIND_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_WINBIND_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/unix.@SHLIBEXT@: $(AUTH_UNIX_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_UNIX_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/sam.@SHLIBEXT@: $(AUTH_SAM_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SAM_OBJ) @SONAMEFLAG@`basename $@`
+
+bin/mysql.@SHLIBEXT@: $(MYSQL_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(MYSQL_OBJ) @MYSQL_LIBS@ \
@SONAMEFLAG@`basename $@`
-bin/pdb_xml.@SHLIBEXT@: $(PDB_XML_OBJ)
+bin/ldapsam.@SHLIBEXT@: passdb/pdb_ldap.o
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_XML_OBJ) @XML_LIBS@ \
+ @$(SHLD) $(LDSHFLAGS) @LDAP_LIBS@ -o $@ passdb/pdb_ldap.o \
@SONAMEFLAG@`basename $@`
-bin/vfs_audit.@SHLIBEXT@: $(VFS_AUDIT_OBJ)
+bin/tdbsam.@SHLIBEXT@: passdb/pdb_tdb.o
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_AUDIT_OBJ) \
+ @$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_tdb.o \
+ @SONAMEFLAG@`basename $@`
+
+bin/smbpasswd.@SHLIBEXT@: passdb/pdb_smbpasswd.o
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_smbpasswd.o \
@SONAMEFLAG@`basename $@`
-bin/vfs_extd_audit.@SHLIBEXT@: $(VFS_EXTD_AUDIT_OBJ)
+bin/unixsam.@SHLIBEXT@: passdb/pdb_unix.o
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_unix.o \
+ @SONAMEFLAG@`basename $@`
+
+bin/nisplussam.@SHLIBEXT@: passdb/pdb_nisplus.o
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_nisplus.o \
+ @SONAMEFLAG@`basename $@`
+
+bin/weird.@SHLIBEXT@: $(DEVEL_HELP_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_OBJ) \
+ @SONAMEFLAG@`basename $@`
+
+bin/xml.@SHLIBEXT@: $(XML_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ) @XML_LIBS@ \
+ @SONAMEFLAG@`basename $@`
+
+bin/audit.@SHLIBEXT@: $(VFS_AUDIT_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_AUDIT_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/vfs_recycle.@SHLIBEXT@: $(VFS_RECYCLE_OBJ)
+bin/extd_audit.@SHLIBEXT@: $(VFS_EXTD_AUDIT_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_EXTD_AUDIT_OBJ) \
+ @SONAMEFLAG@`basename $@`
+
+bin/recycle.@SHLIBEXT@: $(VFS_RECYCLE_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_RECYCLE_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/vfs_netatalk.@SHLIBEXT@: $(VFS_NETATALK_OBJ)
+bin/netatalk.@SHLIBEXT@: $(VFS_NETATALK_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_NETATALK_OBJ) \
@SONAMEFLAG@`basename $@`
+bin/fake_perms.@SHLIBEXT@: $(VFS_FAKE_PERMS_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_FAKE_PERMS_OBJ) \
+ @SONAMEFLAG@`basename $@`
+
bin/wbinfo@EXEEXT@: $(WBINFO_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \
$(UBIQX_OBJ) $(SECRETS_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
@@ -1045,6 +1109,7 @@ installmodules: modules installdirs
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(PDB_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(AUTH_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSETLIBDIR) $(CHARSET_MODULES)
installscripts: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
@@ -1126,6 +1191,7 @@ uninstallmodules:
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(PDB_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(DESTDIR)$(AUTH_MODULES)
+ @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSETLIBDIR) $(DESTDIR)$(CHARSET_MODULES)
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
diff --git a/source3/include/charset.h b/source3/include/charset.h
index 07d5e2d599..c56984ca7b 100644
--- a/source3/include/charset.h
+++ b/source3/include/charset.h
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
charset defines
Copyright (C) Andrew Tridgell 2001
+ Copyright (C) Jelmer Vernooij 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,3 +23,18 @@
typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4} charset_t;
#define NUM_CHARSETS 5
+
+/*
+ * for each charset we have a function that pulls from that charset to
+ * a ucs2 buffer, and a function that pushes to a ucs2 buffer
+ * */
+
+struct charset_functions {
+ const char *name;
+ size_t (*pull)(void *, char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ size_t (*push)(void *, char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ struct charset_functions *prev, *next;
+};
+
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index 54733c2ac2..d161975601 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
minimal iconv implementation
Copyright (C) Andrew Tridgell 2001
+ Copyright (C) Jelmer Vernooij 2002,2003
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,35 +21,97 @@
#include "includes.h"
+
+/**
+ * @file
+ *
+ * @brief Samba wrapper/stub for iconv character set conversion.
+ *
+ * iconv is the XPG2 interface for converting between character
+ * encodings. This file provides a Samba wrapper around it, and also
+ * a simple reimplementation that is used if the system does not
+ * implement iconv.
+ *
+ * Samba only works with encodings that are supersets of ASCII: ascii
+ * characters like whitespace can be tested for directly, multibyte
+ * sequences start with a byte with the high bit set, and strings are
+ * terminated by a nul byte.
+ *
+ * Note that the only function provided by iconv is conversion between
+ * characters. It doesn't directly support operations like
+ * uppercasing or comparison. We have to convert to UCS-2 and compare
+ * there.
+ *
+ * @sa Samba Developers Guide
+ **/
+
static size_t ascii_pull(void *,char **, size_t *, char **, size_t *);
static size_t ascii_push(void *,char **, size_t *, char **, size_t *);
static size_t utf8_pull(void *,char **, size_t *, char **, size_t *);
static size_t utf8_push(void *,char **, size_t *, char **, size_t *);
-static size_t weird_pull(void *,char **, size_t *, char **, size_t *);
-static size_t weird_push(void *,char **, size_t *, char **, size_t *);
static size_t ucs2hex_pull(void *,char **, size_t *, char **, size_t *);
static size_t ucs2hex_push(void *,char **, size_t *, char **, size_t *);
static size_t iconv_copy(void *,char **, size_t *, char **, size_t *);
-/*
- for each charset we have a function that pulls from that charset to
- a ucs2 buffer, and a function that pushes to a ucs2 buffer
-*/
-static struct {
- const char *name;
- size_t (*pull)(void *, char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft);
- size_t (*push)(void *, char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft);
-} charsets[] = {
+static struct charset_functions builtin_functions[] = {
{"UCS-2LE", iconv_copy, iconv_copy},
{"UTF8", utf8_pull, utf8_push},
{"ASCII", ascii_pull, ascii_push},
- {"WEIRD", weird_pull, weird_push},
{"UCS2-HEX", ucs2hex_pull, ucs2hex_push},
{NULL, NULL, NULL}
};
+static struct charset_functions *charsets = NULL;
+
+static struct charset_functions *find_charset_functions(const char *name)
+{
+ struct charset_functions *c = charsets;
+ pstring stripped;
+
+ module_path_get_name(name, stripped);
+
+ while(c) {
+ if (strcasecmp(stripped, c->name) == 0) {
+ return c;
+ }
+ c = c->next;
+ }
+
+ return NULL;
+}
+
+BOOL smb_register_charset(struct charset_functions *funcs)
+{
+ struct charset_functions *c = charsets;
+
+ DEBUG(5, ("Attempting to register new charset %s\n", funcs->name));
+ /* Check whether we already have this charset... */
+ while(c) {
+ if(!strcasecmp(c->name, funcs->name)){
+ DEBUG(2, ("Duplicate charset %s, not registering\n", funcs->name));
+ return False;
+ }
+ c = c->next;
+ }
+
+ funcs->next = funcs->prev = NULL;
+ DEBUG(5, ("Registered charset %s\n", funcs->name));
+ DLIST_ADD(charsets, funcs);
+ return True;
+}
+
+void lazy_initialize_iconv(void)
+{
+ static BOOL initialized;
+ int i;
+
+ if (!initialized) {
+ initialized = True;
+ for(i = 0; builtin_functions[i].name; i++)
+ smb_register_charset(&builtin_functions[i]);
+ static_init_charset;
+ }
+}
/* if there was an error then reset the internal state,
this ensures that we don't have a shift state remaining for
@@ -116,7 +179,11 @@ size_t smb_iconv(smb_iconv_t cd,
smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
{
smb_iconv_t ret;
- int from, to;
+ struct charset_functions *from, *to;
+
+ lazy_initialize_iconv();
+ from = charsets;
+ to = charsets;
ret = (smb_iconv_t)malloc(sizeof(*ret));
if (!ret) {
@@ -129,53 +196,78 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
ret->to_name = strdup(tocode);
/* check for the simplest null conversion */
- if (strcmp(fromcode, tocode) == 0) {
+ if (strcasecmp(fromcode, tocode) == 0) {
ret->direct = iconv_copy;
return ret;
}
- for (from=0; charsets[from].name; from++) {
- if (strcasecmp(charsets[from].name, fromcode) == 0) break;
- }
- for (to=0; charsets[to].name; to++) {
- if (strcasecmp(charsets[to].name, tocode) == 0) break;
- }
+ /* check if we have a builtin function for this conversion */
+ from = find_charset_functions(fromcode);
+ if(from)ret->pull = from->pull;
+
+ to = find_charset_functions(tocode);
+ if(to)ret->push = to->push;
+ /* check if we can use iconv for this conversion */
#ifdef HAVE_NATIVE_ICONV
- if (!charsets[from].name) {
- ret->pull = sys_iconv;
+ if (!ret->pull) {
ret->cd_pull = iconv_open("UCS-2LE", fromcode);
- if (ret->cd_pull == (iconv_t)-1) goto failed;
+ if (ret->cd_pull != (iconv_t)-1)
+ ret->pull = sys_iconv;
}
- if (!charsets[to].name) {
- ret->push = sys_iconv;
+
+ if (!ret->push) {
ret->cd_push = iconv_open(tocode, "UCS-2LE");
- if (ret->cd_push == (iconv_t)-1) goto failed;
- }
-#else
- if (!charsets[from].name || !charsets[to].name) {
- goto failed;
+ if (ret->cd_push != (iconv_t)-1)
+ ret->push = sys_iconv;
}
#endif
+
+ /* check if there is a module available that can do this conversion */
+ if (!ret->pull && smb_probe_module("charset", fromcode)) {
+ if(!(from = find_charset_functions(fromcode)))
+ DEBUG(0, ("Module %s doesn't provide charset %s!\n", fromcode, fromcode));
+ else
+ ret->pull = from->pull;
+ }
+
+ if (!ret->push && smb_probe_module("charset", tocode)) {
+ if(!(to = find_charset_functions(tocode)))
+ DEBUG(0, ("Module %s doesn't provide charset %s!\n", tocode, tocode));
+ else
+ ret->push = to->push;
+ }
+
+ if (!ret->push || !ret->pull) {
+ SAFE_FREE(ret->from_name);
+ SAFE_FREE(ret->to_name);
+ SAFE_FREE(ret);
+ errno = EINVAL;
+ return (smb_iconv_t)-1;
+ }
/* check for conversion to/from ucs2 */
- if (from == 0 && charsets[to].name) {
- ret->direct = charsets[to].push;
+ if (strcasecmp(fromcode, "UCS-2LE") == 0 && to) {
+ ret->direct = to->push;
+ ret->push = ret->pull = NULL;
return ret;
}
- if (to == 0 && charsets[from].name) {
- ret->direct = charsets[from].pull;
+
+ if (strcasecmp(tocode, "UCS-2LE") == 0 && from) {
+ ret->direct = from->pull;
+ ret->push = ret->pull = NULL;
return ret;
}
+ /* Check if we can do the conversion direct */
#ifdef HAVE_NATIVE_ICONV
- if (from == 0) {
+ if (strcasecmp(fromcode, "UCS-2LE") == 0) {
ret->direct = sys_iconv;
ret->cd_direct = ret->cd_push;
ret->cd_push = NULL;
return ret;
}
- if (to == 0) {
+ if (strcasecmp(tocode, "UCS-2LE") == 0) {
ret->direct = sys_iconv;
ret->cd_direct = ret->cd_pull;
ret->cd_pull = NULL;
@@ -183,15 +275,7 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
}
#endif
- /* the general case has to go via a buffer */
- if (!ret->pull) ret->pull = charsets[from].pull;
- if (!ret->push) ret->push = charsets[to].push;
return ret;
-
-failed:
- SAFE_FREE(ret);
- errno = EINVAL;
- return (smb_iconv_t)-1;
}
/*
@@ -353,111 +437,6 @@ static size_t ucs2hex_push(void *cd, char **inbuf, size_t *inbytesleft,
}
-/* the "weird" character set is very useful for testing multi-byte
- support and finding bugs. Don't use on a production system!
-*/
-static struct {
- const char from;
- const char *to;
- int len;
-} weird_table[] = {
- {'q', "^q^", 3},
- {'Q', "^Q^", 3},
- {0, NULL}
-};
-
-static size_t weird_pull(void *cd, char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft)
-{
- while (*inbytesleft >= 1 && *outbytesleft >= 2) {
- int i;
- int done = 0;
- for (i=0;weird_table[i].from;i++) {
- if (strncmp((*inbuf),
- weird_table[i].to,
- weird_table[i].len) == 0) {
- if (*inbytesleft < weird_table[i].len) {
- DEBUG(0,("ERROR: truncated weird string\n"));
- /* smb_panic("weird_pull"); */
-
- } else {
- (*outbuf)[0] = weird_table[i].from;
- (*outbuf)[1] = 0;
- (*inbytesleft) -= weird_table[i].len;
- (*outbytesleft) -= 2;
- (*inbuf) += weird_table[i].len;
- (*outbuf) += 2;
- done = 1;
- break;
- }
- }
- }
- if (done) continue;
- (*outbuf)[0] = (*inbuf)[0];
- (*outbuf)[1] = 0;
- (*inbytesleft) -= 1;
- (*outbytesleft) -= 2;
- (*inbuf) += 1;
- (*outbuf) += 2;
- }
-
- if (*inbytesleft > 0) {
- errno = E2BIG;
- return -1;
- }
-
- return 0;
-}
-
-static size_t weird_push(void *cd, char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft)
-{
- int ir_count=0;
-
- while (*inbytesleft >= 2 && *outbytesleft >= 1) {
- int i;
- int done=0;
- for (i=0;weird_table[i].from;i++) {
- if ((*inbuf)[0] == weird_table[i].from &&
- (*inbuf)[1] == 0) {
- if (*outbytesleft < weird_table[i].len) {
- DEBUG(0,("No room for weird character\n"));
- /* smb_panic("weird_push"); */
- } else {
- memcpy(*outbuf, weird_table[i].to,
- weird_table[i].len);
- (*inbytesleft) -= 2;
- (*outbytesleft) -= weird_table[i].len;
- (*inbuf) += 2;
- (*outbuf) += weird_table[i].len;
- done = 1;
- break;
- }
- }
- }
- if (done) continue;
-
- (*outbuf)[0] = (*inbuf)[0];
- if ((*inbuf)[1]) ir_count++;
- (*inbytesleft) -= 2;
- (*outbytesleft) -= 1;
- (*inbuf) += 2;
- (*outbuf) += 1;
- }
-
- if (*inbytesleft == 1) {
- errno = EINVAL;
- return -1;
- }
-
- if (*inbytesleft > 1) {
- errno = E2BIG;
- return -1;
- }
-
- return ir_count;
-}
-
static size_t iconv_copy(void *cd, char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{