resources: tool: Fix a compiler warning
[platform/upstream/glib.git] / gio / gresource-tool.c
index 3e0d95c..58aea8d 100644 (file)
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <locale.h>
 
 #ifdef HAVE_LIBELF
 #include <libelf.h>
@@ -92,7 +93,7 @@ list_resource (GResource   *resource,
       if (g_resource_get_info (resource, child, 0, &size, &flags, NULL))
         {
           if (details)
-            g_print ("%s%s%6ld %s %s\n", section, section[0] ? " " : "", size, flags & G_RESOURCE_FLAGS_COMPRESSED ? "c" : "u", child);
+            g_print ("%s%s%6"G_GSIZE_FORMAT " %s %s\n", section, section[0] ? " " : "", size, flags & G_RESOURCE_FLAGS_COMPRESSED ? "c" : "u", child);
           else
             g_print ("%s\n", child);
         }
@@ -580,6 +581,26 @@ main (int argc, char *argv[])
   gboolean details = FALSE;
   void (* function) (const gchar *, const gchar *, const gchar *, gboolean);
 
+#ifdef G_OS_WIN32
+  extern gchar *_glib_get_locale_dir (void);
+  gchar *tmp;
+#endif
+
+  setlocale (LC_ALL, "");
+  textdomain (GETTEXT_PACKAGE);
+
+#ifdef G_OS_WIN32
+  tmp = _glib_get_locale_dir ();
+  bindtextdomain (GETTEXT_PACKAGE, tmp);
+  g_free (tmp);
+#else
+  bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+#endif
+
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
   g_type_init ();
 
   if (argc < 2)