[geocode-glib] lib: Fix building for Windows platform



commit 22f7ce58048ddc7d758df4cf61c319e915591890
Author: Biswapriyo Nath <nathbappai gmail com>
Date:   Fri Jul 1 21:03:36 2022 +0530

    lib: Fix building for Windows platform
    
    This fixes two build errors in Windows platform.
    ../geocode-glib/geocode-glib.c:30:10: fatal error: langinfo.h: No such file or directory
    ../geocode-glib/geocode-glib.c:233:63: error: 'LC_MESSAGES' undeclared (first use in this function)
    
    More info about setlocale function here
    https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale

 geocode-glib/geocode-glib.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/geocode-glib/geocode-glib.c b/geocode-glib/geocode-glib.c
index 8687fec..61aeebe 100644
--- a/geocode-glib/geocode-glib.c
+++ b/geocode-glib/geocode-glib.c
@@ -27,7 +27,9 @@
 #include <locale.h>
 #include <gio/gio.h>
 #include <libsoup/soup.h>
+#ifndef G_OS_WIN32
 #include <langinfo.h>
+#endif
 #include <geocode-glib/geocode-glib-private.h>
 
 /**
@@ -228,7 +230,11 @@ geocode_object_get_lang_for_locale (const char *locale)
 char *
 _geocode_object_get_lang (void)
 {
+#ifdef G_OS_WIN32
+       return geocode_object_get_lang_for_locale (setlocale (LC_ALL, NULL));
+#else
        return geocode_object_get_lang_for_locale (setlocale (LC_MESSAGES, NULL));
+#endif
 }
 
 #if defined(__GLIBC__) && !defined(__UCLIBC__)


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