mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 11:40:39 +03:00
Windows: Update code to build on Windows
Add in specific _WIN32 definitions for the missing functionality from recent PR updates. R_OK (used by access()) strndup() strcasecmp()
This commit is contained in:
1 parent
03cc5791c5
commit
82a68f4457
3 files changed
+25
No files matched your search
@@ -21,6 +21,15 @@
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
static char* strndup(const char* s1, size_t n)
|
||||
{
|
||||
char* copy = (char*)malloc(n + 1);
|
||||
if (copy) {
|
||||
memcpy(copy, s1, n);
|
||||
copy[n] = 0;
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
@@ -23,6 +23,18 @@
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
#define R_OK 4
|
||||
#endif
|
||||
static char* strndup(const char* s1, size_t n)
|
||||
{
|
||||
char* copy = (char*)malloc(n + 1);
|
||||
if (copy) {
|
||||
memcpy(copy, s1, n);
|
||||
copy[n] = 0;
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
#define UNUSED
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
/* RFC6091/RFC7250 */
|
||||
#ifndef TLSEXT_TYPE_client_certificate_type
|
||||
#define TLSEXT_TYPE_client_certificate_type 19
|
||||
|
||||
Reference in new issue
Block a user