diff options
author | Saturn&Eric <[email protected]> | 2024-05-11 17:18:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-11 17:18:36 +0000 |
commit | f909f2c4c35b187eb165ec5545e35d54c6d92bf3 (patch) | |
tree | 428fe9e63ecae6bb93be6f20cd2b1ee9b29ffd8d /src/core/utils/CommonUtils.cpp | |
parent | Merge pull request #145 from jermanuts/jermanuts-wizard-links-update (diff) | |
parent | fix: remove qt5compat and redirect dll output path of modules (diff) | |
download | GpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.tar.gz GpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.zip |
Merge pull request #148 from saturneric/develop
Develop 2.1.3.1
Diffstat (limited to 'src/core/utils/CommonUtils.cpp')
-rw-r--r-- | src/core/utils/CommonUtils.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp index 0b182241..d1704312 100644 --- a/src/core/utils/CommonUtils.cpp +++ b/src/core/utils/CommonUtils.cpp @@ -43,7 +43,7 @@ auto BeautifyFingerprint(QString fingerprint) -> QString { return out.readAll(); } -auto CompareSoftwareVersion(const QString& a, const QString& b) -> int { +auto GFCompareSoftwareVersion(const QString& a, const QString& b) -> int { auto remove_prefix = [](const QString& version) { return version.startsWith('v') ? version.mid(1) : version; }; @@ -71,4 +71,25 @@ auto CompareSoftwareVersion(const QString& a, const QString& b) -> int { return 0; } + +auto GFStrDup(const QString& str) -> char* { + auto utf8_str = str.toUtf8(); + auto* c_str = + static_cast<char*>(SecureMalloc((utf8_str.size() + 1) * sizeof(char))); + + memcpy(c_str, utf8_str.constData(), utf8_str.size()); + c_str[utf8_str.size()] = '\0'; + return c_str; +} + +auto GPGFRONTEND_CORE_EXPORT GFUnStrDup(char* str) -> QString { + auto qt_str = QString::fromUtf8(str); + SecureFree(static_cast<void*>(const_cast<char*>(str))); + return qt_str; +} + +auto GPGFRONTEND_CORE_EXPORT GFUnStrDup(const char* str) -> QString { + return GFUnStrDup(const_cast<char*>(str)); +} + } // namespace GpgFrontend
\ No newline at end of file |