From 24a6af9ac1e669bc1a61860eb89a9bb4769bce51 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 3 May 2024 07:48:17 +0200 Subject: [PATCH] core: convert save-profiledata to C++ Leave the code as is for now. Just replace membuffer by its C++ version. Signed-off-by: Berthold Stoeger --- Subsurface-mobile.pro | 2 +- core/CMakeLists.txt | 2 +- core/{save-profiledata.c => save-profiledata.cpp} | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) rename core/{save-profiledata.c => save-profiledata.cpp} (99%) diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index a421c7d6f..23f411ad6 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -105,7 +105,7 @@ SOURCES += subsurface-mobile-main.cpp \ core/qt-ble.cpp \ core/uploadDiveShare.cpp \ core/uploadDiveLogsDE.cpp \ - core/save-profiledata.c \ + core/save-profiledata.cpp \ core/xmlparams.cpp \ core/settings/qPref.cpp \ core/settings/qPrefCloudStorage.cpp \ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e8867217f..f9d945557 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -158,7 +158,7 @@ set(SUBSURFACE_CORE_LIB_SRCS save-git.cpp save-html.cpp save-html.h - save-profiledata.c + save-profiledata.cpp save-xml.cpp selection.cpp selection.h diff --git a/core/save-profiledata.c b/core/save-profiledata.cpp similarity index 99% rename from core/save-profiledata.c rename to core/save-profiledata.cpp index fa83e5bb1..a560eb19d 100644 --- a/core/save-profiledata.c +++ b/core/save-profiledata.cpp @@ -246,7 +246,7 @@ void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, i int save_profiledata(const char *filename, bool select_only) { - struct membuffer buf = { 0 }; + struct membufferpp buf; FILE *f; int error = 0; @@ -265,6 +265,5 @@ int save_profiledata(const char *filename, bool select_only) if (error) report_error("Save failed (%s)", strerror(errno)); - free_buffer(&buf); return error; }