Bug fix #268: Picture diff or picture compare feature
authorColin Clark <colin.clark@cclark.uk>
Wed, 20 May 2020 10:54:33 +0000 (11:54 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 20 May 2020 10:54:33 +0000 (11:54 +0100)
https://github.com/BestImageViewer/geeqie/issues/268

Fix illogical logic
Fix initialization
Documentation update

doc/docbook/GuideImageSearchFindingDuplicates.xml
src/dupe.c
src/dupe.h
src/rcfile.c

index d724667..74eaa95 100644 (file)
         <listitem>\r
           <para>\r
             Show images with the same name but different content.\r
+            <note>\r
+              <para>Because pairs of files are being compared, when there are multiple hits care should be taken when analyzing the results.</para>\r
+            </note>\r
           </para>\r
         </listitem>\r
       </varlistentry>\r
         <listitem>\r
           <para>\r
             Show images with the same name, ignoring case, but different content.\r
+            <note>\r
+              <para>Because pairs of files are being compared, when there are multiple hits care should be taken when analyzing the results.</para>\r
+            </note>\r
           </para>\r
         </listitem>\r
       </varlistentry>\r
index 66d6446..359bb24 100644 (file)
@@ -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);
index 1aab6f7..ec33b2a 100644 (file)
@@ -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
index 541278d..d6b62ba 100644 (file)
@@ -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;