diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-09-21 22:54:53 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-09-21 22:54:53 +0300 |
commit | af95542df3ab6b5a9ddce4c933ef6b2230d833eb (patch) | |
tree | 4800fbe3e322ee902b872da955cdc7f9dcbc291b /source/blender/blenlib/intern | |
parent | 6d162d35e2c85ea4fb990f0c459ec36064cf0550 (diff) |
UUIDs: rename UUID to bUUID
Rename the `UUID` struct to `bUUID`. This avoids a symbol clash on
Windows, which also defines `UUID`. This only pops up when a `UUID`
field is used in the DNA code, which is why it wasn't a problem before
(it will be once D12589 lands).
No functional changes.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/uuid.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/uuid.cc b/source/blender/blenlib/intern/uuid.cc index f5edb356acc..ae34bcb3d32 100644 --- a/source/blender/blenlib/intern/uuid.cc +++ b/source/blender/blenlib/intern/uuid.cc @@ -27,9 +27,9 @@ #include <string> /* Ensure the UUID struct doesn't have any padding, to be compatible with memcmp(). */ -static_assert(sizeof(UUID) == 16, "expect UUIDs to be 128 bit exactly"); +static_assert(sizeof(bUUID) == 16, "expect UUIDs to be 128 bit exactly"); -UUID BLI_uuid_generate_random() +bUUID BLI_uuid_generate_random() { static std::mt19937_64 rng = []() { std::mt19937_64 rng; @@ -57,7 +57,7 @@ UUID BLI_uuid_generate_random() return rng; }(); - UUID uuid; + bUUID uuid; /* RFC4122 suggests setting certain bits to a fixed value, and then randomizing the remaining * bits. The opposite is easier to implement, though, so that's what's done here. */ @@ -78,23 +78,23 @@ UUID BLI_uuid_generate_random() return uuid; } -UUID BLI_uuid_nil(void) +bUUID BLI_uuid_nil(void) { - const UUID nil = {0, 0, 0, 0, 0, 0}; + const bUUID nil = {0, 0, 0, 0, 0, 0}; return nil; } -bool BLI_uuid_is_nil(UUID uuid) +bool BLI_uuid_is_nil(bUUID uuid) { return BLI_uuid_equal(BLI_uuid_nil(), uuid); } -bool BLI_uuid_equal(const UUID uuid1, const UUID uuid2) +bool BLI_uuid_equal(const bUUID uuid1, const bUUID uuid2) { return std::memcmp(&uuid1, &uuid2, sizeof(uuid1)) == 0; } -void BLI_uuid_format(char *buffer, const UUID uuid) +void BLI_uuid_format(char *buffer, const bUUID uuid) { std::sprintf(buffer, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", @@ -111,7 +111,7 @@ void BLI_uuid_format(char *buffer, const UUID uuid) uuid.node[5]); } -bool BLI_uuid_parse_string(UUID *uuid, const char *buffer) +bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) { const int num_fields_parsed = std::sscanf( buffer, @@ -130,7 +130,7 @@ bool BLI_uuid_parse_string(UUID *uuid, const char *buffer) return num_fields_parsed == 11; } -std::ostream &operator<<(std::ostream &stream, UUID uuid) +std::ostream &operator<<(std::ostream &stream, bUUID uuid) { std::string buffer(36, '\0'); BLI_uuid_format(buffer.data(), uuid); |