From fb37f156009611af0dd454a0fb0829a09cd638ac Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 29 Apr 2008 14:36:24 -0700 Subject: Cleanup size_t return values in callers of convert_string_allocate This patch is the second iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 6b189dabc562d86dcaa685419d0cb6ea276f100d) --- source3/lib/util_unistr.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 84ee673a67..76235ad041 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -312,14 +312,12 @@ int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src) char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src) { char *dest = NULL; - size_t dest_len = convert_string_talloc(ctx, - CH_UTF16LE, - CH_UNIX, - src->buffer, - src->uni_str_len * 2, - (void *)&dest, - true); - if (dest_len == (size_t)-1) { + size_t dest_len; + + if (!convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, src->buffer, + src->uni_str_len * 2, (void *)&dest, + &dest_len, true)) + { return NULL; } @@ -364,7 +362,11 @@ int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags) int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src) { - return push_ucs2_talloc(ctx, dest, src); + size_t size; + if (push_ucs2_talloc(ctx, dest, src, &size)) + return size; + else + return -1; } /******************************************************************* -- cgit