1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

LibVirtGPU: Improve type safety of encode_command()

ObjectType is now passed as an enum instead of a plain number. The
underlying type for both ObjectType and VirGLCommand have been reduced
to u8 to make sure they fit in the encoded command. Command length is
verified to not overflow u16.
This commit is contained in:
Stephan Unverwerth 2022-12-21 15:37:52 +01:00 committed by Andreas Kling
parent ce57174802
commit 44b2a746ca
2 changed files with 32 additions and 30 deletions

View file

@ -64,7 +64,7 @@ enum class TextureFormat : u32 {
};
enum class VirGLCommand : u32 {
enum class VirGLCommand : u8 {
NOP = 0,
CREATE_OBJECT = 1,
BIND_OBJECT,
@ -137,7 +137,7 @@ union ClearType {
u32 value;
};
enum class ObjectType : u32 {
enum class ObjectType : u8 {
NONE,
BLEND,
RASTERIZER,