From be3a4978858e9952d3cb5f796da9126957760842 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 28 Feb 2024 06:33:44 +0100 Subject: [PATCH] core: port subsurface-startup.c to C++ Signed-off-by: Berthold Stoeger --- Subsurface-mobile.pro | 2 +- core/CMakeLists.txt | 2 +- core/{subsurfacestartup.c => subsurfacestartup.cpp} | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) rename core/{subsurfacestartup.c => subsurfacestartup.cpp} (96%) diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 80bede346..e8d43bfbf 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -43,7 +43,7 @@ SOURCES += subsurface-mobile-main.cpp \ core/windowtitleupdate.cpp \ core/file.c \ core/fulltext.cpp \ - core/subsurfacestartup.c \ + core/subsurfacestartup.cpp \ core/pref.c \ core/profile.c \ core/device.cpp \ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index f5166a6ae..fbc9c8013 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -173,7 +173,7 @@ set(SUBSURFACE_CORE_LIB_SRCS strtod.c subsurface-float.h subsurface-string.h - subsurfacestartup.c + subsurfacestartup.cpp subsurfacestartup.h subsurfacesysinfo.cpp subsurfacesysinfo.h diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.cpp similarity index 96% rename from core/subsurfacestartup.c rename to core/subsurfacestartup.cpp index 4a97a683f..23e91bd4f 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.cpp @@ -25,7 +25,7 @@ char *testqml = NULL; */ bool imported = false; -void print_version() +extern "C" void print_version() { static bool version_printed = false; if (version_printed) @@ -43,7 +43,7 @@ void print_version() version_printed = true; } -void print_files() +extern "C" void print_files() { struct git_info info = { }; const char *filename; @@ -95,7 +95,7 @@ static void print_help() printf("\n --cloud-timeout= Set timeout for cloud connection (0 < timeout < 60)\n\n"); } -void parse_argument(const char *arg) +extern "C" void parse_argument(const char *arg) { const char *p = arg + 1; @@ -169,7 +169,7 @@ void parse_argument(const char *arg) } #elif SUBSURFACE_MOBILE_DESKTOP if (strncmp(arg, "--testqml=", sizeof("--testqml=") - 1) == 0) { - testqml = malloc(strlen(arg) - sizeof("--testqml=") + 1); + testqml = (char *)malloc(strlen(arg) - sizeof("--testqml=") + 1); strcpy(testqml, arg + sizeof("--testqml=") - 1); return; } @@ -198,7 +198,7 @@ void parse_argument(const char *arg) * I guess Burma and Liberia should trigger this too. I'm too * lazy to look up the territory names, though. */ -void setup_system_prefs(void) +extern "C" void setup_system_prefs(void) { const char *env;