Change VST3 SDK patching to apply handwritten diff

Instead of replacing things with sed. This was a bit brittle with the
changes in 3.7.6/3.7.7, and this approach keeps compatibility with older
SDK versions.
This commit is contained in:
Robbert van der Helm
2022-12-23 18:20:25 +01:00
parent 5150332d20
commit 2984b1d26f
7 changed files with 2640 additions and 61 deletions
+4
View File
@@ -11,6 +11,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### Packaging notes
- The CLAP dependency has been updated to version 1.1.4.
- The `patch-vst3-sdk.sh` script now applies a handwritten diff to the SDK
instead of patching the SDK using sed. This makes it easier to use older (but
still API-compatible) VST3 SDK versions with yabridge and it makes the
patching less brittle. The patches can be found in `tools/vst3-sdk-patches`.
## [5.0.2] - 2022-11-28
+34 -61
View File
@@ -8,74 +8,47 @@
# rather not have to do this.
#
# Usage:
# patch-vst3-sdk.sh <sdk_directory>
# patch-vst3-sdk.sh <sdk_directory> [sdk_version]
set -euo pipefail
sdk_directory=$1
if [[ -z $sdk_directory ]]; then
echo "Usage:"
echo "patch-vst3-sdk.sh <sdk_directory>"
version=${2:-}
if [[ ! -d $sdk_directory ]]; then
echo >&2 "Usage:"
echo >&2 "patch-vst3-sdk.sh <sdk_directory> [sdk_version]"
echo >&2
echo >&2 "The version is parsed from the from the CMakeLists.txt file if omitted."
exit 1
fi
# Use the proper libc functions instead of the MSVC intrinsics. These are also
# used in `fstring.cpp`, but there we will patch the entire file to use the
# standard POSIX/GCC string formatting facilities.
sed -i 's/\b_vsnprintf\b/vsnprintf/g;s/\b_snprintf\b/snprintf/g' "$sdk_directory/base/source/fdebug.cpp"
if [[ -z $version ]]; then
# `-z` is a quick way to search across multiple lines in case they format
# future versions differently, and the combination of `-n`, `p`, and replacing
# everything before and after the version causes this to print nothing if the
# replacement didn't succeed
version=$(sed -zn 's/.*project(vstsdk\s*VERSION \([0-9.]\+\).*/\1/ p' "$sdk_directory/CMakeLists.txt")
fi
# Use the attributes and types from GCC
sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/pluginterfaces/base/ftypes.h"
if [[ -z $version ]]; then
echo >&2 "Could not parse the VST3 SDK version from '$sdk_directory/CMakeLists.txt'"
exit 1
fi
# There are some more places where the SDK includes better compatibility with
# GCC that we can use
# NOTE: We should **not** define __MINGW32__ globally, since that also breaks
# Wine's headers in headache inducing ways
sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/public.sdk/source/common/systemclipboard_win32.cpp"
patch_file=$(dirname "$0")/vst3-sdk-patches/vst3-sdk-patch-$version.diff
if [[ ! -f $patch_file ]]; then
echo >&2 "The patch file for this SDK version ('$patch_file') does not yet exist"
exit 1
fi
# Use the string manipulation functions from the C standard library
sed -i 's/\bSMTG_OS_WINDOWS\b/0/g;s/\bSMTG_OS_LINUX\b/1/g' "$sdk_directory/base/source/fstring.cpp"
sed -i 's/\bSMTG_OS_WINDOWS\b/0/g;s/\bSMTG_OS_LINUX\b/1/g' "$sdk_directory/pluginterfaces/base/fstrdefs.h"
sed -i 's/\bSMTG_OS_WINDOWS\b/0/g;s/\bSMTG_OS_LINUX\b/1/g' "$sdk_directory/pluginterfaces/base/ustring.cpp"
# `Windows.h` expects `wchar_t`, and the above defines will cause us to use
# `char16_t` for string literals. This replacement targets a very specific line,
# so if the SDK gets updated, this fails, and we're getting a ton of `wchar_t`
# related compile errors, that's why. The previous sed call will have replaced
# `SMTG_OS_WINDOWS` with a 0 here.
sed -i 's/^ #if 0$/ #if __WINE__/' "$sdk_directory/pluginterfaces/base/fstrdefs.h"
# We'll need some careful replacements in the Linux definitions in `fstring.cpp`
# to use `wchar_t` instead of `char16_t`.
replace_char16() {
local needle=$1
local filename=$2
wchar_version=${needle//char16_t/wchar_t}
sed -i "s/^$needle$/#ifdef __WINE__\\
$wchar_version\\
#else\\
\0\\
#endif/" "$filename"
}
replace_char16 "using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;" "$sdk_directory/base/source/fstring.cpp"
replace_char16 "using Converter = std::wstring_convert<ConverterFacet, char16_t>;" "$sdk_directory/base/source/fstring.cpp"
replace_char16 "using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;" "$sdk_directory/pluginterfaces/base/ustring.cpp"
# Don't try adding `std::u8string` to an `std::vector<std::string>`. MSVC
# probably coerces them, but GCC doesn't
sed -i 's/\bgeneric_u8string\b/generic_string/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
# libstdc++fs doesn't work under Winelib, for whatever reason that might be.
# We'll patch the Win32 module loading to use `ghc::filesystem` instead.
sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include <ghc\/filesystem.hpp>/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
sed -i 's/^namespace filesystem = std\(::experimental\)\?::filesystem;$/namespace filesystem = ghc::filesystem;/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
# Wine uses the narrow versions of everything by default, and in Unity builds
# we need to explicitly use the UTF-16 version here.
sed -i 's/\bIShellLink\*/IShellLinkW*/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
# Meson requires this program to output something, or else it will error out
# when trying to encode the empty output
echo "Successfully patched '$sdk_directory' for winegcc compatibility"
# Patch either automatically reverses already applied patches, or throws errors
# when the patch has already been applied and you tell it to not reverse
# patches. So we'll check whether the patch has already been applied first.
if ! patch -d "$sdk_directory" -p1 -f --dry-run --reverse <"$patch_file" >/dev/null 2>&1; then
patch -d "$sdk_directory" -p1 -f --forward <"$patch_file"
echo -e "\nSuccessfully patched '$sdk_directory' for Winelib compatibility"
else
# Meson requires this program to output something, or else it will error out
# when trying to encode the empty output
echo "'$sdk_directory' has already been patched for Winelib compatibility, ignoring..."
fi
@@ -0,0 +1,669 @@
Submodule base contains modified content
diff --git a/base/source/fdebug.cpp b/base/source/fdebug.cpp
index 496d75c..594e17e 100644
--- a/base/source/fdebug.cpp
+++ b/base/source/fdebug.cpp
@@ -52,9 +52,9 @@
#if _MSC_VER
#include <intrin.h>
#endif
-#include <Windows.h>
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
+#include <windows.h>
+#define vsnprintf vsnprintf
+#define snprintf snprintf
#elif SMTG_OS_MACOS
#include <errno.h>
diff --git a/base/source/fdynlib.cpp b/base/source/fdynlib.cpp
index 2702e12..50bf04e 100644
--- a/base/source/fdynlib.cpp
+++ b/base/source/fdynlib.cpp
@@ -40,7 +40,7 @@
#include "base/source/fstring.h"
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#elif SMTG_OS_MACOS
#include <mach-o/dyld.h>
diff --git a/base/source/fstring.cpp b/base/source/fstring.cpp
index 11b69eb..5fbdb4f 100644
--- a/base/source/fstring.cpp
+++ b/base/source/fstring.cpp
@@ -46,8 +46,8 @@
#include <cstdarg>
#include <utility>
-#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#if 0
+#include <windows.h>
#ifdef _MSC_VER
#pragma warning (disable : 4244)
#pragma warning (disable : 4267)
@@ -62,7 +62,7 @@
#endif // DEVELOPMENT
#endif // _MSC_VER
-#endif // SMTG_OS_WINDOWS
+#endif // 0
#ifndef kPrintfBufferSize
#define kPrintfBufferSize 4096
@@ -201,7 +201,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
}
#endif // SMTG_OS_MACOS
-#if SMTG_OS_WINDOWS
+#if 0
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -231,7 +231,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof
-#elif SMTG_OS_LINUX
+#elif 1
#include <codecvt>
#include <locale>
#include <cstring>
@@ -240,8 +240,16 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#include <cassert>
#include <wchar.h>
-using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
-using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#ifdef __WINE__
+ using ConverterFacet = std::codecvt_utf8_utf16<wchar_t>;
+#else
+ using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
+#endif
+#ifdef __WINE__
+ using Converter = std::wstring_convert<ConverterFacet, wchar_t>;
+#else
+ using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#endif
//------------------------------------------------------------------------
static ConverterFacet& converterFacet ()
@@ -417,7 +425,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber
return vsnwprintf (str, -1, format, marker);
}
-#endif // SMTG_OS_LINUX
+#endif // 1
/*
UTF-8 EF BB BF
@@ -1569,7 +1577,7 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
@@ -1586,7 +1594,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1598,7 +1606,7 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
@@ -1615,7 +1623,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1629,7 +1637,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1643,7 +1651,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1870,7 +1878,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
-#if SMTG_OS_WINDOWS
+#if 0
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif
@@ -1893,7 +1901,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
#endif
-#if SMTG_OS_LINUX
+#if 1
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1928,7 +1936,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
-#if SMTG_OS_WINDOWS
+#if 0
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, 0, 0);
#elif SMTG_OS_MACOS
@@ -1952,7 +1960,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2015,7 +2023,7 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
@@ -2273,7 +2281,7 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == 0)
return true;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
diff --git a/base/source/timer.cpp b/base/source/timer.cpp
index a3559ac..bc42431 100644
--- a/base/source/timer.cpp
+++ b/base/source/timer.cpp
@@ -202,7 +202,7 @@ Timer* Timer::create (ITimerCallback* callback, uint32 milliseconds)
#elif SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#include <algorithm>
#include <list>
diff --git a/base/thread/source/fcondition.cpp b/base/thread/source/fcondition.cpp
index 9e61153..6c1815f 100644
--- a/base/thread/source/fcondition.cpp
+++ b/base/thread/source/fcondition.cpp
@@ -78,7 +78,7 @@ extern "C" {
#include <sys/time.h>
//------------------------------------------------------------------------
#elif SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#endif
namespace Steinberg {
diff --git a/base/thread/source/flock.cpp b/base/thread/source/flock.cpp
index 98fdf12..d92055d 100644
--- a/base/thread/source/flock.cpp
+++ b/base/thread/source/flock.cpp
@@ -50,7 +50,7 @@
#define _WIN32_WINNT WINVER
#endif
-#include <Windows.h>
+#include <windows.h>
#include <objbase.h>
#define INIT_CS(cs) \
InitializeCriticalSection ((LPCRITICAL_SECTION)&cs);
Submodule pluginterfaces contains modified content
diff --git a/pluginterfaces/base/fstrdefs.h b/pluginterfaces/base/fstrdefs.h
index 00eaa1d..7370a6d 100644
--- a/pluginterfaces/base/fstrdefs.h
+++ b/pluginterfaces/base/fstrdefs.h
@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
- #if SMTG_OS_WINDOWS
+ #if __WINE__
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))
-#if SMTG_OS_WINDOWS
+#if 0
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"
-#elif SMTG_OS_MACOS || SMTG_OS_LINUX
+#elif SMTG_OS_MACOS || 1
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
-#if SMTG_OS_WINDOWS
+#if 0
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
-#elif SMTG_OS_LINUX
+#elif 1
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif
-#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
+#if 0 && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
diff --git a/pluginterfaces/base/ftypes.h b/pluginterfaces/base/ftypes.h
index 1f95bd1..826f311 100644
--- a/pluginterfaces/base/ftypes.h
+++ b/pluginterfaces/base/ftypes.h
@@ -93,7 +93,7 @@ namespace Steinberg
typedef char char8;
#ifdef _NATIVE_WCHAR_T_DEFINED
typedef __wchar_t char16;
-#elif defined(__MINGW32__)
+#elif defined(__WINE__)
typedef wchar_t char16;
#elif SMTG_CPP11
typedef char16_t char16;
@@ -172,7 +172,7 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
- #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
+ #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__WINE__)
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif SMTG_OS_WINDOWS
diff --git a/pluginterfaces/base/ustring.cpp b/pluginterfaces/base/ustring.cpp
index 24a412f..1113642 100644
--- a/pluginterfaces/base/ustring.cpp
+++ b/pluginterfaces/base/ustring.cpp
@@ -16,7 +16,7 @@
#include "ustring.h"
-#if SMTG_OS_WINDOWS
+#if 0
#include <cstdio>
#ifdef _MSC_VER
@@ -26,7 +26,7 @@
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
-#elif SMTG_OS_LINUX
+#elif 1
#include <cstring>
#include <string>
#include <codecvt>
@@ -42,12 +42,16 @@
namespace Steinberg {
//------------------------------------------------------------------------
-#if SMTG_OS_LINUX
+#if 1
//------------------------------------------------------------------------
namespace {
-using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#ifdef __WINE__
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>;
+#else
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#endif
//------------------------------------------------------------------------
Converter& converter ()
@@ -60,7 +64,7 @@ Converter& converter ()
} // anonymous
//------------------------------------------------------------------------
-#endif // SMTG_OS_LINUX
+#endif // 1
//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -145,7 +149,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;
#elif TARGET_API_MAC_CARBON
@@ -158,7 +162,7 @@ bool UString::scanFloat (double& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;
@@ -172,7 +176,7 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif SMTG_OS_MACOS
bool result = false;
@@ -186,7 +190,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -210,7 +214,7 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;
#elif SMTG_OS_MACOS
@@ -223,7 +227,7 @@ bool UString::scanInt (int64& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;
@@ -237,7 +241,7 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;
#elif SMTG_OS_MACOS
@@ -251,7 +255,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)
Submodule public.sdk contains modified content
diff --git a/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/platform.cpp b/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/platform.cpp
index 510f2c0..cdf90c4 100644
--- a/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/platform.cpp
+++ b/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/platform.cpp
@@ -40,7 +40,7 @@
#include "public.sdk/samples/vst-hosting/editorhost/source/platform/win32/window.h"
#include "public.sdk/source/vst/utility/stringconvert.h"
-#include <Windows.h>
+#include <windows.h>
#include <string>
#include <vector>
#include <algorithm>
diff --git a/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/window.h b/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/window.h
index ae6512f..b9c5933 100644
--- a/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/window.h
+++ b/public.sdk/samples/vst-hosting/editorhost/source/platform/win32/window.h
@@ -39,7 +39,7 @@
#include "public.sdk/samples/vst-hosting/editorhost/source/platform/iwindow.h"
#include "public.sdk/source/vst/utility/optional.h"
-#include <Windows.h>
+#include <windows.h>
#include <vector>
//------------------------------------------------------------------------
diff --git a/public.sdk/samples/vst-hosting/validator/source/validator.cpp b/public.sdk/samples/vst-hosting/validator/source/validator.cpp
index aa19e60..2c7aa23 100644
--- a/public.sdk/samples/vst-hosting/validator/source/validator.cpp
+++ b/public.sdk/samples/vst-hosting/validator/source/validator.cpp
@@ -48,7 +48,7 @@
#include "pluginterfaces/vst/ivstunits.h"
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#include <conio.h>
#endif
diff --git a/public.sdk/source/common/openurl.cpp b/public.sdk/source/common/openurl.cpp
index 4bdda99..36f08f3 100644
--- a/public.sdk/source/common/openurl.cpp
+++ b/public.sdk/source/common/openurl.cpp
@@ -39,7 +39,7 @@
#include "pluginterfaces/base/ftypes.h"
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#else
#include <cstdlib>
#endif
diff --git a/public.sdk/source/common/systemclipboard_win32.cpp b/public.sdk/source/common/systemclipboard_win32.cpp
index 6ffb7f6..a6dad8e 100644
--- a/public.sdk/source/common/systemclipboard_win32.cpp
+++ b/public.sdk/source/common/systemclipboard_win32.cpp
@@ -35,7 +35,7 @@
#include "pluginterfaces/base/fplatform.h"
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#include <vector>
//------------------------------------------------------------------------
@@ -111,7 +111,7 @@ bool copyTextToClipboard (const std::string& text)
{
if (auto* data = static_cast<WCHAR*> (GlobalLock (memory)))
{
-#if defined(__MINGW32__)
+#if defined(__WINE__)
memcpy (data, wideStr.data (), byteSize);
#else
memcpy_s (data, byteSize, wideStr.data (), byteSize);
diff --git a/public.sdk/source/common/threadchecker_win32.cpp b/public.sdk/source/common/threadchecker_win32.cpp
index 0a43df0..4664b73 100644
--- a/public.sdk/source/common/threadchecker_win32.cpp
+++ b/public.sdk/source/common/threadchecker_win32.cpp
@@ -38,7 +38,7 @@
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
//------------------------------------------------------------------------
namespace Steinberg {
diff --git a/public.sdk/source/main/dllmain.cpp b/public.sdk/source/main/dllmain.cpp
index 937e3c7..3e87d54 100644
--- a/public.sdk/source/main/dllmain.cpp
+++ b/public.sdk/source/main/dllmain.cpp
@@ -37,7 +37,7 @@
#include "pluginterfaces/base/ftypes.h"
-#include <Windows.h>
+#include <windows.h>
#if defined(_MSC_VER) && defined(DEVELOPMENT)
#include <crtdbg.h>
diff --git a/public.sdk/source/vst/aaxwrapper/aaxwrapper.cpp b/public.sdk/source/vst/aaxwrapper/aaxwrapper.cpp
index 2b7e323..0e07250 100644
--- a/public.sdk/source/vst/aaxwrapper/aaxwrapper.cpp
+++ b/public.sdk/source/vst/aaxwrapper/aaxwrapper.cpp
@@ -77,7 +77,7 @@ static_assert (AAX_SDK_CURRENT_REVISION >= AAX_SDK_2p3p2_REVISION,
#endif
#if SMTG_OS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#define getCurrentThread() ((void*)(size_t)GetCurrentThreadId ())
#else
#include <pthread.h>
diff --git a/public.sdk/source/vst/hosting/module_win32.cpp b/public.sdk/source/vst/hosting/module_win32.cpp
index e41c528..24c35bf 100644
--- a/public.sdk/source/vst/hosting/module_win32.cpp
+++ b/public.sdk/source/vst/hosting/module_win32.cpp
@@ -37,21 +37,21 @@
#include "../utility/optional.h"
#include "../utility/stringconvert.h"
#include "module.h"
-#include <ShlObj.h>
-#include <Windows.h>
+#include <shlobj.h>
+#include <windows.h>
#include <algorithm>
#include <iostream>
#if _HAS_CXX17 && defined(_MSC_VER)
-#include <filesystem>
-using namespace std;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#else
// The <experimental/filesystem> header is deprecated. It is superseded by the C++17 <filesystem>
// header. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence the
// warning, otherwise the build will fail in VS2020 16.3.0
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
-#include <experimental/filesystem>
-using namespace std::experimental;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#endif
#pragma comment(lib, "Shell32")
@@ -225,7 +225,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
#if USE_OLE
Ole::instance ();
- IShellLink* shellLink = nullptr;
+ IShellLinkW* shellLink = nullptr;
if (!SUCCEEDED (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, reinterpret_cast<LPVOID*> (&shellLink))))
return {};
@@ -235,7 +235,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
shellLink->QueryInterface (IID_IPersistFile, reinterpret_cast<void**> (&persistFile))))
return {};
- if (!SUCCEEDED (persistFile->Load (p.native ().data (), STGM_READ)))
+ if (!SUCCEEDED (persistFile->Load (p.wstring ().data (), STGM_READ)))
return {};
if (!SUCCEEDED (shellLink->Resolve (nullptr, MAKELONG (SLR_NO_UI, 500))))
@@ -273,23 +273,23 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
const auto& cpExt = cp.extension ();
if (cpExt == ext)
{
- if ((p.status ().type () == filesystem::file_type::directory) ||
+ if ((p.status ().type () == filesystem::file_type::directory_file) ||
isFolderSymbolicLink (p))
{
filesystem::path finalPath (p);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (cp, ext, pathList, recursive);
}
else
- pathList.push_back (cp.generic_u8string ());
+ pathList.push_back (cp.generic_string ());
}
else if (recursive)
{
- if (p.status ().type () == filesystem::file_type::directory)
+ if (p.status ().type () == filesystem::file_type::directory_file)
{
findFilesWithExt (cp, ext, pathList, recursive);
}
@@ -305,18 +305,18 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (*resolvedLink);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
else
- pathList.push_back (resolvedLink->generic_u8string ());
+ pathList.push_back (resolvedLink->generic_string ());
}
else if (filesystem::is_directory (*resolvedLink))
{
- const auto& str = resolvedLink->generic_u8string ();
- if (cp.generic_u8string ().compare (0, str.size (), str.data (),
+ const auto& str = resolvedLink->generic_string ();
+ if (cp.generic_string ().compare (0, str.size (), str.data (),
str.size ()) != 0)
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
@@ -406,7 +406,7 @@ Module::SnapshotList Module::getSnapshots (const std::string& modulePath)
for (auto& png : pngList)
{
filesystem::path p (png);
- auto filename = p.filename ().generic_u8string ();
+ auto filename = p.filename ().generic_string ();
auto uid = Snapshot::decodeUID (filename);
if (!uid)
continue;
@@ -0,0 +1,496 @@
Submodule base contains modified content
diff --git a/base/source/fdebug.cpp b/base/source/fdebug.cpp
index 6355feb..b1deb25 100644
--- a/base/source/fdebug.cpp
+++ b/base/source/fdebug.cpp
@@ -115,8 +115,8 @@ bool AmIBeingDebugged ()
#if _MSC_VER
#include <intrin.h>
#endif
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
+#define vsnprintf vsnprintf
+#define snprintf snprintf
#elif SMTG_OS_MACOS
#include <errno.h>
diff --git a/base/source/fstring.cpp b/base/source/fstring.cpp
index 55e86ee..db9bb0e 100644
--- a/base/source/fstring.cpp
+++ b/base/source/fstring.cpp
@@ -46,7 +46,7 @@
#include <cstdarg>
#include <utility>
-#if SMTG_OS_WINDOWS
+#if 0
#include <windows.h>
#ifdef _MSC_VER
#pragma warning (disable : 4244)
@@ -62,7 +62,7 @@
#endif // DEVELOPMENT
#endif // _MSC_VER
-#endif // SMTG_OS_WINDOWS
+#endif // 0
#ifndef kPrintfBufferSize
#define kPrintfBufferSize 4096
@@ -201,7 +201,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
}
#endif // SMTG_OS_MACOS
-#if SMTG_OS_WINDOWS
+#if 0
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -231,7 +231,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof
-#elif SMTG_OS_LINUX
+#elif 1
#include <codecvt>
#include <locale>
#include <cstring>
@@ -240,8 +240,16 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#include <cassert>
#include <wchar.h>
-using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
-using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#ifdef __WINE__
+ using ConverterFacet = std::codecvt_utf8_utf16<wchar_t>;
+#else
+ using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
+#endif
+#ifdef __WINE__
+ using Converter = std::wstring_convert<ConverterFacet, wchar_t>;
+#else
+ using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#endif
//------------------------------------------------------------------------
static ConverterFacet& converterFacet ()
@@ -417,7 +425,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber
return vsnwprintf (str, -1, format, marker);
}
-#endif // SMTG_OS_LINUX
+#endif // 1
/*
UTF-8 EF BB BF
@@ -1569,7 +1577,7 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
@@ -1586,7 +1594,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1598,7 +1606,7 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
@@ -1615,7 +1623,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1629,7 +1637,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1643,7 +1651,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1870,7 +1878,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
-#if SMTG_OS_WINDOWS
+#if 0
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif
@@ -1893,7 +1901,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
#endif
-#if SMTG_OS_LINUX
+#if 1
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1928,7 +1936,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
-#if SMTG_OS_WINDOWS
+#if 0
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, nullptr, nullptr);
#elif SMTG_OS_MACOS
@@ -1952,7 +1960,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2015,7 +2023,7 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
@@ -2273,7 +2281,7 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == nullptr)
return true;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
Submodule pluginterfaces contains modified content
diff --git a/pluginterfaces/base/fstrdefs.h b/pluginterfaces/base/fstrdefs.h
index 00eaa1d..7370a6d 100644
--- a/pluginterfaces/base/fstrdefs.h
+++ b/pluginterfaces/base/fstrdefs.h
@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
- #if SMTG_OS_WINDOWS
+ #if __WINE__
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))
-#if SMTG_OS_WINDOWS
+#if 0
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"
-#elif SMTG_OS_MACOS || SMTG_OS_LINUX
+#elif SMTG_OS_MACOS || 1
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
-#if SMTG_OS_WINDOWS
+#if 0
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
-#elif SMTG_OS_LINUX
+#elif 1
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif
-#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
+#if 0 && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
diff --git a/pluginterfaces/base/ftypes.h b/pluginterfaces/base/ftypes.h
index 1f95bd1..826f311 100644
--- a/pluginterfaces/base/ftypes.h
+++ b/pluginterfaces/base/ftypes.h
@@ -93,7 +93,7 @@ namespace Steinberg
typedef char char8;
#ifdef _NATIVE_WCHAR_T_DEFINED
typedef __wchar_t char16;
-#elif defined(__MINGW32__)
+#elif defined(__WINE__)
typedef wchar_t char16;
#elif SMTG_CPP11
typedef char16_t char16;
@@ -172,7 +172,7 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
- #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
+ #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__WINE__)
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif SMTG_OS_WINDOWS
diff --git a/pluginterfaces/base/ustring.cpp b/pluginterfaces/base/ustring.cpp
index 24a412f..1113642 100644
--- a/pluginterfaces/base/ustring.cpp
+++ b/pluginterfaces/base/ustring.cpp
@@ -16,7 +16,7 @@
#include "ustring.h"
-#if SMTG_OS_WINDOWS
+#if 0
#include <cstdio>
#ifdef _MSC_VER
@@ -26,7 +26,7 @@
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
-#elif SMTG_OS_LINUX
+#elif 1
#include <cstring>
#include <string>
#include <codecvt>
@@ -42,12 +42,16 @@
namespace Steinberg {
//------------------------------------------------------------------------
-#if SMTG_OS_LINUX
+#if 1
//------------------------------------------------------------------------
namespace {
-using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#ifdef __WINE__
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>;
+#else
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#endif
//------------------------------------------------------------------------
Converter& converter ()
@@ -60,7 +64,7 @@ Converter& converter ()
} // anonymous
//------------------------------------------------------------------------
-#endif // SMTG_OS_LINUX
+#endif // 1
//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -145,7 +149,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;
#elif TARGET_API_MAC_CARBON
@@ -158,7 +162,7 @@ bool UString::scanFloat (double& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;
@@ -172,7 +176,7 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif SMTG_OS_MACOS
bool result = false;
@@ -186,7 +190,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -210,7 +214,7 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;
#elif SMTG_OS_MACOS
@@ -223,7 +227,7 @@ bool UString::scanInt (int64& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;
@@ -237,7 +241,7 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;
#elif SMTG_OS_MACOS
@@ -251,7 +255,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)
Submodule public.sdk contains modified content
diff --git a/public.sdk/source/common/systemclipboard_win32.cpp b/public.sdk/source/common/systemclipboard_win32.cpp
index 54f7973..f786c56 100644
--- a/public.sdk/source/common/systemclipboard_win32.cpp
+++ b/public.sdk/source/common/systemclipboard_win32.cpp
@@ -111,7 +111,7 @@ bool copyTextToClipboard (const std::string& text)
{
if (auto* data = static_cast<WCHAR*> (GlobalLock (memory)))
{
-#if defined(__MINGW32__)
+#if defined(__WINE__)
memcpy (data, wideStr.data (), byteSize);
#else
memcpy_s (data, byteSize, wideStr.data (), byteSize);
diff --git a/public.sdk/source/vst/hosting/module_win32.cpp b/public.sdk/source/vst/hosting/module_win32.cpp
index 9b6858e..f2dfa21 100644
--- a/public.sdk/source/vst/hosting/module_win32.cpp
+++ b/public.sdk/source/vst/hosting/module_win32.cpp
@@ -37,7 +37,7 @@
#include "../utility/optional.h"
#include "../utility/stringconvert.h"
#include "module.h"
-#include <ShlObj.h>
+#include <shlobj.h>
#include <windows.h>
#include <algorithm>
#include <iostream>
@@ -53,15 +53,15 @@
#endif
#if USE_FILESYSTEM == 1
-#include <filesystem>
-namespace filesystem = std::filesystem;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#else
// The <experimental/filesystem> header is deprecated. It is superseded by the C++17 <filesystem>
// header. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence the
// warning, otherwise the build will fail in VS2020 16.3.0
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
-#include <experimental/filesystem>
-namespace filesystem = std::experimental::filesystem;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#endif
#pragma comment(lib, "Shell32")
@@ -243,7 +243,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
#if USE_OLE
Ole::instance ();
- IShellLink* shellLink = nullptr;
+ IShellLinkW* shellLink = nullptr;
if (!SUCCEEDED (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, reinterpret_cast<LPVOID*> (&shellLink))))
return {};
@@ -324,23 +324,23 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
const auto& cpExt = cp.extension ();
if (cpExt == ext)
{
- if ((p.status ().type () == filesystem::file_type::directory) ||
+ if ((p.status ().type () == filesystem::file_type::directory_file) ||
isFolderSymbolicLink (p))
{
filesystem::path finalPath (p);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (cp, ext, pathList, recursive);
}
else
- pathList.push_back (cp.generic_u8string ());
+ pathList.push_back (cp.generic_string ());
}
else if (recursive)
{
- if (p.status ().type () == filesystem::file_type::directory)
+ if (p.status ().type () == filesystem::file_type::directory_file)
{
findFilesWithExt (cp, ext, pathList, recursive);
}
@@ -356,18 +356,18 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (*resolvedLink);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
else
- pathList.push_back (resolvedLink->generic_u8string ());
+ pathList.push_back (resolvedLink->generic_string ());
}
else if (filesystem::is_directory (*resolvedLink))
{
- const auto& str = resolvedLink->generic_u8string ();
- if (cp.generic_u8string ().compare (0, str.size (), str.data (),
+ const auto& str = resolvedLink->generic_string ();
+ if (cp.generic_string ().compare (0, str.size (), str.data (),
str.size ()) != 0)
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
@@ -0,0 +1,487 @@
Submodule base contains modified content
diff --git a/base/source/fdebug.cpp b/base/source/fdebug.cpp
index 6355feb..b1deb25 100644
--- a/base/source/fdebug.cpp
+++ b/base/source/fdebug.cpp
@@ -115,8 +115,8 @@ bool AmIBeingDebugged ()
#if _MSC_VER
#include <intrin.h>
#endif
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
+#define vsnprintf vsnprintf
+#define snprintf snprintf
#elif SMTG_OS_MACOS
#include <errno.h>
diff --git a/base/source/fstring.cpp b/base/source/fstring.cpp
index 55e86ee..db9bb0e 100644
--- a/base/source/fstring.cpp
+++ b/base/source/fstring.cpp
@@ -46,7 +46,7 @@
#include <cstdarg>
#include <utility>
-#if SMTG_OS_WINDOWS
+#if 0
#include <windows.h>
#ifdef _MSC_VER
#pragma warning (disable : 4244)
@@ -62,7 +62,7 @@
#endif // DEVELOPMENT
#endif // _MSC_VER
-#endif // SMTG_OS_WINDOWS
+#endif // 0
#ifndef kPrintfBufferSize
#define kPrintfBufferSize 4096
@@ -201,7 +201,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
}
#endif // SMTG_OS_MACOS
-#if SMTG_OS_WINDOWS
+#if 0
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -231,7 +231,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof
-#elif SMTG_OS_LINUX
+#elif 1
#include <codecvt>
#include <locale>
#include <cstring>
@@ -240,8 +240,16 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#include <cassert>
#include <wchar.h>
-using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
-using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#ifdef __WINE__
+ using ConverterFacet = std::codecvt_utf8_utf16<wchar_t>;
+#else
+ using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
+#endif
+#ifdef __WINE__
+ using Converter = std::wstring_convert<ConverterFacet, wchar_t>;
+#else
+ using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#endif
//------------------------------------------------------------------------
static ConverterFacet& converterFacet ()
@@ -417,7 +425,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber
return vsnwprintf (str, -1, format, marker);
}
-#endif // SMTG_OS_LINUX
+#endif // 1
/*
UTF-8 EF BB BF
@@ -1569,7 +1577,7 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
@@ -1586,7 +1594,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1598,7 +1606,7 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
@@ -1615,7 +1623,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1629,7 +1637,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1643,7 +1651,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1870,7 +1878,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
-#if SMTG_OS_WINDOWS
+#if 0
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif
@@ -1893,7 +1901,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
#endif
-#if SMTG_OS_LINUX
+#if 1
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1928,7 +1936,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
-#if SMTG_OS_WINDOWS
+#if 0
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, nullptr, nullptr);
#elif SMTG_OS_MACOS
@@ -1952,7 +1960,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2015,7 +2023,7 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
@@ -2273,7 +2281,7 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == nullptr)
return true;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
Submodule pluginterfaces contains modified content
diff --git a/pluginterfaces/base/fstrdefs.h b/pluginterfaces/base/fstrdefs.h
index 00eaa1d..7370a6d 100644
--- a/pluginterfaces/base/fstrdefs.h
+++ b/pluginterfaces/base/fstrdefs.h
@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
- #if SMTG_OS_WINDOWS
+ #if __WINE__
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))
-#if SMTG_OS_WINDOWS
+#if 0
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"
-#elif SMTG_OS_MACOS || SMTG_OS_LINUX
+#elif SMTG_OS_MACOS || 1
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
-#if SMTG_OS_WINDOWS
+#if 0
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
-#elif SMTG_OS_LINUX
+#elif 1
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif
-#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
+#if 0 && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
diff --git a/pluginterfaces/base/ftypes.h b/pluginterfaces/base/ftypes.h
index 1f95bd1..826f311 100644
--- a/pluginterfaces/base/ftypes.h
+++ b/pluginterfaces/base/ftypes.h
@@ -93,7 +93,7 @@ namespace Steinberg
typedef char char8;
#ifdef _NATIVE_WCHAR_T_DEFINED
typedef __wchar_t char16;
-#elif defined(__MINGW32__)
+#elif defined(__WINE__)
typedef wchar_t char16;
#elif SMTG_CPP11
typedef char16_t char16;
@@ -172,7 +172,7 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
- #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
+ #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__WINE__)
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif SMTG_OS_WINDOWS
diff --git a/pluginterfaces/base/ustring.cpp b/pluginterfaces/base/ustring.cpp
index 24a412f..1113642 100644
--- a/pluginterfaces/base/ustring.cpp
+++ b/pluginterfaces/base/ustring.cpp
@@ -16,7 +16,7 @@
#include "ustring.h"
-#if SMTG_OS_WINDOWS
+#if 0
#include <cstdio>
#ifdef _MSC_VER
@@ -26,7 +26,7 @@
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
-#elif SMTG_OS_LINUX
+#elif 1
#include <cstring>
#include <string>
#include <codecvt>
@@ -42,12 +42,16 @@
namespace Steinberg {
//------------------------------------------------------------------------
-#if SMTG_OS_LINUX
+#if 1
//------------------------------------------------------------------------
namespace {
-using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#ifdef __WINE__
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>;
+#else
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#endif
//------------------------------------------------------------------------
Converter& converter ()
@@ -60,7 +64,7 @@ Converter& converter ()
} // anonymous
//------------------------------------------------------------------------
-#endif // SMTG_OS_LINUX
+#endif // 1
//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -145,7 +149,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;
#elif TARGET_API_MAC_CARBON
@@ -158,7 +162,7 @@ bool UString::scanFloat (double& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;
@@ -172,7 +176,7 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif SMTG_OS_MACOS
bool result = false;
@@ -186,7 +190,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -210,7 +214,7 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;
#elif SMTG_OS_MACOS
@@ -223,7 +227,7 @@ bool UString::scanInt (int64& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;
@@ -237,7 +241,7 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;
#elif SMTG_OS_MACOS
@@ -251,7 +255,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)
Submodule public.sdk contains modified content
diff --git a/public.sdk/source/common/systemclipboard_win32.cpp b/public.sdk/source/common/systemclipboard_win32.cpp
index 54f7973..f786c56 100644
--- a/public.sdk/source/common/systemclipboard_win32.cpp
+++ b/public.sdk/source/common/systemclipboard_win32.cpp
@@ -111,7 +111,7 @@ bool copyTextToClipboard (const std::string& text)
{
if (auto* data = static_cast<WCHAR*> (GlobalLock (memory)))
{
-#if defined(__MINGW32__)
+#if defined(__WINE__)
memcpy (data, wideStr.data (), byteSize);
#else
memcpy_s (data, byteSize, wideStr.data (), byteSize);
diff --git a/public.sdk/source/vst/hosting/module_win32.cpp b/public.sdk/source/vst/hosting/module_win32.cpp
index 7343849..32a65a6 100644
--- a/public.sdk/source/vst/hosting/module_win32.cpp
+++ b/public.sdk/source/vst/hosting/module_win32.cpp
@@ -55,15 +55,15 @@
#endif
#if USE_FILESYSTEM == 1
-#include <filesystem>
-namespace filesystem = std::filesystem;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#else
// The <experimental/filesystem> header is deprecated. It is superseded by the C++17 <filesystem>
// header. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence the
// warning, otherwise the build will fail in VS2020 16.3.0
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
-#include <experimental/filesystem>
-namespace filesystem = std::experimental::filesystem;
+#include <boost/filesystem.hpp>
+namespace filesystem = boost::filesystem;
#endif
#pragma comment(lib, "Shell32")
@@ -246,7 +246,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
#if USE_OLE
Ole::instance ();
- IShellLink* shellLink = nullptr;
+ IShellLinkW* shellLink = nullptr;
if (!SUCCEEDED (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, reinterpret_cast<LPVOID*> (&shellLink))))
return {};
@@ -327,23 +327,23 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
const auto& cpExt = cp.extension ();
if (cpExt == ext)
{
- if ((p.status ().type () == filesystem::file_type::directory) ||
+ if ((p.status ().type () == filesystem::file_type::directory_file) ||
isFolderSymbolicLink (p))
{
filesystem::path finalPath (p);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (cp, ext, pathList, recursive);
}
else
- pathList.push_back (cp.generic_u8string ());
+ pathList.push_back (cp.generic_string ());
}
else if (recursive)
{
- if (p.status ().type () == filesystem::file_type::directory)
+ if (p.status ().type () == filesystem::file_type::directory_file)
{
findFilesWithExt (cp, ext, pathList, recursive);
}
@@ -359,18 +359,18 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (*resolvedLink);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
else
- pathList.push_back (resolvedLink->generic_u8string ());
+ pathList.push_back (resolvedLink->generic_string ());
}
else if (filesystem::is_directory (*resolvedLink))
{
- const auto& str = resolvedLink->generic_u8string ();
- if (cp.generic_u8string ().compare (0, str.size (), str.data (),
+ const auto& str = resolvedLink->generic_string ();
+ if (cp.generic_string ().compare (0, str.size (), str.data (),
str.size ()) != 0)
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
@@ -0,0 +1,475 @@
Submodule base contains modified content
diff --git a/base/source/fdebug.cpp b/base/source/fdebug.cpp
index 9d0c83e..cac2b5c 100644
--- a/base/source/fdebug.cpp
+++ b/base/source/fdebug.cpp
@@ -115,8 +115,8 @@ bool AmIBeingDebugged ()
#if _MSC_VER
#include <intrin.h>
#endif
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
+#define vsnprintf vsnprintf
+#define snprintf snprintf
#elif SMTG_OS_MACOS
#include <errno.h>
diff --git a/base/source/fstring.cpp b/base/source/fstring.cpp
index 55e86ee..db9bb0e 100644
--- a/base/source/fstring.cpp
+++ b/base/source/fstring.cpp
@@ -46,7 +46,7 @@
#include <cstdarg>
#include <utility>
-#if SMTG_OS_WINDOWS
+#if 0
#include <windows.h>
#ifdef _MSC_VER
#pragma warning (disable : 4244)
@@ -62,7 +62,7 @@
#endif // DEVELOPMENT
#endif // _MSC_VER
-#endif // SMTG_OS_WINDOWS
+#endif // 0
#ifndef kPrintfBufferSize
#define kPrintfBufferSize 4096
@@ -201,7 +201,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
}
#endif // SMTG_OS_MACOS
-#if SMTG_OS_WINDOWS
+#if 0
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -231,7 +231,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof
-#elif SMTG_OS_LINUX
+#elif 1
#include <codecvt>
#include <locale>
#include <cstring>
@@ -240,8 +240,16 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#include <cassert>
#include <wchar.h>
-using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
-using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#ifdef __WINE__
+ using ConverterFacet = std::codecvt_utf8_utf16<wchar_t>;
+#else
+ using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
+#endif
+#ifdef __WINE__
+ using Converter = std::wstring_convert<ConverterFacet, wchar_t>;
+#else
+ using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#endif
//------------------------------------------------------------------------
static ConverterFacet& converterFacet ()
@@ -417,7 +425,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber
return vsnwprintf (str, -1, format, marker);
}
-#endif // SMTG_OS_LINUX
+#endif // 1
/*
UTF-8 EF BB BF
@@ -1569,7 +1577,7 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
@@ -1586,7 +1594,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1598,7 +1606,7 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
@@ -1615,7 +1623,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1629,7 +1637,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1643,7 +1651,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1870,7 +1878,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
-#if SMTG_OS_WINDOWS
+#if 0
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif
@@ -1893,7 +1901,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
#endif
-#if SMTG_OS_LINUX
+#if 1
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1928,7 +1936,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
-#if SMTG_OS_WINDOWS
+#if 0
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, nullptr, nullptr);
#elif SMTG_OS_MACOS
@@ -1952,7 +1960,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2015,7 +2023,7 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
@@ -2273,7 +2281,7 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == nullptr)
return true;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
Submodule pluginterfaces contains modified content
diff --git a/pluginterfaces/base/fstrdefs.h b/pluginterfaces/base/fstrdefs.h
index 77cc9f2..9534bff 100644
--- a/pluginterfaces/base/fstrdefs.h
+++ b/pluginterfaces/base/fstrdefs.h
@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
- #if SMTG_OS_WINDOWS
+ #if __WINE__
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))
-#if SMTG_OS_WINDOWS
+#if 0
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"
-#elif SMTG_OS_MACOS || SMTG_OS_LINUX
+#elif SMTG_OS_MACOS || 1
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
-#if SMTG_OS_WINDOWS
+#if 0
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
-#elif SMTG_OS_LINUX
+#elif 1
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif
-#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
+#if 0 && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
diff --git a/pluginterfaces/base/ftypes.h b/pluginterfaces/base/ftypes.h
index 1f95bd1..826f311 100644
--- a/pluginterfaces/base/ftypes.h
+++ b/pluginterfaces/base/ftypes.h
@@ -93,7 +93,7 @@ namespace Steinberg
typedef char char8;
#ifdef _NATIVE_WCHAR_T_DEFINED
typedef __wchar_t char16;
-#elif defined(__MINGW32__)
+#elif defined(__WINE__)
typedef wchar_t char16;
#elif SMTG_CPP11
typedef char16_t char16;
@@ -172,7 +172,7 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
- #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
+ #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__WINE__)
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif SMTG_OS_WINDOWS
diff --git a/pluginterfaces/base/ustring.cpp b/pluginterfaces/base/ustring.cpp
index 24a412f..1113642 100644
--- a/pluginterfaces/base/ustring.cpp
+++ b/pluginterfaces/base/ustring.cpp
@@ -16,7 +16,7 @@
#include "ustring.h"
-#if SMTG_OS_WINDOWS
+#if 0
#include <cstdio>
#ifdef _MSC_VER
@@ -26,7 +26,7 @@
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
-#elif SMTG_OS_LINUX
+#elif 1
#include <cstring>
#include <string>
#include <codecvt>
@@ -42,12 +42,16 @@
namespace Steinberg {
//------------------------------------------------------------------------
-#if SMTG_OS_LINUX
+#if 1
//------------------------------------------------------------------------
namespace {
-using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#ifdef __WINE__
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>;
+#else
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#endif
//------------------------------------------------------------------------
Converter& converter ()
@@ -60,7 +64,7 @@ Converter& converter ()
} // anonymous
//------------------------------------------------------------------------
-#endif // SMTG_OS_LINUX
+#endif // 1
//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -145,7 +149,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;
#elif TARGET_API_MAC_CARBON
@@ -158,7 +162,7 @@ bool UString::scanFloat (double& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;
@@ -172,7 +176,7 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif SMTG_OS_MACOS
bool result = false;
@@ -186,7 +190,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -210,7 +214,7 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;
#elif SMTG_OS_MACOS
@@ -223,7 +227,7 @@ bool UString::scanInt (int64& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;
@@ -237,7 +241,7 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;
#elif SMTG_OS_MACOS
@@ -251,7 +255,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)
Submodule public.sdk contains modified content
diff --git a/public.sdk/source/common/systemclipboard_win32.cpp b/public.sdk/source/common/systemclipboard_win32.cpp
index 54f7973..f786c56 100644
--- a/public.sdk/source/common/systemclipboard_win32.cpp
+++ b/public.sdk/source/common/systemclipboard_win32.cpp
@@ -111,7 +111,7 @@ bool copyTextToClipboard (const std::string& text)
{
if (auto* data = static_cast<WCHAR*> (GlobalLock (memory)))
{
-#if defined(__MINGW32__)
+#if defined(__WINE__)
memcpy (data, wideStr.data (), byteSize);
#else
memcpy_s (data, byteSize, wideStr.data (), byteSize);
diff --git a/public.sdk/source/vst/hosting/module_win32.cpp b/public.sdk/source/vst/hosting/module_win32.cpp
index f6c2a6a..ce3c13c 100644
--- a/public.sdk/source/vst/hosting/module_win32.cpp
+++ b/public.sdk/source/vst/hosting/module_win32.cpp
@@ -55,15 +55,15 @@
#endif
#if USE_FILESYSTEM == 1
-#include <filesystem>
-namespace filesystem = std::filesystem;
+#include <ghc/filesystem.hpp>
+namespace filesystem = ghc::filesystem;
#else
// The <experimental/filesystem> header is deprecated. It is superseded by the C++17 <filesystem>
// header. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence the
// warning, otherwise the build will fail in VS2020 16.3.0
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
-#include <experimental/filesystem>
-namespace filesystem = std::experimental::filesystem;
+#include <ghc/filesystem.hpp>
+namespace filesystem = ghc::filesystem;
#endif
#pragma comment(lib, "Shell32")
@@ -246,7 +246,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
#if USE_OLE
Ole::instance ();
- IShellLink* shellLink = nullptr;
+ IShellLinkW* shellLink = nullptr;
if (!SUCCEEDED (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, reinterpret_cast<LPVOID*> (&shellLink))))
return {};
@@ -333,13 +333,13 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (p);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (cp, ext, pathList, recursive);
}
else
- pathList.push_back (cp.generic_u8string ());
+ pathList.push_back (cp.generic_string ());
}
else if (recursive)
{
@@ -359,18 +359,18 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (*resolvedLink);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
else
- pathList.push_back (resolvedLink->generic_u8string ());
+ pathList.push_back (resolvedLink->generic_string ());
}
else if (filesystem::is_directory (*resolvedLink))
{
- const auto& str = resolvedLink->generic_u8string ();
- if (cp.generic_u8string ().compare (0, str.size (), str.data (),
+ const auto& str = resolvedLink->generic_string ();
+ if (cp.generic_string ().compare (0, str.size (), str.data (),
str.size ()) != 0)
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
@@ -0,0 +1,475 @@
Submodule base contains modified content
diff --git a/base/source/fdebug.cpp b/base/source/fdebug.cpp
index e679bba..0de56b1 100644
--- a/base/source/fdebug.cpp
+++ b/base/source/fdebug.cpp
@@ -117,8 +117,8 @@ bool AmIBeingDebugged ()
#if _MSC_VER
#include <intrin.h>
#endif
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
+#define vsnprintf vsnprintf
+#define snprintf snprintf
#elif SMTG_OS_MACOS
#include <errno.h>
diff --git a/base/source/fstring.cpp b/base/source/fstring.cpp
index 1b391ce..e66c067 100644
--- a/base/source/fstring.cpp
+++ b/base/source/fstring.cpp
@@ -50,7 +50,7 @@
#include <algorithm>
#include <cassert>
-#if SMTG_OS_WINDOWS
+#if 0
#ifndef NOMINMAX
#define NOMINMAX
#endif
@@ -69,7 +69,7 @@
#endif // DEVELOPMENT
#endif // _MSC_VER
-#endif // SMTG_OS_WINDOWS
+#endif // 0
#ifndef kPrintfBufferSize
#define kPrintfBufferSize 4096
@@ -208,7 +208,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
}
#endif // SMTG_OS_MACOS
-#if SMTG_OS_WINDOWS
+#if 0
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -238,7 +238,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof
-#elif SMTG_OS_LINUX
+#elif 1
#include <codecvt>
#include <locale>
#include <cstring>
@@ -247,8 +247,16 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#include <cassert>
#include <wchar.h>
-using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
-using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#ifdef __WINE__
+ using ConverterFacet = std::codecvt_utf8_utf16<wchar_t>;
+#else
+ using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;
+#endif
+#ifdef __WINE__
+ using Converter = std::wstring_convert<ConverterFacet, wchar_t>;
+#else
+ using Converter = std::wstring_convert<ConverterFacet, char16_t>;
+#endif
//------------------------------------------------------------------------
static ConverterFacet& converterFacet ()
@@ -424,7 +432,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber
return vsnwprintf (str, -1, format, marker);
}
-#endif // SMTG_OS_LINUX
+#endif // 1
/*
UTF-8 EF BB BF
@@ -1576,7 +1584,7 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
@@ -1593,7 +1601,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1605,7 +1613,7 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
- #if SMTG_OS_WINDOWS
+ #if 0
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
@@ -1622,7 +1630,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
- #elif SMTG_OS_LINUX
+ #elif 1
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return c;
@@ -1636,7 +1644,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1650,7 +1658,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
- #if SMTG_OS_WINDOWS
+ #if 0
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1877,7 +1885,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
-#if SMTG_OS_WINDOWS
+#if 0
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif
@@ -1900,7 +1908,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
#endif
-#if SMTG_OS_LINUX
+#if 1
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1935,7 +1943,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
-#if SMTG_OS_WINDOWS
+#if 0
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, nullptr, nullptr);
#elif SMTG_OS_MACOS
@@ -1959,7 +1967,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2022,7 +2030,7 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
@@ -2280,7 +2288,7 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == nullptr)
return true;
-#if SMTG_OS_WINDOWS
+#if 0
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
Submodule pluginterfaces contains modified content
diff --git a/pluginterfaces/base/fstrdefs.h b/pluginterfaces/base/fstrdefs.h
index 77cc9f2..9534bff 100644
--- a/pluginterfaces/base/fstrdefs.h
+++ b/pluginterfaces/base/fstrdefs.h
@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
- #if SMTG_OS_WINDOWS
+ #if __WINE__
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))
-#if SMTG_OS_WINDOWS
+#if 0
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"
-#elif SMTG_OS_MACOS || SMTG_OS_LINUX
+#elif SMTG_OS_MACOS || 1
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
-#if SMTG_OS_WINDOWS
+#if 0
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
-#elif SMTG_OS_LINUX
+#elif 1
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif
-#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
+#if 0 && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
diff --git a/pluginterfaces/base/ftypes.h b/pluginterfaces/base/ftypes.h
index 1f95bd1..826f311 100644
--- a/pluginterfaces/base/ftypes.h
+++ b/pluginterfaces/base/ftypes.h
@@ -93,7 +93,7 @@ namespace Steinberg
typedef char char8;
#ifdef _NATIVE_WCHAR_T_DEFINED
typedef __wchar_t char16;
-#elif defined(__MINGW32__)
+#elif defined(__WINE__)
typedef wchar_t char16;
#elif SMTG_CPP11
typedef char16_t char16;
@@ -172,7 +172,7 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
- #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
+ #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__WINE__)
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif SMTG_OS_WINDOWS
diff --git a/pluginterfaces/base/ustring.cpp b/pluginterfaces/base/ustring.cpp
index 24a412f..1113642 100644
--- a/pluginterfaces/base/ustring.cpp
+++ b/pluginterfaces/base/ustring.cpp
@@ -16,7 +16,7 @@
#include "ustring.h"
-#if SMTG_OS_WINDOWS
+#if 0
#include <cstdio>
#ifdef _MSC_VER
@@ -26,7 +26,7 @@
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
-#elif SMTG_OS_LINUX
+#elif 1
#include <cstring>
#include <string>
#include <codecvt>
@@ -42,12 +42,16 @@
namespace Steinberg {
//------------------------------------------------------------------------
-#if SMTG_OS_LINUX
+#if 1
//------------------------------------------------------------------------
namespace {
-using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#ifdef __WINE__
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>;
+#else
+ using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;
+#endif
//------------------------------------------------------------------------
Converter& converter ()
@@ -60,7 +64,7 @@ Converter& converter ()
} // anonymous
//------------------------------------------------------------------------
-#endif // SMTG_OS_LINUX
+#endif // 1
//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -145,7 +149,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;
#elif TARGET_API_MAC_CARBON
@@ -158,7 +162,7 @@ bool UString::scanFloat (double& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;
@@ -172,7 +176,7 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif SMTG_OS_MACOS
bool result = false;
@@ -186,7 +190,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -210,7 +214,7 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
-#if SMTG_OS_WINDOWS
+#if 0
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;
#elif SMTG_OS_MACOS
@@ -223,7 +227,7 @@ bool UString::scanInt (int64& value) const
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;
@@ -237,7 +241,7 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
-#if SMTG_OS_WINDOWS
+#if 0
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;
#elif SMTG_OS_MACOS
@@ -251,7 +255,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
-#elif SMTG_OS_LINUX
+#elif 1
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)
Submodule public.sdk contains modified content
diff --git a/public.sdk/source/common/systemclipboard_win32.cpp b/public.sdk/source/common/systemclipboard_win32.cpp
index c5cb2b8..2ee3d65 100644
--- a/public.sdk/source/common/systemclipboard_win32.cpp
+++ b/public.sdk/source/common/systemclipboard_win32.cpp
@@ -111,7 +111,7 @@ bool copyTextToClipboard (const std::string& text)
{
if (auto* data = static_cast<WCHAR*> (GlobalLock (memory)))
{
-#if defined(__MINGW32__)
+#if defined(__WINE__)
memcpy (data, wideStr.data (), byteSize);
#else
memcpy_s (data, byteSize, wideStr.data (), byteSize);
diff --git a/public.sdk/source/vst/hosting/module_win32.cpp b/public.sdk/source/vst/hosting/module_win32.cpp
index f7b1735..4ecef73 100644
--- a/public.sdk/source/vst/hosting/module_win32.cpp
+++ b/public.sdk/source/vst/hosting/module_win32.cpp
@@ -55,15 +55,15 @@
#endif
#if USE_FILESYSTEM == 1
-#include <filesystem>
-namespace filesystem = std::filesystem;
+#include <ghc/filesystem.hpp>
+namespace filesystem = ghc::filesystem;
#else
// The <experimental/filesystem> header is deprecated. It is superseded by the C++17 <filesystem>
// header. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence the
// warning, otherwise the build will fail in VS2020 16.3.0
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
-#include <experimental/filesystem>
-namespace filesystem = std::experimental::filesystem;
+#include <ghc/filesystem.hpp>
+namespace filesystem = ghc::filesystem;
#endif
#pragma comment(lib, "Shell32")
@@ -248,7 +248,7 @@ VST3::Optional<filesystem::path> resolveShellLink (const filesystem::path& p)
#if USE_OLE
Ole::instance ();
- IShellLink* shellLink = nullptr;
+ IShellLinkW* shellLink = nullptr;
if (!SUCCEEDED (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, reinterpret_cast<LPVOID*> (&shellLink))))
return {};
@@ -335,13 +335,13 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (p);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (cp, ext, pathList, recursive);
}
else
- pathList.push_back (cp.generic_u8string ());
+ pathList.push_back (cp.generic_string ());
}
else if (recursive)
{
@@ -361,18 +361,18 @@ void findFilesWithExt (const filesystem::path& path, const std::string& ext,
filesystem::path finalPath (*resolvedLink);
if (checkVST3Package (finalPath))
{
- pathList.push_back (finalPath.generic_u8string ());
+ pathList.push_back (finalPath.generic_string ());
continue;
}
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}
else
- pathList.push_back (resolvedLink->generic_u8string ());
+ pathList.push_back (resolvedLink->generic_string ());
}
else if (filesystem::is_directory (*resolvedLink))
{
- const auto& str = resolvedLink->generic_u8string ();
- if (cp.generic_u8string ().compare (0, str.size (), str.data (),
+ const auto& str = resolvedLink->generic_string ();
+ if (cp.generic_string ().compare (0, str.size (), str.data (),
str.size ()) != 0)
findFilesWithExt (*resolvedLink, ext, pathList, recursive);
}