From 65ff53f25c418feea1c3e6223fbe0031b6dc5ba1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 30 Jan 2006 20:57:58 +0000 Subject: add new error code AVAHI_ERR_IS_EMPTY and use it in avahi_entry_group_commit() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1124 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-common/dbus.c | 3 ++- avahi-common/dbus.h | 6 +++--- avahi-common/error.c | 3 ++- avahi-common/error.h | 3 ++- avahi-core/entry.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/avahi-common/dbus.c b/avahi-common/dbus.c index 8140164..e044b53 100644 --- a/avahi-common/dbus.c +++ b/avahi-common/dbus.c @@ -87,7 +87,8 @@ static const char * const table[- AVAHI_ERR_MAX] = { AVAHI_DBUS_ERR_NOT_SUPPORTED, AVAHI_DBUS_ERR_NOT_PERMITTED, - AVAHI_DBUS_ERR_INVALID_ARGUMENT + AVAHI_DBUS_ERR_INVALID_ARGUMENT, + AVAHI_DBUS_ERR_IS_EMPTY }; struct error_map { diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h index 84d5d2d..39718d1 100644 --- a/avahi-common/dbus.h +++ b/avahi-common/dbus.h @@ -88,7 +88,7 @@ Avahi 0.6.1 implements API version 0x0202 */ #define AVAHI_DBUS_ERR_VERSION_MISMATCH "org.freedesktop.Avahi.VersionMismatchError" #define AVAHI_DBUS_ERR_INVALID_SERVICE_SUBTYPE "org.freedesktop.Avahi.InvalidServiceSubtypeError" #define AVAHI_DBUS_ERR_INVALID_PACKET "org.freedesktop.Avahi.InvalidPacketError" -#define AVAHI_DBUS_ERR_INVALID_DNS_ERROR "org.freedesktop.Avahi.InvalidDNSError" +#define AVAHI_DBUS_ERR_INVALID_DNS_ERROR "org.freedesktop.Avahi.InvalidDNSErrorError" #define AVAHI_DBUS_ERR_DNS_FORMERR "org.freedesktop.Avahi.DNSFORMERR" #define AVAHI_DBUS_ERR_DNS_SERVFAIL "org.freedesktop.Avahi.DNSSERVFAIL" #define AVAHI_DBUS_ERR_DNS_NXDOMAIN "org.freedesktop.Avahi.DNSNXDOMAIN" @@ -106,8 +106,8 @@ Avahi 0.6.1 implements API version 0x0202 */ #define AVAHI_DBUS_ERR_NOT_SUPPORTED "org.freedesktop.Avahi.NotSupportedError" #define AVAHI_DBUS_ERR_NOT_PERMITTED "org.freedesktop.Avahi.NotPermittedError" -#define AVAHI_DBUS_ERR_INVALID_ARGUMENT "org.freedesktop.Avahi.InvalidArgument" - +#define AVAHI_DBUS_ERR_INVALID_ARGUMENT "org.freedesktop.Avahi.InvalidArgumentError" +#define AVAHI_DBUS_ERR_IS_EMPTY "org.freedesktop.Avahi.IsEmptyError" /** Convert a DBus error string into an Avahi error number */ int avahi_error_dbus_to_number(const char *s); diff --git a/avahi-common/error.c b/avahi-common/error.c index 6fe981c..f6f561a 100644 --- a/avahi-common/error.c +++ b/avahi-common/error.c @@ -84,7 +84,8 @@ const char *avahi_strerror(int error) { "Not supported", "Not permitted", - "Invalid argument" + "Invalid argument", + "Is empty" }; if (-error < 0 || -error >= -AVAHI_ERR_MAX) diff --git a/avahi-common/error.h b/avahi-common/error.h index 8060ebc..2cf3bc2 100644 --- a/avahi-common/error.h +++ b/avahi-common/error.h @@ -87,6 +87,7 @@ enum { AVAHI_ERR_NOT_PERMITTED = -50, /**< Operation not permitted */ AVAHI_ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */ + AVAHI_ERR_IS_EMPTY = -52, /**< Is empty */ /**** **** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD @@ -96,7 +97,7 @@ enum { **** Also remember to update the MAX value below. ****/ - AVAHI_ERR_MAX = -52 + AVAHI_ERR_MAX = -53 }; /** Return a human readable error string for the specified error code */ diff --git a/avahi-core/entry.c b/avahi-core/entry.c index eb745f2..d953f7b 100644 --- a/avahi-core/entry.c +++ b/avahi-core/entry.c @@ -1114,7 +1114,7 @@ int avahi_s_entry_group_commit(AvahiSEntryGroup *g) { return avahi_server_set_errno(g->server, AVAHI_ERR_BAD_STATE); if (avahi_s_entry_group_is_empty(g)) - return avahi_server_set_errno(g->server, AVAHI_ERR_BAD_STATE); + return avahi_server_set_errno(g->server, AVAHI_ERR_IS_EMPTY); g->n_register_try++; -- cgit