summaryrefslogtreecommitdiff
path: root/source3/lib/iconv.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-20 06:18:52 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-20 06:18:52 +0000
commitec312741639c447c83ad76683c9f1538a3f5084b (patch)
treec898f136d20b4e06c0f97471644f5bc9d44d463c /source3/lib/iconv.c
parent367c40fd876bb74b5c606f1ea985119a4ba8aca8 (diff)
downloadsamba-ec312741639c447c83ad76683c9f1538a3f5084b.tar.gz
samba-ec312741639c447c83ad76683c9f1538a3f5084b.tar.bz2
samba-ec312741639c447c83ad76683c9f1538a3f5084b.zip
much better auto-init of valid_table[]. This should just about remove
the need for valid.dat (This used to be commit 0cfd0a5e543181b1384f7afee93fbaf3ccb2b999)
Diffstat (limited to 'source3/lib/iconv.c')
-rw-r--r--source3/lib/iconv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index 8bcd92d72a..c08524eaa0 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -125,6 +125,9 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
}
memset(ret, 0, sizeof(*ret));
+ ret->from_name = strdup(fromcode);
+ ret->to_name = strdup(tocode);
+
/* check for the simplest null conversion */
if (strcmp(fromcode, tocode) == 0) {
ret->direct = iconv_copy;
@@ -202,6 +205,9 @@ int smb_iconv_close (smb_iconv_t cd)
if (cd->cd_push) iconv_close((iconv_t)cd->cd_push);
#endif
+ SAFE_FREE(cd->from_name);
+ SAFE_FREE(cd->to_name);
+
memset(cd, 0, sizeof(*cd));
SAFE_FREE(cd);
return 0;
@@ -240,7 +246,7 @@ static size_t ascii_push(void *cd, char **inbuf, size_t *inbytesleft,
int ir_count=0;
while (*inbytesleft >= 2 && *outbytesleft >= 1) {
- (*outbuf)[0] = (*inbuf)[0];
+ (*outbuf)[0] = (*inbuf)[0] & 0x7F;
if ((*inbuf)[1]) ir_count++;
(*inbytesleft) -= 2;
(*outbytesleft) -= 1;