[gimp] app: use g_str_has_suffix() in file_utils_file_get_ext()



commit 81aaa1decdd6fd74bfe629128a1e87726b626c2d
Author: Michael Natterer <mitch gimp org>
Date:   Sat Aug 2 15:55:32 2014 +0200

    app: use g_str_has_suffix() in file_utils_file_get_ext()
    
    g_strrstr() is wrong for checking for suffixes.

 app/file/file-utils.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/app/file/file-utils.c b/app/file/file-utils.c
index 32feca5..8823cf8 100644
--- a/app/file/file-utils.c
+++ b/app/file/file-utils.c
@@ -220,11 +220,11 @@ file_utils_file_get_ext (GFile *file)
   uri     = g_file_get_uri (file);
   uri_len = strlen (uri);
 
-  if (g_strrstr (uri, ".gz"))
+  if (g_str_has_suffix (uri, ".gz"))
     search_len = uri_len - 3;
-  else if (g_strrstr (uri, ".bz2"))
+  else if (g_str_has_suffix (uri, ".bz2"))
     search_len = uri_len - 4;
-  else if (g_strrstr (uri, ".xz"))
+  else if (g_str_has_suffix (uri, ".xz"))
     search_len = uri_len - 3;
   else
     search_len = uri_len;


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