diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-06-28 11:57:21 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-06-28 11:57:21 +0200 |
commit | ab0f01c381c16ed61b8258582869912d4c38cbb7 (patch) | |
tree | b8935e0008795fee2a487cf4512a93a1abf8e262 /NK_C_API.cc | |
parent | 8f7435e4553916e6cc431e4b5316cc5861fd9063 (diff) | |
download | libnitrokey-ab0f01c381c16ed61b8258582869912d4c38cbb7.tar.gz libnitrokey-ab0f01c381c16ed61b8258582869912d4c38cbb7.tar.bz2 |
Adjust code to make compilation under MSVC 2017
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r-- | NK_C_API.cc | 11 |
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; |