From d20e88fd114afb5cce17699ac2afea440a30f87d Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 26 Jan 2016 23:23:42 +0800 Subject: [PATCH] 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 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c index d6c1d6f9b..fd9759341 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)