[tracker-miners/wip/carlosg/compiler-warnings: 5/8] tracker-extract: Avoid deprecated g_pattern_match*() API




commit ad3f8b2707ad5dc43d01fad9089df0522f56a56c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Aug 28 23:10:00 2022 +0200

    tracker-extract: Avoid deprecated g_pattern_match*() API
    
    If glib is greater than 2.70.0, use the newer API that replaces it.

 src/libtracker-extract/tracker-module-manager.c | 14 ++++++++++++--
 src/tracker-extract/tracker-extract-text.c      |  7 ++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-module-manager.c b/src/libtracker-extract/tracker-module-manager.c
index 266b6fc12..19b60999f 100644
--- a/src/libtracker-extract/tracker-module-manager.c
+++ b/src/libtracker-extract/tracker-module-manager.c
@@ -265,14 +265,24 @@ lookup_rules (const gchar *mimetype)
                info = &g_array_index (rules, RuleInfo, i);
 
                for (l = info->allow_patterns; l; l = l->next) {
-                       if (g_pattern_match (l->data, len, mimetype, reversed)) {
+#if GLIB_CHECK_VERSION (2, 70, 0)
+                       if (g_pattern_spec_match (l->data, len, mimetype, reversed))
+#else
+                       if (g_pattern_match (l->data, len, mimetype, reversed))
+#endif
+                       {
                                matched_allow_pattern = TRUE;
                                break;
                        }
                }
 
                for (l = info->block_patterns; l; l = l->next) {
-                       if (g_pattern_match (l->data, len, mimetype, reversed)) {
+#if GLIB_CHECK_VERSION (2, 70, 0)
+                       if (g_pattern_spec_match (l->data, len, mimetype, reversed))
+#else
+                       if (g_pattern_match (l->data, len, mimetype, reversed))
+#endif
+                       {
                                matched_block_pattern = TRUE;
                                break;
                        }
diff --git a/src/tracker-extract/tracker-extract-text.c b/src/tracker-extract/tracker-extract-text.c
index df6d1018a..cfe2c19c9 100644
--- a/src/tracker-extract/tracker-extract-text.c
+++ b/src/tracker-extract/tracker-extract-text.c
@@ -50,7 +50,12 @@ allow_file (GSList      *text_allowlist_patterns,
        basename = g_file_get_basename (file);
 
        for (l = text_allowlist_patterns; l; l = l->next) {
-               if (g_pattern_match_string (l->data, basename)) {
+#if GLIB_CHECK_VERSION (2, 70, 0)
+               if (g_pattern_spec_match_string (l->data, basename))
+#else
+               if (g_pattern_match_string (l->data, basename))
+#endif
+               {
                        return TRUE;
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]