diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9b50e6f5..f17e776a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,15 +28,18 @@ include_directories(${OPENSSL_INCLUDE}) if (CMAKE_SYSTEM MATCHES "Windows*") add_definitions (-DTARGET_WIN -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -D_UNICODE -D_CRT_SECURE_NO_WARNINGS) + set (TARGET_WIN ON) endif() if (CMAKE_SYSTEM MATCHES "Linux*") add_definitions (-DTARGET_LINUX -DHAVE_NETINET_IN_H) + set (TARGET_LINUX ON) endif() if (CMAKE_SYSTEM MATCHES "Darwin*") add_definitions (-DTARGET_OSX) + set (TARGET_OSX ON) endif() if (CMAKE_SYSTEM MATCHES "Android") @@ -45,10 +48,12 @@ if (CMAKE_SYSTEM MATCHES "Android") add_subdirectory (${OBOE_DIR} ./oboe) include_directories (${OBOE_DIR}/include) add_definitions(-DTARGET_ANDROID -DHAVE_NETINET_IN_H) + set (TARGET_ANDROID ON) endif() if (USE_MUSL) add_definitions(-DTARGET_MUSL) + set (TARGET_MUSL ON) endif() set (RTPHONE_SOURCES diff --git a/src/engine/agent/Agent_AudioManager.cpp b/src/engine/agent/Agent_AudioManager.cpp index 27d4cf79..2fd50bd0 100644 --- a/src/engine/agent/Agent_AudioManager.cpp +++ b/src/engine/agent/Agent_AudioManager.cpp @@ -6,6 +6,7 @@ #include "Agent_AudioManager.h" #include "../engine/audio/Audio_WavFile.h" #include "../engine/audio/Audio_Null.h" +#include "HL_String.h" #if defined(TARGET_ANDROID) # include "../engine/audio/Audio_Android.h" @@ -171,7 +172,7 @@ void AudioManager::startPlayFile(int usageId, const std::string& path, AudioTarg // Check if file exists Audio::PWavFileReader r = std::make_shared(); #ifdef TARGET_WIN - r->open(StringHelper::makeTstring(path)); + r->open(strx::makeTstring(path)); #else r->open(path); #endif diff --git a/src/engine/audio/Audio_DirectSound.h b/src/engine/audio/Audio_DirectSound.h index 2f394fe4..34e0c775 100644 --- a/src/engine/audio/Audio_DirectSound.h +++ b/src/engine/audio/Audio_DirectSound.h @@ -1,4 +1,4 @@ -/* Copyright(C) 2007-2017 VoIP objects (voipobjects.com) +/* Copyright(C) 2007-2025 VoIP objects (voipobjects.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -6,7 +6,7 @@ #ifndef __AUDIO_DSOUND_H #define __AUDIO_DSOUND_H -#include "../config.h" +#include "../engine_config.h" #include #include diff --git a/src/engine/audio/Audio_Null.cpp b/src/engine/audio/Audio_Null.cpp index c2f8f102..40cc18d9 100644 --- a/src/engine/audio/Audio_Null.cpp +++ b/src/engine/audio/Audio_Null.cpp @@ -1,6 +1,7 @@ #include "Audio_Null.h" #include "helper/HL_Log.h" #include +#include #define LOG_SUBSYSTEM "NULL audio" using namespace Audio; diff --git a/src/engine/audio/Audio_Wmme.h b/src/engine/audio/Audio_Wmme.h index c3e90c44..ba65f3bc 100644 --- a/src/engine/audio/Audio_Wmme.h +++ b/src/engine/audio/Audio_Wmme.h @@ -8,7 +8,7 @@ #ifdef TARGET_WIN -#include "../config.h" +#include "../engine_config.h" #include #include diff --git a/src/engine/helper/HL_String.cpp b/src/engine/helper/HL_String.cpp index 60fada4e..429c6905 100644 --- a/src/engine/helper/HL_String.cpp +++ b/src/engine/helper/HL_String.cpp @@ -423,3 +423,26 @@ std::string strx::removeQuotes(const std::string& s) return r; } + +#if defined(TARGET_WIN) + +// MSVC++ lacks memmem support +const void *memmem(const void *haystack, size_t haystack_len, + const void * const needle, const size_t needle_len) +{ + if (haystack == NULL) return NULL; // or assert(haystack != NULL); + if (haystack_len == 0) return NULL; + if (needle == NULL) return NULL; // or assert(needle != NULL); + if (needle_len == 0) return NULL; + + for (const char *h = (const char*)haystack; + haystack_len >= needle_len; + ++h, --haystack_len) { + if (!memcmp(h, needle, needle_len)) { + return h; + } + } + return nullptr; +} +#endif + diff --git a/src/engine/helper/HL_String.h b/src/engine/helper/HL_String.h index 17126c30..550ef114 100644 --- a/src/engine/helper/HL_String.h +++ b/src/engine/helper/HL_String.h @@ -84,4 +84,11 @@ public: }; +#if defined(TARGET_WIN) + +// MSVC++ lacks memmem support +extern const void *memmem(const void *haystack, size_t haystack_len, + const void * const needle, const size_t needle_len); +#endif + #endif diff --git a/src/engine/helper/HL_Sync.h b/src/engine/helper/HL_Sync.h index 3fb85b71..9eebc00e 100644 --- a/src/engine/helper/HL_Sync.h +++ b/src/engine/helper/HL_Sync.h @@ -14,6 +14,11 @@ #include #include +#if defined(TARGET_WIN) +# include +# include +#endif + typedef std::recursive_mutex Mutex; typedef std::unique_lock Lock; diff --git a/src/engine/media/MT_AmrCodec.cpp b/src/engine/media/MT_AmrCodec.cpp index cc32817e..d4eba761 100644 --- a/src/engine/media/MT_AmrCodec.cpp +++ b/src/engine/media/MT_AmrCodec.cpp @@ -6,6 +6,8 @@ #include "../helper/HL_Log.h" #include "../helper/HL_IuUP.h" +#include + #define LOG_SUBSYSTEM "AmrCodec" using namespace MT; diff --git a/src/engine/media/MT_AudioReceiver.cpp b/src/engine/media/MT_AudioReceiver.cpp index 7603c46d..ee891f1d 100644 --- a/src/engine/media/MT_AudioReceiver.cpp +++ b/src/engine/media/MT_AudioReceiver.cpp @@ -3,7 +3,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#define NOMINMAX +#if defined(TARGET_WIN) && !defined(NOMINMAX) +# define NOMINMAX +#endif #include "../engine_config.h" #include "MT_AudioReceiver.h" @@ -14,6 +16,7 @@ #include "../audio/Audio_Interface.h" #include "../audio/Audio_Resampler.h" #include +#include #if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) && defined(USE_AMR_CODEC) # include "MT_AmrCodec.h" diff --git a/src/libs/srtp/crypto/include/config.h b/src/libs/srtp/crypto/include/config.h index 93c91148..2e85af68 100644 --- a/src/libs/srtp/crypto/include/config.h +++ b/src/libs/srtp/crypto/include/config.h @@ -3,10 +3,6 @@ #define HAVE_STDLIB_H -#ifdef WIN32 -# define inline __inline -#endif - #ifdef WIN32 #define HAVE_WINSOCK2_H 1 #define CPU_CISC 1