From 12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8 Mon Sep 17 00:00:00 2001 From: saturneric Date: Thu, 29 Feb 2024 00:32:43 +0800 Subject: 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 --- src/core/utils/CommonUtils.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/core/utils/CommonUtils.cpp') 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(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 -- cgit v1.2.3