mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
core: use std::string for hashfile_name
One more free() removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ec92cff92c
commit
5805b14734
3 changed files with 6 additions and 13 deletions
|
@ -1011,9 +1011,9 @@ std::string get_current_date()
|
|||
static QMutex hashOfMutex;
|
||||
static QHash<QString, QString> 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<QString, QByteArray> &hashOf, const
|
|||
|
||||
void read_hashes()
|
||||
{
|
||||
QFile hashfile(hashfile_name());
|
||||
QFile hashfile(QString::fromStdString(hashfile_name()));
|
||||
if (hashfile.open(QIODevice::ReadOnly)) {
|
||||
QDataStream stream(&hashfile);
|
||||
QHash<QByteArray, QString> 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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue