diff --git a/src/dict.c b/src/dict.c index d2667ce0..75e3a73e 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1,9 +1,9 @@ /** * - * getdns list management functions, note that the internal storage is + * getdns list management functions, note that the internal storage is * accomplished via the libc binary search tree implementation so your * pointer foo needs to be keen to digest some of the internal semantics - * + * * Interfaces originally taken from the getdns API description pseudo implementation. * */ @@ -11,7 +11,7 @@ /* * Copyright (c) 2013, Versign, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -370,8 +370,8 @@ getdns_dict_set_dict(struct getdns_dict * dict, char *name, struct getdns_dict *newdict; getdns_return_t retval; - if (!dict || !name) - return GETDNS_RETURN_NO_SUCH_DICT_NAME; + if (!dict || !name || !child_dict) + return GETDNS_RETURN_INVALID_PARAMETER; retval = getdns_dict_copy(child_dict, &newdict); if (retval != GETDNS_RETURN_GOOD) @@ -459,7 +459,7 @@ getdns_dict_set_int(struct getdns_dict * dict, char *name, /*---------------------------------------- getdns_pp_dict */ /** - * private function to help with indenting. + * private function to help with indenting. * @param indent number of spaces to return * @return a character string containing min(80, indent) spaces */ diff --git a/src/getdns/getdns.h b/src/getdns/getdns.h index 2ce5ba54..8e0fcd30 100644 --- a/src/getdns/getdns.h +++ b/src/getdns/getdns.h @@ -9,7 +9,7 @@ /* * Copyright (c) 2013, NLNet Labs, Versign, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -74,6 +74,8 @@ struct event_base; #define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT "A query was made with a context that is using stub resolution and a DNSSEC extension specified." #define GETDNS_RETURN_MEMORY_ERROR 310 #define GETDNS_RETURN_MEMORY_ERROR_TEXT "Unable to allocate the memory required." +#define GETDNS_RETURN_INVALID_PARAMETER 311 +#define GETDNS_RETURN_INVALID_PARAMETER_TEXT "A required parameter had an invalid value." /** @} */ diff --git a/src/getdns_error.c b/src/getdns_error.c index c3282dc8..638e1c96 100644 --- a/src/getdns_error.c +++ b/src/getdns_error.c @@ -61,8 +61,11 @@ getdns_lookup_table getdns_error_str[] = { {GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED, "A query was made with a context that is using stub resolution and a DNSSEC extension specified."} , - {GETDNS_RETURN_MEMORY_ERROR, + {GETDNS_RETURN_MEMORY_ERROR, "Unable to allocate the memory required."} + , + {GETDNS_RETURN_INVALID_PARAMETER, + GETDNS_RETURN_INVALID_PARAMETER_TEXT } , {0, ""} };