mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
Right now compositors need to manually check that enum values sent by the client are valid. In particular: - Check that the value sent by the client is not outside of the enum. - Check that the version of the enum entry is consistent with the object version. Automatically generate validator functions to perform these tasks. Signed-off-by: Simon Ser <contact@emersion.fr> Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/104
13 lines
355 B
C
13 lines
355 B
C
#include <assert.h>
|
|
#include "data/small-server-core.h"
|
|
|
|
int
|
|
main(int argc, char *argv[]) {
|
|
assert(intf_A_foo_is_valid(INTF_A_FOO_FIRST, 1));
|
|
assert(intf_A_foo_is_valid(INTF_A_FOO_FIRST, 2));
|
|
|
|
assert(!intf_A_foo_is_valid(INTF_A_FOO_THIRD, 1));
|
|
assert(intf_A_foo_is_valid(INTF_A_FOO_THIRD, 2));
|
|
|
|
assert(intf_A_foo_is_valid(INTF_A_FOO_NEGATIVE, 2));
|
|
}
|