Skip to content

Commit

Permalink
Refs #22056: Uncrustify
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Nov 5, 2024
1 parent 9f6862f commit ecfb2fc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/cpp/utils/Host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,36 +160,39 @@ class Host
}
}


static std::string compute_machine_id()
{
#ifdef _WIN32
char machine_id[255];
DWORD BufferSize = sizeof(machine_id);
LONG res = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", "MachineGuid", RRF_RT_REG_SZ, NULL, machine_id, &BufferSize);
LONG res = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", "MachineGuid", RRF_RT_REG_SZ,
NULL, machine_id, &BufferSize);
if (res == 0)
{
return std::string(machine_id);
}
return "";
#elif defined(__APPLE__)
io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(
kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
IOObjectRelease(ioRegistryRoot);
CFStringGetCString(uuidCf, buf, 255, kCFStringEncodingMacRoman);
CFRelease(uuidCf);
return std::string(buf, 255);
#elif defined(_POSIX_SOURCE)
int fd = open("/etc/machine-id", O_RDONLY);
if (fd == -1) {
if (fd == -1)
{
return "";
}

char buffer[33] = {0};
ssize_t bytes_read = read(fd, buffer, 32);
close(fd);

if (bytes_read < 32) {
if (bytes_read < 32)
{
return "";
}

Expand Down

0 comments on commit ecfb2fc

Please sign in to comment.