summaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 0e3fa1f..db87d90 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -5,6 +5,17 @@
#include "include/LibraryException.h"
#include "include/cxx_semantics.h"
+#ifdef _WIN32
+#pragma message "Using own strndup"
+char * strndup(const char* str, size_t maxlen) {
+ size_t len = strnlen(str, maxlen);
+ char* dup = (char *)malloc(len + 1);
+ memcpy(dup, str, len);
+ dup[len] = 0;
+ return dup;
+}
+#endif
+
using namespace nitrokey;
static uint8_t NK_last_command_status = 0;