diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-07-30 09:21:57 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-07-30 09:21:57 +0000 |
commit | 01d9beba6cf2882dc30445b68b3ae54d3bb17679 (patch) | |
tree | d56983bf7ba5e1420aa589d63444ade5b4168800 /source3/lib | |
parent | 3130577acb03a06fd8de27ee6c2e4f82bd4b2008 (diff) | |
download | samba-01d9beba6cf2882dc30445b68b3ae54d3bb17679.tar.gz samba-01d9beba6cf2882dc30445b68b3ae54d3bb17679.tar.bz2 samba-01d9beba6cf2882dc30445b68b3ae54d3bb17679.zip |
Make some of the charconv code a bit easier to read and work with - when we
are dealing with utf8 we may as well specify char** for the pointer, save
otherwise casting in the caller.
Andrew Bartlett
(This used to be commit 46021f85b6da4ba1e7f73ee7408079219d555dde)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/charcnv.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index ea5bb87bc3..6e96136643 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -249,15 +249,15 @@ convert: size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, void **dest) { - void *ob; + void *alloced_string; size_t dest_len; *dest = NULL; - dest_len=convert_string_allocate(from, to, src, srclen, (void **)&ob); + dest_len=convert_string_allocate(from, to, src, srclen, &alloced_string); if (dest_len == -1) return -1; - *dest = talloc_strdup(ctx, (char *)ob); - SAFE_FREE(ob); + *dest = talloc_memdup(ctx, alloced_string, dest_len); + SAFE_FREE(alloced_string); if (*dest == NULL) return -1; return dest_len; @@ -505,12 +505,12 @@ int push_utf8_pstring(void *dest, const char *src) * * @retval The number of bytes occupied by the string in the destination **/ -int push_utf8_talloc(TALLOC_CTX *ctx, void **dest, const char *src) +int push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { int src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, dest); + return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void**)dest); } /** @@ -659,11 +659,11 @@ int pull_utf8_fstring(char *dest, const void *src) * * @retval The number of bytes occupied by the string in the destination **/ -int pull_utf8_talloc(TALLOC_CTX *ctx, void **dest, const char *src) +int pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { int src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, dest); + return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest); } /** |