See the attached patch which adds the MIT-licensed strncopy. It doesn't try to load a system-supplied copy first, which will likely need compiler-probing or hardcoding the OSes where the replacement is needed.
Adding this patch makes the module compile and install and Net::CalDAVTalk install and test.
If you want, I can publish this as a git (github) repository
From 19de9ce6dab9dd788423c9e297d174f9a7eef1b1 Mon Sep 17 00:00:00 2001
From: Max Maischein <corion@corion.net>
Date: Fri, 3 Feb 2017 17:42:33 +0100
Subject: [PATCH 1/2] Unconditionally load our own strndup()
---
VCardFast.xs | 1 +
strndup.c | 16 ++++++++++++++++
strndup.h | 6 ++++++
3 files changed, 23 insertions(+)
create mode 100644 strndup.c
create mode 100644 strndup.h
diff --git a/VCardFast.xs b/VCardFast.xs
index 9813c5a..9fb77c6 100644
--- a/VCardFast.xs
+++ b/VCardFast.xs
@@ -5,6 +5,7 @@
#include "ppport.h"
#include "vparse.h"
+#include "strndup.h"
// hv_store to array, create if not exists - from XML::Fast 0.11
#define hv_store_aa( hv, kv, kl, sv ) \
diff --git a/strndup.c b/strndup.c
new file mode 100644
index 0000000..d02657d
--- /dev/null
+++ b/strndup.c
@@ -0,0 +1,16 @@
+#ifndef HAVE_STRNDUP
+
+#include <stdlib.h>
+#include <string.h>
+
+char *strndup(const char *s, size_t n)
+{
+ char* new = malloc(n+1);
+ if (new) {
+ strncpy(new, s, n);
+ new[n] = '\0';
+ }
+ return new;
+}
+
+#endif /* HAVE_STRNDUP */
diff --git a/strndup.h b/strndup.h
new file mode 100644
index 0000000..2f49b76
--- /dev/null
+++ b/strndup.h
@@ -0,0 +1,6 @@
+#ifndef HAVE_STRNDUP
+#define HAVE_STRNDUP
+
+char *strndup(const char *s, size_t n);
+
+#endif /* HAVE_STRNDUP */
--
2.5.0.windows.1
From f2695eddc957563ec8d3cef8a90a85b9a205c8d3 Mon Sep 17 00:00:00 2001
From: Max Maischein <corion@corion.net>
Date: Fri, 3 Feb 2017 17:42:37 +0100
Subject: [PATCH 2/2] Sort MANIFEST
---
MANIFEST | 56 +++++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/MANIFEST b/MANIFEST
index 3bbfbfc..7c379bd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,41 +1,43 @@
+benchmark/bench.pl
Changes
+lib/Text/VCardFast.pm
Makefile.PL
MANIFEST
+META.json Module JSON meta-data (added by MakeMaker)
+META.yml Module YAML meta-data (added by MakeMaker)
ppport.h
README
-VCardFast.xs
-vparse.c
-vparse.h
-benchmark/bench.pl
-lib/Text/VCardFast.pm
-t/Text-VCardFast.t
-t/Errors.t
+strndup.c
+strndup.h
t/Cases.t
-t/Create.t
-t/Trailing.t
-t/cases/wp-v3.vcf
-t/cases/trailingslash.vcf
-t/cases/fm.json
-t/cases/rfcex1-v3.json
t/cases/ex-apple.json
+t/cases/ex-apple.vcf
t/cases/ex-cobook.json
-t/cases/ex2-v4.vcf
t/cases/ex-cobook.vcf
-t/cases/wp-v3.json
+t/cases/ex-google.json
+t/cases/ex-google.vcf
t/cases/ex-memotoo.json
-t/cases/wp-v4.vcf
-t/cases/ex-apple.vcf
-t/cases/wp-v4.json
-t/cases/ex-v4.json
t/cases/ex-memotoo.vcf
+t/cases/ex-v4.json
+t/cases/ex-v4.vcf
+t/cases/ex2-v4.json
+t/cases/ex2-v4.vcf
+t/cases/fm.json
+t/cases/fm.vcf
+t/cases/rfcex1-v3.json
+t/cases/rfcex1-v3.vcf
t/cases/trailingslash.json
+t/cases/trailingslash.vcf
t/cases/unicode.json
-t/cases/rfcex1-v3.vcf
t/cases/unicode.vcf
-t/cases/ex2-v4.json
-t/cases/ex-google.json
-t/cases/ex-v4.vcf
-t/cases/ex-google.vcf
-t/cases/fm.vcf
-META.yml Module YAML meta-data (added by MakeMaker)
-META.json Module JSON meta-data (added by MakeMaker)
+t/cases/wp-v3.json
+t/cases/wp-v3.vcf
+t/cases/wp-v4.json
+t/cases/wp-v4.vcf
+t/Create.t
+t/Errors.t
+t/Text-VCardFast.t
+t/Trailing.t
+VCardFast.xs
+vparse.c
+vparse.h
--
2.5.0.windows.1