Browse Source

Fix build with win32 unicode

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 2 years ago
parent
commit
f75582a2f3
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 21 additions and 21 deletions
  1. +2
    -2
      source/modules/water/common.hpp
  2. +2
    -2
      source/modules/water/files/FileInputStream.cpp
  3. +2
    -2
      source/modules/water/files/FileOutputStream.cpp
  4. +5
    -5
      source/modules/water/threads/ChildProcess.cpp
  5. +1
    -1
      source/utils/CarlaPipeUtils.cpp
  6. +9
    -9
      source/utils/CarlaPluginUI.cpp

+ 2
- 2
source/modules/water/common.hpp View File

@@ -41,9 +41,9 @@ namespace water
static inline
Result getResultForLastError()
{
TCHAR messageBuffer [256] = { 0 };
CHAR messageBuffer [256] = { 0 };
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, GetLastError(), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
messageBuffer, (DWORD) numElementsInArray (messageBuffer) - 1, nullptr);


+ 2
- 2
source/modules/water/files/FileInputStream.cpp View File

@@ -91,8 +91,8 @@ FileInputStream::~FileInputStream()
void FileInputStream::openHandle()
{
HANDLE h = CreateFile (file.getFullPathName().toUTF8(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
HANDLE h = CreateFileA (file.getFullPathName().toUTF8(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
if (h != INVALID_HANDLE_VALUE)
fileHandle = (void*) h;


+ 2
- 2
source/modules/water/files/FileOutputStream.cpp View File

@@ -139,8 +139,8 @@ bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes)
#ifdef CARLA_OS_WIN
void FileOutputStream::openHandle()
{
HANDLE h = CreateFile (file.getFullPathName().toUTF8(), GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
HANDLE h = CreateFileA (file.getFullPathName().toUTF8(), GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE)
{


+ 5
- 5
source/modules/water/threads/ChildProcess.cpp View File

@@ -49,13 +49,13 @@ public:
ActiveProcess (const String& command)
: ok (false)
{
STARTUPINFO startupInfo;
STARTUPINFOA startupInfo;
carla_zeroStruct(startupInfo);
startupInfo.cb = sizeof (startupInfo);
ok = CreateProcess (nullptr, const_cast<LPSTR>(command.toRawUTF8()),
nullptr, nullptr, TRUE, CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT,
nullptr, nullptr, &startupInfo, &processInfo) != FALSE;
ok = CreateProcessA (nullptr, const_cast<LPSTR>(command.toRawUTF8()),
nullptr, nullptr, TRUE, CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT,
nullptr, nullptr, &startupInfo, &processInfo) != FALSE;
}
~ActiveProcess()
@@ -164,7 +164,7 @@ public:
// posix_spawnattr_setflags(&attr, POSIX_SPAWN_USEVFORK);
CARLA_SAFE_ASSERT_RETURN(posix_spawnattr_setbinpref_np(&attr, 1, &pref, nullptr) == 0,);
char*** const environptr = _NSGetEnviron();
CARLA_SAFE_ASSERT_RETURN(posix_spawn(&result, exe.toRawUTF8(), nullptr, &attr,
CARLA_SAFE_ASSERT_RETURN(posix_spawn(&result, exe.toRawUTF8(), nullptr, &attr,
argv.getRawDataPointer(), environptr != nullptr ? *environptr : nullptr) == 0,);
posix_spawnattr_destroy(&attr);
#else


+ 1
- 1
source/utils/CarlaPipeUtils.cpp View File

@@ -241,7 +241,7 @@ bool startProcess(const char* const argv[], PROCESS_INFORMATION* const processIn

command = command.trim();

STARTUPINFO startupInfo;
STARTUPINFOA startupInfo;
carla_zeroStruct(startupInfo);
startupInfo.cb = sizeof(startupInfo);



+ 9
- 9
source/utils/CarlaPluginUI.cpp View File

@@ -904,7 +904,7 @@ public:
fWindowClass.hCursor = LoadCursor(hInstance, IDC_ARROW);
fWindowClass.lpszClassName = strdup(classNameBuf);

if (!RegisterClass(&fWindowClass)) {
if (!RegisterClassA(&fWindowClass)) {
free((void*)fWindowClass.lpszClassName);
return;
}
@@ -922,18 +922,18 @@ public:
const HWND parent = (HWND)parentId;
#endif

fWindow = CreateWindowEx(winType,
classNameBuf, "Carla Plugin UI", winFlags,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
parent, nullptr,
hInstance, nullptr);
fWindow = CreateWindowExA(winType,
classNameBuf, "Carla Plugin UI", winFlags,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
parent, nullptr,
hInstance, nullptr);

if (fWindow == nullptr)
{
const DWORD errorCode = ::GetLastError();
carla_stderr2("CreateWindowEx failed with error code 0x%x, class name was '%s'",
errorCode, fWindowClass.lpszClassName);
UnregisterClass(fWindowClass.lpszClassName, nullptr);
UnregisterClassA(fWindowClass.lpszClassName, nullptr);
free((void*)fWindowClass.lpszClassName);
return;
}
@@ -964,7 +964,7 @@ public:
}

// FIXME
UnregisterClass(fWindowClass.lpszClassName, nullptr);
UnregisterClassA(fWindowClass.lpszClassName, nullptr);
free((void*)fWindowClass.lpszClassName);
}

@@ -1125,7 +1125,7 @@ private:
HWND fWindow;
HWND fChildWindow;
HWND fParentWindow;
WNDCLASS fWindowClass;
WNDCLASSA fWindowClass;

bool fIsVisible;
bool fFirstShow;


Loading…
Cancel
Save