summaryrefslogtreecommitdiffstats
path: root/core/qthelper.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-02-18 16:22:34 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-03-05 18:04:57 +0200
commitbdc470a80e0260011e3dfc4d949df8f9e222f73f (patch)
tree625c26f2f754a56929d2f8880170c38b8f7d779b /core/qthelper.h
parente5dcd9fc161891a4e70364e1dcdf232590eb49c6 (diff)
downloadsubsurface-bdc470a80e0260011e3dfc4d949df8f9e222f73f.tar.gz
Cleanup: Remove hash field from picture-structure
The hash field in the picture-structure was in principle non-operational. It was set on loading, but never actually changed. The authoritative hash comes from the filename->hash map. Therefore, make this explicit by removing the hash field from the picture structure. Instead of filling the picture structure on loading, add the hash directly to the filename->hash map. This is done in the register_hash() function, which does not overwrite old entries. I.e. the local hash has priority over the save-file. This policy might be refined in the future. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/qthelper.h')
-rw-r--r--core/qthelper.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/qthelper.h b/core/qthelper.h
index 516990005..74d2af396 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -34,12 +34,12 @@ void read_hashes();
void write_hashes();
void updateHash(struct picture *picture);
QByteArray hashFile(const QString &filename);
+QString hashString(const char *filename);
void learnImages(const QDir dir, int max_recursions);
void add_hash(const QString &filename, const QByteArray &hash);
void hashPicture(struct picture *picture);
extern "C" char *hashstring(const char *filename);
QString localFilePath(const QString &originalFilename);
-QString fileFromHash(const char *hash);
void learnHash(const QString &originalName, const QString &localName, const QByteArray &hash);
weight_t string_to_weight(const char *str);
depth_t string_to_depth(const char *str);
@@ -74,10 +74,11 @@ void subsurface_mkdir(const char *dir);
char *get_file_name(const char *fileName);
void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName);
char *hashstring(const char *filename);
+void register_hash(const char *filename, const char *hash);
bool picture_exists(struct picture *picture);
char *move_away(const char *path);
const char *local_file_path(struct picture *picture);
-void savePictureLocal(struct picture *picture, const char *data, int len);
+void savePictureLocal(struct picture *picture, const char *hash, const char *data, int len);
void cache_picture(struct picture *picture);
char *cloud_url();
char *hashfile_name_string();