Change UUID to WUUID

Windows defines a UUID struct that causes clashes
This commit is contained in:
2025-12-15 15:13:56 +00:00
parent 6b7421c25d
commit 50b6a0b0f7
2 changed files with 12 additions and 12 deletions

View File

@@ -16,9 +16,9 @@ struct uuid4 {
}; };
wapp_intern UUID4 generate_uuid4(void); wapp_intern UUID4 generate_uuid4(void);
wapp_intern void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid); wapp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid);
UUID *wapp_uuid_init_uuid4(UUID *uuid) { WUUID *wapp_uuid_init_uuid4(WUUID *uuid) {
wapp_debug_assert(uuid != NULL, "`uuid` should not be NULL"); wapp_debug_assert(uuid != NULL, "`uuid` should not be NULL");
UUID4 uuid4 = generate_uuid4(); UUID4 uuid4 = generate_uuid4();
@@ -47,12 +47,12 @@ wapp_intern UUID4 generate_uuid4(void) {
return uuid; return uuid;
} }
wapp_intern void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid) { wapp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid) {
u64 grp1 = uuid4->high >> 32; u64 group1 = uuid4->high >> 32;
u64 grp2 = (uuid4->high << 32) >> 48; u64 group2 = (uuid4->high << 32) >> 48;
u64 grp3 = (uuid4->high << 48) >> 48; u64 group3 = (uuid4->high << 48) >> 48;
u64 grp4 = uuid4->low >> 48; u64 group4 = uuid4->low >> 48;
u64 grp5 = (uuid4->low << 16) >> 16; u64 group5 = (uuid4->low << 16) >> 16;
wapp_str8_format(&(uuid->uuid), UUID_STR_FORMAT, grp1, grp2, grp3, grp4, grp5); wapp_str8_format(&(uuid->uuid), UUID_STR_FORMAT, group1, group2, group3, group4, group5);
} }

View File

@@ -15,8 +15,8 @@ BEGIN_C_LINKAGE
#define WAPP_UUID_SPEC WAPP_STR8_SPEC #define WAPP_UUID_SPEC WAPP_STR8_SPEC
#define wapp_uuid_varg(UUID) wapp_str8_varg((UUID).uuid) #define wapp_uuid_varg(UUID) wapp_str8_varg((UUID).uuid)
typedef struct uuid UUID; typedef struct wapp_uuid WUUID;
struct uuid { struct wapp_uuid {
Str8 uuid; Str8 uuid;
}; };
@@ -28,7 +28,7 @@ struct uuid {
// Just returns the same pointer that was passed in with the UUID initialised. // Just returns the same pointer that was passed in with the UUID initialised.
// Fails when passed a NULL pointer. // Fails when passed a NULL pointer.
UUID *wapp_uuid_init_uuid4(UUID *uuid); WUUID *wapp_uuid_init_uuid4(WUUID *uuid);
#ifdef WAPP_PLATFORM_CPP #ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE END_C_LINKAGE