env.AppendUnique(CXXFLAGS=['/wd4244', '/wd4267', '/wd4355', '/wd4800', '/wd4996', '/wd4820', '/wd4514', '/wd4365', '/wd4503'])
env.AppendUnique(CCFLAGS=['/EHsc'])
+ vs_version = env['MSVC_VERSION']
+
# Enable special exports for unit test purposes
if env.get('TEST') == '1':
env.AppendUnique(CPPDEFINES = ['ENABLE_TEST_EXPORTS'])
if env.get('RELEASE'):
env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
env.AppendUnique(CPPDEFINES = ['NDEBUG'])
- else:
+ elif env.get('TARGET_ARCH') in ['x86', 'x86_64'] or "14.0" in vs_version:
env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/ZI', '/RTC1', '/Gm'])
env.AppendUnique(LINKFLAGS = ['/debug'])
+ else:
+ env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/Zi', '/RTC1', '/Gm'])
+ env.AppendUnique(LINKFLAGS = ['/debug'])
env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
env.AppendUnique(PATH = os.environ['PATH'])
/* #undef size_t */
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define ssize_t SSIZE_T
-#define snprintf _snprintf
+#define snprintf vs12_snprintf
#endif
#if defined(_WIN32)
#define MSG_DONTWAIT 0
#define _POSIX_C_SOURCE 200809L
#endif
+#include "platform_features.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
# define strncasecmp _strnicmp
# define strtok_r strtok_s
# if _MSC_VER && (_MSC_VER < 1900)
-# include "vs12_snprintf.h"
+# include "windows/include/vs12_snprintf.h"
# endif
# define ssize_t SSIZE_T
# define F_OK 0
# ifdef __cplusplus
# define SUPPORTS_DEFAULT_CTOR
# endif
-# include "win_sleep.h"
-# include "pthread_create.h"
+# include "windows/include/win_sleep.h"
+# include "windows/include/pthread_create.h"
#endif
#ifdef HAVE_WINSOCK2_H
va_start(args, format);
- length = _snprintf(buffer, count, format, args);
+ length = _vsnprintf(buffer, count, format, args);
va_end(args);
return 0;
}
+#ifdef HAVE_SNPRINTF
p += snprintf((char *) p, buf + len - p + 1, ":%d", port);
+#else /* HAVE_SNPRINTF */
+ /* @todo manual conversion of port number */
+#endif /* HAVE_SNPRINTF */
return buf + len - p;
#else /* HAVE_ARPA_INET_H */
}
#endif /* WITH_CONTIKI */
+#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
/* Helper functions for conditional output of character sequences into
* a given buffer. The first Offset characters are skipped.
target_files += [ os.path.join(src_dir,
'linux/caipnwmonitor.c') ]
-if target_os in ['windows', 'msys_nt']:
+if target_os in ['msys_nt']:
target_files += [ os.path.join(src_dir, 'windows/caipnwmonitor.c') ]
# The list of BLE adapter source files is a combination of both the
if (*port) // use the given port
{
int on = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof (on)))
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, OPTVAL_T(&on), sizeof (on)))
{
OIC_LOG_V(ERROR, TAG, "SO_REUSEADDR failed: %s", CAIPS_GET_ERROR);
#ifdef _WIN32
OIC_LOG_V(ERROR, TAG, " IPv4 IP_ADD_MEMBERSHIP failed: %s", CAIPS_GET_ERROR);
}
}
- ret = setsockopt(caglobals.ip.m4s.fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof (mreq));
+ ret = setsockopt(caglobals.ip.m4s.fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, OPTVAL_T(&mreq), sizeof (mreq));
if (-1 == ret)
{
#if !defined(WSAEINVAL)
{
struct ipv6_mreq mreq = {.ipv6mr_multiaddr = *addr,
.ipv6mr_interface = ifindex };
- int ret = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof (mreq));
+ int ret = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, OPTVAL_T(&mreq), sizeof (mreq));
if (-1 == ret)
{
#if !defined(_WIN32)
*
******************************************************************/
+#include "platform_features.h"
#include "gtest/gtest.h"
#include "cainterface.h"
#include "cautilinterface.h"
Import('env')
import os
-env.AppendUnique(CPPPATH = [os.path.join(Dir('.').abspath, 'include')])
+env.AppendUnique(CPPPATH = [os.path.join(Dir('.').abspath, 'include'),
+ '../../c_common'
+ ])
if env.get('TARGET_OS') in ['arduino']:
env.AppendUnique(CPPPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common/oic_string/include')])
// clock_gettime() support.
#ifdef HAVE_UNISTD_H
#include <unistd.h>
-
-// if we have unistd.h, we're a Unix system
+#endif
#include <time.h>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include "logger.h"
#include "string.h"
#include "logger_types.h"
+#include "platform_features.h"
#ifndef __TIZEN__
static oc_log_ctx_t *logCtx = 0;
provisioning_env.AppendUnique(CPPPATH = ['../../../../extlibs/sqlite3'])
provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
-provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
+if target_os not in ['windows']:
+ provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
if target_os not in ['windows', 'msys_nt']:
provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
}
bool PMGenerateQuery(bool isSecure,
- const char* address, const uint16_t port,
- const OCConnectivityType connType,
+ const char* address, uint16_t port,
+ OCConnectivityType connType,
char* buffer, size_t bufferSize, const char* uri)
{
if(!address || !buffer || !uri)
void SRMDeInitPolicyEngine()
{
- return DeInitPolicyEngine(&g_policyEngineContext);
+ DeInitPolicyEngine(&g_policyEngineContext);
}
bool SRMIsSecurityResourceURI(const char* uri)
template<>
struct AttributeTypeConvert<std::vector<uint8_t>>
{
- constexpr static AttributeType type = AttributeType::Binary;
+ BOOST_STATIC_CONSTEXPR AttributeType type = AttributeType::Binary;
};
std::ostream& operator << (std::ostream& os, const AttributeType at);
{
typedef std::vector<uint8_t> type;
typedef std::vector<uint8_t> base_type;
- constexpr static AttributeType enum_type = AttributeType::Binary;
- constexpr static AttributeType enum_base_type = AttributeType::Binary;
- constexpr static size_t depth = 0;
+ BOOST_STATIC_CONSTEXPR AttributeType enum_type = AttributeType::Binary;
+ BOOST_STATIC_CONSTEXPR AttributeType enum_base_type = AttributeType::Binary;
+ BOOST_STATIC_CONSTEXPR size_t depth = 0;
};
#include <vector>
#include <cstdio>
#include <iostream>
-
#include <ctime>
-
#include <timer.h>
-#if defined(_MSC_VER) && (_MSC_VER < 1900)
-/** @todo: Ensure null termination. This is not identical */
-#define snprintf _snprintf
-#endif
using namespace std;