summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2019-04-18 17:25:48 +0900
committerOBATA Akio <obache@wizdas.com>2019-04-20 18:08:33 +0900
commitd3b49e3ec5524f2e16f96210f450ddb9f8f07070 (patch)
treefdd586c5075ea16a61e95c235ffa6319be76f2b0
parent25b1a428dd360603e8bf1b4fc5fc7e57b39867a3 (diff)
downloadtdenetwork-d3b49e3e.tar.gz
tdenetwork-d3b49e3e.zip
Change to dclare `strlcat` and `strlcpy` conditionally
They should be declared only for the case missing. Current prototype signatures should be for suppliment implementations in TDE core library. It may differ than platform builtin one, 3rd argment is `size_t', so it cause prototype mismatch for the case `size_t` != `unsigned long`. Signed-off-by: OBATA Akio <obache@wizdas.com>
-rw-r--r--ConfigureChecks.cmake3
-rw-r--r--config.h.cmake17
2 files changed, 19 insertions, 1 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 117d306b..4d5ad07a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -45,3 +45,6 @@ if( WITH_SLP )
tde_message_fatal( "openslp is required, but was not found on your system" )
endif( )
endif( )
+
+check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO )
+check_symbol_exists( strlcpy "string.h" HAVE_STRLCPY_PROTO )
diff --git a/config.h.cmake b/config.h.cmake
index 38def3f3..3bed93bc 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -62,9 +62,24 @@
// wifi
#cmakedefine WITHOUT_ARTS 1
+/* Define if you have the strlcat prototype */
+#cmakedefine HAVE_STRLCAT_PROTO
+
+/* Define if you have the strlcpy prototype */
+#cmakedefine HAVE_STRLCPY_PROTO
+
+#if !defined(HAVE_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C" {
-unsigned long strlcpy(char*, const char*, unsigned long);
unsigned long strlcat(char*, const char*, unsigned long);
}
#endif
+#endif
+
+#if !defined(HAVE_STRLCPY_PROTO)
+#ifdef __cplusplus
+extern "C" {
+unsigned long strlcpy(char*, const char*, unsigned long);
+}
+#endif
+#endif