[glib] gwinhttpfile.c: Fix build on Visual Studio



commit d20e88fd114afb5cce17699ac2afea440a30f87d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jan 26 23:23:42 2016 +0800

    gwinhttpfile.c: Fix build on Visual Studio
    
    Visual Studio, at least the older versions, cannot use L on macros which
    are defined as a constant string, plus the L must be applied to all string
    literals here.  This does not look nice, but this is life...

 gio/win32/gwinhttpfile.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
index d6c1d6f..fd97593 100644
--- a/gio/win32/gwinhttpfile.c
+++ b/gio/win32/gwinhttpfile.c
@@ -548,12 +548,15 @@ g_winhttp_file_query_info (GFile                *file,
     {
       gint64 cl;
       int n;
+      const char *gint64_format = "%"G_GINT64_FORMAT"%n";
+      wchar_t *gint64_format_w = g_utf8_to_utf16 (gint64_format, -1, NULL, NULL, NULL);
 
-      if (swscanf (content_length, L"%"G_GINT64_FORMAT"%n", &cl, &n) == 1 &&
+      if (swscanf (content_length, gint64_format_w, &cl, &n) == 1 &&
           n == wcslen (content_length))
         g_file_info_set_size (info, cl);
 
       g_free (content_length);
+      g_free (gint64_format_w);
     }
 
   if (matcher == NULL)


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