mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-01 07:16:07 -04:00
Do not allow nullable new_id
The usefulness of this is limited, and `libwayland-client` doesn't provide a way to pass a null `new_id` since the id is generated by the library and given to the caller as the return value. Signed-off-by: Ian Douglas Scott <idscott@system76.com>
This commit is contained in:
parent
13b05c9ed1
commit
971f8e4ace
4 changed files with 4 additions and 8 deletions
|
|
@ -630,7 +630,7 @@ wl_closure_marshal(struct wl_object *sender, uint32_t opcode,
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
object = args[i].o;
|
object = args[i].o;
|
||||||
if (!arg.nullable && object == NULL)
|
if (object == NULL)
|
||||||
goto err_null;
|
goto err_null;
|
||||||
|
|
||||||
closure->args[i].n = object ? object->id : 0;
|
closure->args[i].n = object ? object->id : 0;
|
||||||
|
|
@ -799,7 +799,7 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
id = *p++;
|
id = *p++;
|
||||||
closure->args[i].n = id;
|
closure->args[i].n = id;
|
||||||
|
|
||||||
if (id == 0 && !arg.nullable) {
|
if (id == 0) {
|
||||||
wl_log("NULL new ID received on non-nullable "
|
wl_log("NULL new ID received on non-nullable "
|
||||||
"type, message %s(%s)\n", message->name,
|
"type, message %s(%s)\n", message->name,
|
||||||
message->signature);
|
message->signature);
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,6 @@ is_nullable_type(struct arg *arg)
|
||||||
/* Strings and objects are possibly nullable */
|
/* Strings and objects are possibly nullable */
|
||||||
case STRING:
|
case STRING:
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
case NEW_ID:
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -245,9 +245,6 @@ TEST(connection_marshal)
|
||||||
marshal(&data, "n", 12, &object);
|
marshal(&data, "n", 12, &object);
|
||||||
assert(data.buffer[2] == object.id);
|
assert(data.buffer[2] == object.id);
|
||||||
|
|
||||||
marshal(&data, "?n", 12, NULL);
|
|
||||||
assert(data.buffer[2] == 0);
|
|
||||||
|
|
||||||
array.data = (void *) text;
|
array.data = (void *) text;
|
||||||
array.size = sizeof text;
|
array.size = sizeof text;
|
||||||
marshal(&data, "a", 20, &array);
|
marshal(&data, "a", 20, &array);
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ TEST(message_count_arrays)
|
||||||
{ "middle", "iufasonh", NULL },
|
{ "middle", "iufasonh", NULL },
|
||||||
{ "multiple", "aaiufaasonhaa", NULL },
|
{ "multiple", "aaiufaasonhaa", NULL },
|
||||||
{ "leading_version", "2aaiufaasonhaa", NULL },
|
{ "leading_version", "2aaiufaasonhaa", NULL },
|
||||||
{ "among_nullables", "iufsa?oa?nah", NULL },
|
{ "among_nullables", "iufsa?oa?sah", NULL },
|
||||||
{ "all_mixed", "2aiufas?oa?na", NULL },
|
{ "all_mixed", "2aiufas?oa?sa", NULL },
|
||||||
};
|
};
|
||||||
const struct {
|
const struct {
|
||||||
const struct wl_message *message;
|
const struct wl_message *message;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue