summaryrefslogtreecommitdiffhomepage
path: root/dev/CompilerKit/UUID.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-20 19:39:28 -0500
committerGitHub <noreply@github.com>2025-11-20 19:39:28 -0500
commitc78b97d70a06f0d17e52bf4ac58d4b917789e8a6 (patch)
treed4ab3c4e1685e7f3906bc29dd47cc130d116e190 /dev/CompilerKit/UUID.h
parent274936aa8c14c09239f771bce5b5cc5b6ae507a2 (diff)
parentb8e6e1492ed14e270b1061809b0569b8d2f4c0ec (diff)
Merge pull request #26 from nekernel-org/devv0.0.6
NeCTI: Update ReadMe and improve codebase.
Diffstat (limited to 'dev/CompilerKit/UUID.h')
-rw-r--r--dev/CompilerKit/UUID.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/dev/CompilerKit/UUID.h b/dev/CompilerKit/UUID.h
index 1218fab..98733fd 100644
--- a/dev/CompilerKit/UUID.h
+++ b/dev/CompilerKit/UUID.h
@@ -580,25 +580,24 @@ class uuid_system_generator {
uuid operator()() {
#ifdef _WIN32
-
- GUID newId;
+ GUID newId{}; /// AMLALE: Should be zero-initialized.
HRESULT hr = ::CoCreateGuid(&newId);
if (FAILED(hr)) {
throw std::system_error(hr, std::system_category(), "CoCreateGuid failed");
}
- std::array<uint8_t, 16> bytes = {
- {static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF),
- static_cast<unsigned char>((newId.Data1 >> 16) & 0xFF),
- static_cast<unsigned char>((newId.Data1 >> 8) & 0xFF),
- static_cast<unsigned char>((newId.Data1) & 0xFF),
- static_cast<unsigned char>((newId.Data2 >> 8) & 0xFF),
- static_cast<unsigned char>((newId.Data2) & 0xFF),
- static_cast<unsigned char>((newId.Data3 >> 8) & 0xFF),
- static_cast<unsigned char>((newId.Data3) & 0xFF),
- newId.Data4[0], newId.Data4[1], newId.Data4[2], newId.Data4[3], newId.Data4[4],
- newId.Data4[5], newId.Data4[6], newId.Data4[7]}};
+ std::array<uint8_t, 16> bytes = {{static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF),
+ static_cast<unsigned char>((newId.Data1 >> 16) & 0xFF),
+ static_cast<unsigned char>((newId.Data1 >> 8) & 0xFF),
+ static_cast<unsigned char>((newId.Data1) & 0xFF),
+ static_cast<unsigned char>((newId.Data2 >> 8) & 0xFF),
+ static_cast<unsigned char>((newId.Data2) & 0xFF),
+ static_cast<unsigned char>((newId.Data3 >> 8) & 0xFF),
+ static_cast<unsigned char>((newId.Data3) & 0xFF),
+ newId.Data4[0], newId.Data4[1], newId.Data4[2],
+ newId.Data4[3], newId.Data4[4], newId.Data4[5],
+ newId.Data4[6], newId.Data4[7]}};
return uuid{std::begin(bytes), std::end(bytes)};