From 17a3acafa89bfc6090b0767d05a00a7505003fcc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Apr 2003 17:48:48 +0000 Subject: Use NTSTATUS as return value for smb_register_*() functions and init_module() function. Patch by metze with some minor modifications. (This used to be commit bc4b51bcb2daa7271c884cb83bf8bdba6d3a9b6d) --- source3/lib/iconv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source3/lib/iconv.c') diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 01fa31915a..c09bff5fd7 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -77,22 +77,23 @@ static struct charset_functions *find_charset_functions(const char *name) return NULL; } -BOOL smb_register_charset(struct charset_functions *funcs) +NTSTATUS smb_register_charset(struct charset_functions *funcs) { - struct charset_functions *c = charsets; + if (!funcs) { + return NT_STATUS_INVALID_PARAMETER; + } DEBUG(5, ("Attempting to register new charset %s\n", funcs->name)); /* Check whether we already have this charset... */ - if (find_charset_functions(funcs->name)) { DEBUG(0, ("Duplicate charset %s, not registering\n", funcs->name)); - return False; + return NT_STATUS_OBJECT_NAME_COLLISION; } funcs->next = funcs->prev = NULL; DEBUG(5, ("Registered charset %s\n", funcs->name)); DLIST_ADD(charsets, funcs); - return True; + return NT_STATUS_OK; } void lazy_initialize_iconv(void) @@ -219,14 +220,14 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) #endif /* check if there is a module available that can do this conversion */ - if (!ret->pull && smb_probe_module("charset", fromcode)) { + if (!ret->pull && NT_STATUS_IS_OK(smb_probe_module("charset", fromcode))) { if(!(from = find_charset_functions(fromcode))) DEBUG(0, ("Module %s doesn't provide charset %s!\n", fromcode, fromcode)); else ret->pull = from->pull; } - if (!ret->push && smb_probe_module("charset", tocode)) { + if (!ret->push && NT_STATUS_IS_OK(smb_probe_module("charset", tocode))) { if(!(to = find_charset_functions(tocode))) DEBUG(0, ("Module %s doesn't provide charset %s!\n", tocode, tocode)); else -- cgit