[2/2] server: Send differentiated errors on wl_registry.bind

Submitted by Philipp Kerling on Jan. 22, 2018, 12:32 p.m.

Details

Message ID 20180122123231.9951-2-pkerling@casix.org
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Philipp Kerling Jan. 22, 2018, 12:32 p.m.
This now uses the new error codes introduced to wl_registry instead
of abusing WL_DISPLAY_ERROR_INVALID_OBJECT.
---
 src/wayland-server.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 7225b4e..e33af62 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -882,21 +882,21 @@  registry_bind(struct wl_client *client,
 
 	if (&global->link == &display->global_list)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_GLOBAL,
 				       "invalid global %s (%d)", interface, name);
 	else if (version == 0)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_VERSION,
 				       "invalid version for global %s (%d): 0 is not a valid version",
 				       interface, name);
 	else if (global->version < version)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INCOMPATIBLE_VERSION,
 				       "invalid version for global %s (%d): have %d, wanted %d",
 				       interface, name, global->version, version);
 	else if (!wl_global_is_visible(client, global))
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_GLOBAL,
 				       "invalid global %s (%d)", interface, name);
 	else
 		global->bind(client, global->data, version, id);

Comments

On Mon, 22 Jan 2018 13:32:31 +0100
Philipp Kerling <pkerling@casix.org> wrote:

> This now uses the new error codes introduced to wl_registry instead
> of abusing WL_DISPLAY_ERROR_INVALID_OBJECT.
> ---
>  src/wayland-server.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Hi,

both patches are:

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

I wonder if anyone has anything against changing the error values for
the two cases. WL_DISPLAY_ERROR_INVALID_OBJECT has the same value as
WL_REGISTRY_ERROR_INVALID_GLOBAL, but the others do not.


Thanks,
pq