Fix #874: Travis CI fails
authorColin Clark <colin.clark@cclark.uk>
Mon, 7 Jun 2021 12:19:07 +0000 (13:19 +0100)
committerColin Clark <colin.clark@cclark.uk>
Mon, 7 Jun 2021 12:19:07 +0000 (13:19 +0100)
https://github.com/BestImageViewer/geeqie/issues/874

g_array_binary_search() requires >= glib 2.62

For earlier versions make a linear search.

src/dupe.c

index d1c73ab..f9c624e 100644 (file)
@@ -1850,6 +1850,7 @@ static void dupe_array_check(DupeWindow *dw )
        DupeMatchType mask = dw->match_mask;
        param_match_mask = dw->match_mask;
        guint out_match_index;
+       gboolean match_found = FALSE;;
 
        if (!dw->list) return;
 
@@ -1895,7 +1896,27 @@ static void dupe_array_check(DupeWindow *dw )
                                                continue;
                                                }
                                        }
-                               if (g_array_binary_search(array_set2, di1, dupe_match_binary_search_cb, &out_match_index))
+
+#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 62))
+                               match_found = g_array_binary_search(array_set2, di1, dupe_match_binary_search_cb, &out_match_index);
+#else
+                               gint i;
+
+                               match_found = FALSE;
+                               for(i=0; i < array_set2->len; i++)
+                                       {
+                                       di2 = g_array_index(array_set2,  gpointer, i);
+                                       check_result = dupe_match_check(di1, di2, dw);
+                                       if (check_result == DUPE_MATCH)
+                                               {
+                                               match_found = TRUE;
+                                               out_match_index = i;
+                                               break;
+                                               }
+                                       }
+#endif
+
+                               if (match_found)
                                        {
                                        di2 = g_array_index(array_set2, gpointer, out_match_index);