From 099b571c1c4f46c465463d8d7ea858e959755147 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Wed, 20 May 2020 11:54:33 +0100 Subject: [PATCH] Bug fix #268: Picture diff or picture compare feature https://github.com/BestImageViewer/geeqie/issues/268 Fix illogical logic Fix initialization Documentation update --- doc/docbook/GuideImageSearchFindingDuplicates.xml | 6 ++++++ src/dupe.c | 9 +++++---- src/dupe.h | 2 +- src/rcfile.c | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/docbook/GuideImageSearchFindingDuplicates.xml b/doc/docbook/GuideImageSearchFindingDuplicates.xml index d724667d..74eaa95e 100644 --- a/doc/docbook/GuideImageSearchFindingDuplicates.xml +++ b/doc/docbook/GuideImageSearchFindingDuplicates.xml @@ -143,6 +143,9 @@ Show images with the same name but different content. + + Because pairs of files are being compared, when there are multiple hits care should be taken when analyzing the results. + @@ -153,6 +156,9 @@ Show images with the same name, ignoring case, but different content. + + Because pairs of files are being compared, when there are multiple hits care should be taken when analyzing the results. + diff --git a/src/dupe.c b/src/dupe.c index 66d64460..359bb246 100644 --- a/src/dupe.c +++ b/src/dupe.c @@ -1206,8 +1206,8 @@ static gboolean dupe_match(DupeItem *a, DupeItem *b, DupeMatchType mask, gdouble { if (!a->md5sum) a->md5sum = md5_text_from_file_utf8(a->fd->path, ""); if (!b->md5sum) b->md5sum = md5_text_from_file_utf8(b->fd->path, ""); - if (a->md5sum[0] != '\0' || - b->md5sum[0] != '\0' || + if (a->md5sum[0] == '\0' || + b->md5sum[0] == '\0' || strcmp(a->md5sum, b->md5sum) != 0) { return TRUE; @@ -1228,8 +1228,8 @@ static gboolean dupe_match(DupeItem *a, DupeItem *b, DupeMatchType mask, gdouble { if (!a->md5sum) a->md5sum = md5_text_from_file_utf8(a->fd->path, ""); if (!b->md5sum) b->md5sum = md5_text_from_file_utf8(b->fd->path, ""); - if (a->md5sum[0] != '\0' || - b->md5sum[0] != '\0' || + if (a->md5sum[0] == '\0' || + b->md5sum[0] == '\0' || strcmp(a->md5sum, b->md5sum) != 0) { return TRUE; @@ -3535,6 +3535,7 @@ DupeWindow *dupe_window_new() if (options->duplicates_match == DUPE_MATCH_NAME_CI) dw->match_mask = DUPE_MATCH_NAME_CI; if (options->duplicates_match == DUPE_MATCH_NAME_CONTENT) dw->match_mask = DUPE_MATCH_NAME_CONTENT; if (options->duplicates_match == DUPE_MATCH_NAME_CI_CONTENT) dw->match_mask = DUPE_MATCH_NAME_CI_CONTENT; + if (options->duplicates_match == DUPE_MATCH_ALL) dw->match_mask = DUPE_MATCH_ALL; dw->window = window_new(GTK_WINDOW_TOPLEVEL, "dupe", NULL, NULL, _("Find duplicates")); DEBUG_NAME(dw->window); diff --git a/src/dupe.h b/src/dupe.h index 1aab6f7c..ec33b2a7 100644 --- a/src/dupe.h +++ b/src/dupe.h @@ -41,7 +41,7 @@ typedef enum DUPE_MATCH_NAME_CI = 1 << 10, /* same as name, but case insensitive */ DUPE_MATCH_NAME_CONTENT = 1 << 11, /* same name, but different content */ DUPE_MATCH_NAME_CI_CONTENT = 1 << 12, /* same name - case insensitive, but different content */ - DUPE_MATCH_ALL = 1 << 13 + DUPE_MATCH_ALL = 1 << 13 /* N.B. this is used as a clamp value in rcfile.c */ } DupeMatchType; typedef enum diff --git a/src/rcfile.c b/src/rcfile.c index 541278d6..d6b62ba5 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -742,7 +742,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar ** if (READ_BOOL(*options, update_on_time_change)) continue; if (READ_UINT_CLAMP(*options, duplicates_similarity_threshold, 0, 100)) continue; - if (READ_UINT_CLAMP(*options, duplicates_match, 0, DUPE_MATCH_NAME_CI)) continue; + if (READ_UINT_CLAMP(*options, duplicates_match, 0, DUPE_MATCH_ALL)) continue; if (READ_UINT_CLAMP(*options, duplicates_select_type, 0, DUPE_SELECT_GROUP2)) continue; if (READ_BOOL(*options, duplicates_thumbnails)) continue; if (READ_BOOL(*options, rot_invariant_sim)) continue; -- 2.20.1