summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-25 04:00:40 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-25 04:00:40 +0000
commita9126e5c1caa169cab0133415f668de5d93655e3 (patch)
tree9af9bc4500d38fde39725a9c48830dc61fd6c84e
parent7879d999ab59678e98b7385e88eda5cce2c2a9fd (diff)
downloadsamba-a9126e5c1caa169cab0133415f668de5d93655e3.tar.gz
samba-a9126e5c1caa169cab0133415f668de5d93655e3.tar.bz2
samba-a9126e5c1caa169cab0133415f668de5d93655e3.zip
ucs2 is always a multiple of 2 bytes
this gets rid of a bunch of iconv warnings (This used to be commit 2ec59f731df6489756c5606ed63de90fb2a9241f)
-rw-r--r--source3/lib/charcnv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 49c4ba4063..9bbb8a8507 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -255,6 +255,9 @@ int push_ucs2(const void *base_ptr, void *dest, const char *src, int dest_len, i
len++;
}
+ /* ucs2 is always a multiple of 2 bytes */
+ dest_len &= ~1;
+
len += convert_string(&unix_to_ucs2, src, src_len, dest, dest_len);
return len;
}
@@ -285,6 +288,9 @@ int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, i
if (flags & STR_TERMINATE) src_len = strlen_w(src)*2+2;
+ /* ucs2 is always a multiple of 2 bytes */
+ src_len &= ~1;
+
ret = convert_string(&ucs2_to_unix, src, src_len, dest, dest_len);
if (dest_len) dest[MIN(ret, dest_len-1)] = 0;