[glib/wip/pwithnall/2119-osx-app-info: 2/3] gosxappinfo: Use strlen() instead of some magic constants




commit 2a629b3b4b63f03bd7d2d6da0e5d48ed36b20536
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Dec 9 11:44:14 2020 +0000

    gosxappinfo: Use strlen() instead of some magic constants
    
    This is equivalent, but makes the code a bit more readable.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/gosxappinfo.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gosxappinfo.m b/gio/gosxappinfo.m
index 0a9cd0501..bcb1f5648 100644
--- a/gio/gosxappinfo.m
+++ b/gio/gosxappinfo.m
@@ -283,7 +283,7 @@ create_urlspec_for_appinfo (GOsxAppInfo *info,
   const gchar *app_cstr = g_osx_app_info_get_filename (info);
 
   /* Strip file:// from app url but ensure filesystem url */
-  urlspec->appURL = create_url_from_cstr (app_cstr + 7, TRUE);
+  urlspec->appURL = create_url_from_cstr (app_cstr + strlen ("file://"), TRUE);
   urlspec->launchFlags = kLSLaunchDefaults;
   urlspec->itemURLs = create_url_list_from_glist (uris, are_files);
 
@@ -440,7 +440,7 @@ g_osx_app_info_get_icon (GAppInfo *appinfo)
         return NULL;
 
       app_uri = g_osx_app_info_get_filename (info);
-      icon_uri = g_strconcat (app_uri + 7, "/Contents/Resources/", icon_name,
+      icon_uri = g_strconcat (app_uri + strlen ("file://"), "/Contents/Resources/", icon_name,
                               g_str_has_suffix (icon_name, ".icns") ? NULL : ".icns", NULL);
       g_free (icon_name);
 


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