summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-12-10 16:01:20 +0000
committerAlexander Bokovoy <ab@samba.org>2003-12-10 16:01:20 +0000
commitcaf641f2d2aa8edecd3f4d0a9b234e614b43f7e6 (patch)
tree950f7a67a99f0dde98b45a078baaad6a17903d19 /source3/lib
parent1665e8cabab3ee3f74f5fb1805e5593a7aa3cf00 (diff)
downloadsamba-caf641f2d2aa8edecd3f4d0a9b234e614b43f7e6.tar.gz
samba-caf641f2d2aa8edecd3f4d0a9b234e614b43f7e6.tar.bz2
samba-caf641f2d2aa8edecd3f4d0a9b234e614b43f7e6.zip
Fix #558 -- support ISO-8859-1 internally. Makes Solaris users a bit happier
(This used to be commit 808fc7e9d52ccc61ceb56821f6b977936817b88b)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/iconv.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index 9f6db79ee2..b0c13a5ee6 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -53,6 +53,7 @@
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 latin1_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 ucs2hex_pull(void *,char **, size_t *, char **, size_t *);
@@ -64,6 +65,7 @@ static struct charset_functions builtin_functions[] = {
{"UTF8", utf8_pull, utf8_push},
{"ASCII", ascii_pull, ascii_push},
{"646", ascii_pull, ascii_push},
+ {"ISO-8859-1", ascii_pull, latin1_push},
{"UCS2-HEX", ucs2hex_pull, ucs2hex_push},
{NULL, NULL, NULL}
};
@@ -354,6 +356,32 @@ static size_t ascii_push(void *cd, char **inbuf, size_t *inbytesleft,
return ir_count;
}
+static size_t latin1_push(void *cd, char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft)
+{
+ int ir_count=0;
+
+ while (*inbytesleft >= 2 && *outbytesleft >= 1) {
+ (*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 ucs2hex_pull(void *cd, char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)