diff options
author | saturneric <[email protected]> | 2024-02-28 16:32:43 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-02-28 16:32:43 +0000 |
commit | 12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8 (patch) | |
tree | 1b747d6a3a034814104df6f531077de9c03ecd53 /src/core/utils/CommonUtils.cpp | |
parent | feat: add user agent header when doing http request (diff) | |
download | GpgFrontend-12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8.tar.gz GpgFrontend-12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8.zip |
feat: upgrade module system
1. load module and resolve symbols at runtime
2. restrict sdk functions and structures to c style
3. add some core api to support it
Diffstat (limited to 'src/core/utils/CommonUtils.cpp')
-rw-r--r-- | src/core/utils/CommonUtils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp index 0b182241..36dfe0a7 100644 --- a/src/core/utils/CommonUtils.cpp +++ b/src/core/utils/CommonUtils.cpp @@ -71,4 +71,14 @@ auto CompareSoftwareVersion(const QString& a, const QString& b) -> int { return 0; } + +auto GPGFRONTEND_CORE_EXPORT 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; +} } // namespace GpgFrontend
\ No newline at end of file |