summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-11 18:01:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:14 -0500
commitfbdcf2663b56007a438ac4f0d8d82436b1bfe688 (patch)
tree4e42c1f061391cea3d640152fd240682cbf4fd9a /source3/lib/charcnv.c
parent5bf62a0c3cc95abe918f3e772bb10e0a90fdce22 (diff)
downloadsamba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.tar.gz
samba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.tar.bz2
samba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.zip
r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 097d746a63..fffdf010a0 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -516,13 +516,14 @@ size_t convert_string(charset_t from, charset_t to,
**/
size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
- void const *src, size_t srclen, void **dest, BOOL allow_bad_conv)
+ void const *src, size_t srclen, void *dst, BOOL allow_bad_conv)
{
size_t i_len, o_len, destlen = MAX(srclen, 512);
size_t retval;
const char *inbuf = (const char *)src;
char *outbuf = NULL, *ob = NULL;
smb_iconv_t descriptor;
+ void **dest = (void **)dst;
*dest = NULL;
@@ -702,9 +703,11 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
*
* @returns Size in bytes of the converted string; or -1 in case of error.
**/
-static size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
- void const *src, size_t srclen, void **dest, BOOL allow_bad_conv)
+size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
+ void const *src, size_t srclen, void *dst,
+ BOOL allow_bad_conv)
{
+ void **dest = (void **)dst;
size_t dest_len;
*dest = NULL;
@@ -944,9 +947,9 @@ size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len,
if (flags & STR_TERMINATE) {
if (src_len == (size_t)-1) {
- src_len = strlen(src) + 1;
+ src_len = strlen((const char *)src) + 1;
} else {
- size_t len = strnlen(src, src_len);
+ size_t len = strnlen((const char *)src, src_len);
if (len < src_len)
len++;
src_len = len;
@@ -1034,7 +1037,7 @@ size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_
len += ret;
if (flags & STR_UPPER) {
- smb_ucs2_t *dest_ucs2 = dest;
+ smb_ucs2_t *dest_ucs2 = (smb_ucs2_t *)dest;
size_t i;
for (i = 0; i < (dest_len / 2) && dest_ucs2[i]; i++) {
smb_ucs2_t v = toupper_w(dest_ucs2[i]);
@@ -1178,7 +1181,8 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
if (flags & STR_TERMINATE) {
/* src_len -1 is the default for null terminated strings. */
if (src_len != (size_t)-1) {
- size_t len = strnlen_w(src, src_len/2);
+ size_t len = strnlen_w((const smb_ucs2_t *)src,
+ src_len/2);
if (len < src_len/2)
len++;
src_len = len*2;