Created
August 5, 2023 22:19
-
-
Save computerquip/f479cbfd63e59d62d2d70b540ceb0573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 9eb5bf4515aba998e215049baf62c0be153eb70a | |
Author: Zachary Lund <[email protected]> | |
Date: Sun Jul 16 17:17:41 2023 -0500 | |
UI: Use QUuid for uuid generation | |
diff --git a/UI/update/shared-update.cpp b/UI/update/shared-update.cpp | |
index ef1b0b075..cfacda50f 100644 | |
--- a/UI/update/shared-update.cpp | |
+++ b/UI/update/shared-update.cpp | |
@@ -127,18 +127,6 @@ try { | |
/* ------------------------------------------------------------------------ */ | |
-void GenerateGUID(std::string &guid) | |
-{ | |
- const char alphabet[] = "0123456789abcdef"; | |
- QRandomGenerator *rng = QRandomGenerator::system(); | |
- | |
- guid.resize(40); | |
- | |
- for (size_t i = 0; i < 40; i++) { | |
- guid[i] = alphabet[rng->bounded(0, 16)]; | |
- } | |
-} | |
- | |
std::string GetProgramGUID() | |
{ | |
static std::mutex m; | |
@@ -147,18 +135,17 @@ std::string GetProgramGUID() | |
/* NOTE: this is an arbitrary random number that we use to count the | |
* number of unique OBS installations and is not associated with any | |
* kind of identifiable information */ | |
- const char *pguid = | |
+ QString guid = | |
config_get_string(GetGlobalConfig(), "General", "InstallGUID"); | |
- std::string guid; | |
- if (pguid) | |
- guid = pguid; | |
- if (guid.empty()) { | |
- GenerateGUID(guid); | |
+ if (guid.isEmpty() ) { | |
+ guid = QUuid::createUuid(); | |
+ | |
+ if (!guid.isEmpty()) { | |
- if (!guid.empty()) | |
config_set_string(GetGlobalConfig(), "General", | |
- "InstallGUID", guid.c_str()); | |
+ "InstallGUID", guid.toStdString().c_str()); | |
+ } | |
} | |
return guid; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment