diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 92c16319e..208fb5258 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1011,9 +1011,9 @@ std::string get_current_date() static QMutex hashOfMutex; static QHash localFilenameOf; -static const QString hashfile_name() +std::string hashfile_name() { - return QString(system_default_directory()).append("/hashes"); + return std::string(system_default_directory()) + "/hashes"; } static QString thumbnailDir() @@ -1031,11 +1031,6 @@ QString thumbnailFileName(const QString &filename) return thumbnailDir() + hash.result().toHex(); } -char *hashfile_name_string() -{ - return copy_qstring(hashfile_name()); -} - // TODO: This is a temporary helper struct. Remove in due course with convertLocalFilename(). struct HashToFile { QByteArray hash; @@ -1078,7 +1073,7 @@ static void convertLocalFilename(const QHash &hashOf, const void read_hashes() { - QFile hashfile(hashfile_name()); + QFile hashfile(QString::fromStdString(hashfile_name())); if (hashfile.open(QIODevice::ReadOnly)) { QDataStream stream(&hashfile); QHash localFilenameByHash; @@ -1102,7 +1097,7 @@ void read_hashes() void write_hashes() { - QSaveFile hashfile(hashfile_name()); + QSaveFile hashfile(QString::fromStdString(hashfile_name())); QMutexLocker locker(&hashOfMutex); if (hashfile.open(QIODevice::WriteOnly)) { diff --git a/core/qthelper.h b/core/qthelper.h index f6d6b5a65..27497f7c3 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -111,7 +111,7 @@ bool canReachCloudServer(struct git_info *); void updateWindowTitle(); void subsurface_mkdir(const char *dir); std::string local_file_path(const struct picture &picture); -char *hashfile_name_string(); +std::string hashfile_name(); enum deco_mode decoMode(bool in_planner); void parse_seabear_header(const char *filename, struct xml_params *params); time_t get_dive_datetime_from_isostring(char *when); diff --git a/core/subsurfacestartup.cpp b/core/subsurfacestartup.cpp index 9cfd9f7f9..e74db52f4 100644 --- a/core/subsurfacestartup.cpp +++ b/core/subsurfacestartup.cpp @@ -63,9 +63,7 @@ void print_files() printf("Unable to get local git directory\n"); } printf("Cloud URL: %s\n", filename->c_str()); - char *tmp = hashfile_name_string(); - printf("Image filename table: %s\n", tmp); - free(tmp); + printf("Image filename table: %s\n", hashfile_name().c_str()); } static void print_help()