summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2015-12-27 13:01:55 -0500
committerAllen Winter <allen.winter@kdab.com>2015-12-27 13:01:55 -0500
commit88ddfb1218b496a42bf0d1f74c5917c107797f2e (patch)
treedf2906b985254a57cfade2d84ff3b212d7c32a6f
parent0d3c7f326ff77a0e1eeb5e7f023d760d2a95b1f6 (diff)
downloadlibical-git-88ddfb1218b496a42bf0d1f74c5917c107797f2e.tar.gz
use cmake discovery for GetNumberFormat()
-rw-r--r--ConfigureChecks.cmake3
-rw-r--r--config.h.cmake3
-rw-r--r--src/libical/icalvalue.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 528404fb..b0da4b20 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -56,6 +56,9 @@ check_function_exists(iswspace HAVE_ISWSPACE) #Linux <wctype.h>
check_function_exists(setenv HAVE_SETENV)
check_function_exists(unsetenv HAVE_UNSETENV)
+set(CMAKE_REQUIRED_LIBRARIES kernel32.lib)
+check_function_exists(GetNumberFormat HAVE_GETNUMBERFORMAT) #Windows <windows.h>
+
include(CheckTypeSize)
check_type_size(intptr_t SIZEOF_INTPTR_T)
check_type_size(pid_t SIZEOF_PID_T)
diff --git a/config.h.cmake b/config.h.cmake
index 1ca8d3e6..1257d37f 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -15,6 +15,9 @@
/* Define to 1 if you have the <endian.h> header file. */
#cmakedefine HAVE_ENDIAN_H 1
+/* Define to 1 if you have the `GetNumberFormat' function. */
+#cmakedefine HAVE_GETNUMBERFORMAT 1
+
/* Define to 1 if you have the `gmtime_r' function. */
#cmakedefine HAVE_GMTIME_R 1
diff --git a/src/libical/icalvalue.c b/src/libical/icalvalue.c
index eb922c1c..be7658f4 100644
--- a/src/libical/icalvalue.c
+++ b/src/libical/icalvalue.c
@@ -372,7 +372,7 @@ static int simple_str_to_double(const char *from, double *result, char **to)
char *start = NULL, *end = NULL, *cur = (char *)from;
char tmp_buf[TMP_NUM_SIZE + 1]; /*hack */
-#if !defined(_WIN32_WCE)
+#if !defined(HAVE_GETNUMBERFORMAT)
struct lconv *loc_data = localeconv();
#endif
int i = 0;
@@ -408,7 +408,7 @@ static int simple_str_to_double(const char *from, double *result, char **to)
* care to have the (optional) decimal separator be the one
* of the current locale.
*/
-#if !defined(_WIN32_WCE)
+#if !defined(HAVE_GETNUMBERFORMAT)
for (i = 0; i < end - from; ++i) {
if (start[i] == '.' && loc_data && loc_data->decimal_point && loc_data->decimal_point[0]
&& loc_data->decimal_point[0] != '.') {