aboutsummaryrefslogtreecommitdiff
path: root/src/hardware_functions.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
commit13942345c6a3e7e1625c6c26cc2f2f368a3bff23 (patch)
tree73ce940217b57fd47afb6a95e828e6309ed5e683 /src/hardware_functions.cpp
parentfaac191f0b9e99b82614ed3959ec5c67f56a1fc3 (diff)
Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style. Lines reflow at 80 characters. One-line method bodies are on the same line as the signature. Space always after `//`. No indentation on preprocessor macros. Includes are sorted lexicographically. If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame.
Diffstat (limited to 'src/hardware_functions.cpp')
-rw-r--r--src/hardware_functions.cpp56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp
index bd6a6c3c..96c72eb5 100644
--- a/src/hardware_functions.cpp
+++ b/src/hardware_functions.cpp
@@ -2,7 +2,7 @@
#include <QDebug>
-#if (defined (_WIN32) || defined (_WIN64))
+#if (defined(_WIN32) || defined(_WIN64))
#include <windows.h>
static DWORD dwVolSerial;
@@ -10,17 +10,18 @@ static BOOL bIsRetrieved;
QString get_hdid()
{
- bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0);
+ bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial,
+ nullptr, nullptr, nullptr, 0);
if (bIsRetrieved)
return QString::number(dwVolSerial, 16);
else
- //a totally random string
- //what could possibly go wrong
+ // a totally random string
+ // what could possibly go wrong
return "gxsps32sa9fnwic92mfbs0";
}
-#elif (defined (LINUX) || defined (__linux__))
+#elif (defined(LINUX) || defined(__linux__))
#include <QFile>
#include <QTextStream>
@@ -33,12 +34,10 @@ QString get_hdid()
QTextStream in(&fstab_file);
- while(!in.atEnd())
- {
+ while (!in.atEnd()) {
QString line = in.readLine();
- if (line.startsWith("UUID"))
- {
+ if (line.startsWith("UUID")) {
QStringList line_elements = line.split("=");
if (line_elements.size() > 1)
@@ -55,26 +54,25 @@ QString get_hdid()
QString get_hdid()
{
- CFStringRef serial;
- char buffer[64] = {0};
- QString hdid;
- io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
- IOServiceMatching("IOPlatformExpertDevice"));
- if (platformExpert)
- {
- CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
- CFSTR(kIOPlatformSerialNumberKey),
- kCFAllocatorDefault, 0);
- if (serialNumberAsCFString) {
- serial = (CFStringRef)serialNumberAsCFString;
- }
- if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
- hdid = buffer;
- }
-
- IOObjectRelease(platformExpert);
- }
- return hdid;
+ CFStringRef serial;
+ char buffer[64] = {0};
+ QString hdid;
+ io_service_t platformExpert = IOServiceGetMatchingService(
+ kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
+ if (platformExpert) {
+ CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(
+ platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault,
+ 0);
+ if (serialNumberAsCFString) {
+ serial = (CFStringRef)serialNumberAsCFString;
+ }
+ if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
+ hdid = buffer;
+ }
+
+ IOObjectRelease(platformExpert);
+ }
+ return hdid;
}
#else