[glib] glib/strfuncs.c: Fix Build on Windows



commit 4cad3f5e1bc88e626450607ca8c6b59265d7242b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Sep 2 16:09:58 2015 +0800

    glib/strfuncs.c: Fix Build on Windows
    
    Windows does not have strerror_r(), but does have strerror_s(), which is
    threadsafe, and does more or less the same thing, so use it on Windows to
    fix the build.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754431

 glib/gstrfuncs.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index d8c5e42..f1085a1 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -1261,7 +1261,12 @@ g_strerror (gint errnum)
   /* Since we are building with _GNU_SOURCE, we get the
    * GNU variant of strerror_r (with glibc).
    */
+#ifdef G_OS_WIN32
+  strerror_s (buf, sizeof (buf), errnum);
+  msg = buf;
+#else
   msg = strerror_r (errnum, buf, sizeof (buf));
+#endif
   if (!g_get_charset (NULL))
     {
       msg = tofree = g_locale_to_utf8 (msg, -1, NULL, NULL, &error);


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