@@ -21,7 +21,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | |||||
-Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align | -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align | ||||
-Wno-implicit-fallthrough -Wno-maybe-uninitialized | -Wno-implicit-fallthrough -Wno-maybe-uninitialized | ||||
-Wno-missing-field-initializers -Wno-ignored-qualifiers -Wswitch-enum | -Wno-missing-field-initializers -Wno-ignored-qualifiers -Wswitch-enum | ||||
-Wswitch-default -Wredundant-decls) | |||||
-Wredundant-decls) | |||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0") | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0") | ||||
target_compile_options(juce_recommended_warning_flags INTERFACE "-Wno-strict-overflow") | target_compile_options(juce_recommended_warning_flags INTERFACE "-Wno-strict-overflow") | ||||
@@ -549,9 +549,19 @@ function(juce_add_module module_path) | |||||
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs) | _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs) | ||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") | elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||||
target_compile_options(${module_name} INTERFACE /bigobj) | |||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")) | |||||
if(module_name STREQUAL "juce_gui_basics") | |||||
target_compile_options(${module_name} INTERFACE /bigobj) | |||||
endif() | |||||
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs) | |||||
elseif(MSYS OR MINGW) | |||||
if(module_name STREQUAL "juce_gui_basics") | |||||
target_compile_options(${module_name} INTERFACE "-Wa,-mbig-obj") | |||||
endif() | |||||
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs) | |||||
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" mingwLibs) | |||||
endif() | |||||
endif() | endif() | ||||
_juce_get_metadata("${metadata_dict}" dependencies module_dependencies) | _juce_get_metadata("${metadata_dict}" dependencies module_dependencies) | ||||
@@ -241,7 +241,7 @@ void BinaryResources::loadFromCpp (const File& cppFileLocation, const String& cp | |||||
if (c >= '0' && c <= '9') | if (c >= '0' && c <= '9') | ||||
{ | { | ||||
n = n * 10 + (c - '0'); | |||||
n = n * 10 + (int) (c - '0'); | |||||
} | } | ||||
else if (c == ',') | else if (c == ',') | ||||
{ | { | ||||
@@ -283,7 +283,7 @@ void sendQuitMessageToIDE (void* server) | |||||
#define WIN32_LEAN_AND_MEAN 1 | #define WIN32_LEAN_AND_MEAN 1 | ||||
#include <windows.h> | #include <windows.h> | ||||
static HANDLE parentProcessHandle = 0; | |||||
static HANDLE parentProcessHandle = nullptr; | |||||
static void setParentProcessID (int pid) { parentProcessHandle = OpenProcess (SYNCHRONIZE, FALSE, (DWORD) pid); } | static void setParentProcessID (int pid) { parentProcessHandle = OpenProcess (SYNCHRONIZE, FALSE, (DWORD) pid); } | ||||
static int getCurrentProcessID() { return (int) GetCurrentProcessId(); } | static int getCurrentProcessID() { return (int) GetCurrentProcessId(); } | ||||
#endif | #endif | ||||
@@ -45,7 +45,7 @@ struct CppParserHelpers | |||||
for (int i = 0; i < text.length(); ++i) | for (int i = 0; i < text.length(); ++i) | ||||
{ | { | ||||
const int digit = text[i] - '0'; | |||||
const auto digit = (int) (text[i] - '0'); | |||||
if (digit < 0 || digit > 7) | if (digit < 0 || digit > 7) | ||||
break; | break; | ||||
@@ -117,7 +117,7 @@ struct TranslationHelpers | |||||
break; | break; | ||||
++p; | ++p; | ||||
c = (juce_wchar) ((c << 4) + digitValue); | |||||
c = (c << 4) + (juce_wchar) digitValue; | |||||
} | } | ||||
break; | break; | ||||
@@ -128,12 +128,12 @@ struct TranslationHelpers | |||||
for (int i = 4; --i >= 0;) | for (int i = 4; --i >= 0;) | ||||
{ | { | ||||
const int digitValue = *p - '0'; | |||||
const auto digitValue = (int) (*p - '0'); | |||||
if (digitValue < 0 || digitValue > 7) | if (digitValue < 0 || digitValue > 7) | ||||
break; | break; | ||||
++p; | ++p; | ||||
c = (juce_wchar) ((c << 3) + digitValue); | |||||
c = (c << 3) + (juce_wchar) digitValue; | |||||
} | } | ||||
break; | break; | ||||
@@ -321,7 +321,7 @@ void MemoryBlock::loadFromHexString (StringRef hex) | |||||
for (;;) | for (;;) | ||||
{ | { | ||||
int byte = 0; | |||||
juce_wchar byte = 0; | |||||
for (int loop = 2; --loop >= 0;) | for (int loop = 2; --loop >= 0;) | ||||
{ | { | ||||
@@ -56,7 +56,7 @@ inline GUID uuidFromString (const char* s) noexcept | |||||
for (uint32 digitIndex = 0; digitIndex < 32;) | for (uint32 digitIndex = 0; digitIndex < 32;) | ||||
{ | { | ||||
auto c = *s++; | |||||
auto c = (uint32) *s++; | |||||
uint32 digit; | uint32 digit; | ||||
if (c >= '0' && c <= '9') digit = c - '0'; | if (c >= '0' && c <= '9') digit = c - '0'; | ||||
@@ -114,7 +114,7 @@ public: | |||||
HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER) | HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER) | ||||
{ | { | ||||
auto hr = ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress()); | |||||
auto hr = ::CoCreateInstance (classUUID, nullptr, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress()); | |||||
jassert (hr != CO_E_NOTINITIALIZED); // You haven't called CoInitialize for the current thread! | jassert (hr != CO_E_NOTINITIALIZED); // You haven't called CoInitialize for the current thread! | ||||
return hr; | return hr; | ||||
} | } | ||||
@@ -131,7 +131,7 @@ namespace WindowsFileHelpers | |||||
{ | { | ||||
WCHAR path[MAX_PATH + 256]; | WCHAR path[MAX_PATH + 256]; | ||||
if (SHGetSpecialFolderPath (0, path, type, FALSE)) | |||||
if (SHGetSpecialFolderPath (nullptr, path, type, FALSE)) | |||||
return File (String (path)); | return File (String (path)); | ||||
return {}; | return {}; | ||||
@@ -264,14 +264,14 @@ bool File::replaceInternal (const File& dest) const | |||||
{ | { | ||||
return ReplaceFile (dest.getFullPathName().toWideCharPointer(), | return ReplaceFile (dest.getFullPathName().toWideCharPointer(), | ||||
fullPath.toWideCharPointer(), | fullPath.toWideCharPointer(), | ||||
0, REPLACEFILE_IGNORE_MERGE_ERRORS | 4 /*REPLACEFILE_IGNORE_ACL_ERRORS*/, | |||||
nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS | 4 /*REPLACEFILE_IGNORE_ACL_ERRORS*/, | |||||
nullptr, nullptr) != 0; | nullptr, nullptr) != 0; | ||||
} | } | ||||
Result File::createDirectoryInternal (const String& fileName) const | Result File::createDirectoryInternal (const String& fileName) const | ||||
{ | { | ||||
return CreateDirectory (fileName.toWideCharPointer(), 0) ? Result::ok() | |||||
: WindowsFileHelpers::getResultForLastError(); | |||||
return CreateDirectory (fileName.toWideCharPointer(), nullptr) ? Result::ok() | |||||
: WindowsFileHelpers::getResultForLastError(); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -287,8 +287,8 @@ int64 juce_fileSetPosition (void* handle, int64 pos) | |||||
void FileInputStream::openHandle() | void FileInputStream::openHandle() | ||||
{ | { | ||||
auto h = CreateFile (file.getFullPathName().toWideCharPointer(), | auto h = CreateFile (file.getFullPathName().toWideCharPointer(), | ||||
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, | |||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0); | |||||
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, | |||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
fileHandle = (void*) h; | fileHandle = (void*) h; | ||||
@@ -303,11 +303,11 @@ FileInputStream::~FileInputStream() | |||||
size_t FileInputStream::readInternal (void* buffer, size_t numBytes) | size_t FileInputStream::readInternal (void* buffer, size_t numBytes) | ||||
{ | { | ||||
if (fileHandle != 0) | |||||
if (fileHandle != nullptr) | |||||
{ | { | ||||
DWORD actualNum = 0; | DWORD actualNum = 0; | ||||
if (! ReadFile ((HANDLE) fileHandle, buffer, (DWORD) numBytes, &actualNum, 0)) | |||||
if (! ReadFile ((HANDLE) fileHandle, buffer, (DWORD) numBytes, &actualNum, nullptr)) | |||||
status = WindowsFileHelpers::getResultForLastError(); | status = WindowsFileHelpers::getResultForLastError(); | ||||
return (size_t) actualNum; | return (size_t) actualNum; | ||||
@@ -320,8 +320,8 @@ size_t FileInputStream::readInternal (void* buffer, size_t numBytes) | |||||
void FileOutputStream::openHandle() | void FileOutputStream::openHandle() | ||||
{ | { | ||||
auto h = CreateFile (file.getFullPathName().toWideCharPointer(), | auto h = CreateFile (file.getFullPathName().toWideCharPointer(), | ||||
GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||||
GENERIC_WRITE, FILE_SHARE_READ, nullptr, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
@@ -350,7 +350,7 @@ ssize_t FileOutputStream::writeInternal (const void* bufferToWrite, size_t numBy | |||||
DWORD actualNum = 0; | DWORD actualNum = 0; | ||||
if (fileHandle != nullptr) | if (fileHandle != nullptr) | ||||
if (! WriteFile ((HANDLE) fileHandle, bufferToWrite, (DWORD) numBytes, &actualNum, 0)) | |||||
if (! WriteFile ((HANDLE) fileHandle, bufferToWrite, (DWORD) numBytes, &actualNum, nullptr)) | |||||
status = WindowsFileHelpers::getResultForLastError(); | status = WindowsFileHelpers::getResultForLastError(); | ||||
return (ssize_t) actualNum; | return (ssize_t) actualNum; | ||||
@@ -398,18 +398,18 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode, bool exc | |||||
} | } | ||||
auto h = CreateFile (file.getFullPathName().toWideCharPointer(), accessMode, | auto h = CreateFile (file.getFullPathName().toWideCharPointer(), accessMode, | ||||
exclusive ? 0 : (FILE_SHARE_READ | FILE_SHARE_DELETE | (mode == readWrite ? FILE_SHARE_WRITE : 0)), 0, | |||||
createType, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0); | |||||
exclusive ? 0 : (FILE_SHARE_READ | FILE_SHARE_DELETE | (mode == readWrite ? FILE_SHARE_WRITE : 0)), nullptr, | |||||
createType, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
fileHandle = (void*) h; | fileHandle = (void*) h; | ||||
auto mappingHandle = CreateFileMapping (h, 0, protect, | |||||
auto mappingHandle = CreateFileMapping (h, nullptr, protect, | |||||
(DWORD) (range.getEnd() >> 32), | (DWORD) (range.getEnd() >> 32), | ||||
(DWORD) range.getEnd(), 0); | |||||
(DWORD) range.getEnd(), nullptr); | |||||
if (mappingHandle != 0) | |||||
if (mappingHandle != nullptr) | |||||
{ | { | ||||
address = MapViewOfFile (mappingHandle, access, (DWORD) (range.getStart() >> 32), | address = MapViewOfFile (mappingHandle, access, (DWORD) (range.getStart() >> 32), | ||||
(DWORD) range.getStart(), (SIZE_T) range.getLength()); | (DWORD) range.getStart(), (SIZE_T) range.getLength()); | ||||
@@ -465,8 +465,8 @@ bool File::setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 | |||||
bool ok = false; | bool ok = false; | ||||
auto h = CreateFile (fullPath.toWideCharPointer(), | auto h = CreateFile (fullPath.toWideCharPointer(), | ||||
GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||||
GENERIC_WRITE, FILE_SHARE_READ, nullptr, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
@@ -512,7 +512,7 @@ String File::getVolumeLabel() const | |||||
TCHAR dest[64]; | TCHAR dest[64]; | ||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | ||||
(DWORD) numElementsInArray (dest), 0, 0, 0, 0, 0)) | |||||
(DWORD) numElementsInArray (dest), nullptr, nullptr, nullptr, nullptr, 0)) | |||||
dest[0] = 0; | dest[0] = 0; | ||||
return dest; | return dest; | ||||
@@ -524,7 +524,7 @@ int File::getVolumeSerialNumber() const | |||||
DWORD serialNum; | DWORD serialNum; | ||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | ||||
(DWORD) numElementsInArray (dest), &serialNum, 0, 0, 0, 0)) | |||||
(DWORD) numElementsInArray (dest), &serialNum, nullptr, nullptr, nullptr, 0)) | |||||
return 0; | return 0; | ||||
return (int) serialNum; | return (int) serialNum; | ||||
@@ -551,7 +551,7 @@ uint64 File::getFileIdentifier() const | |||||
auto h = CreateFile (path.toWideCharPointer(), | auto h = CreateFile (path.toWideCharPointer(), | ||||
GENERIC_READ, FILE_SHARE_READ, nullptr, | GENERIC_READ, FILE_SHARE_READ, nullptr, | ||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); | |||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
@@ -640,7 +640,7 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type) | |||||
return WindowsFileHelpers::getModuleFileName ((HINSTANCE) Process::getCurrentModuleInstanceHandle()); | return WindowsFileHelpers::getModuleFileName ((HINSTANCE) Process::getCurrentModuleInstanceHandle()); | ||||
case hostApplicationPath: | case hostApplicationPath: | ||||
return WindowsFileHelpers::getModuleFileName (0); | |||||
return WindowsFileHelpers::getModuleFileName (nullptr); | |||||
default: | default: | ||||
jassertfalse; // unknown type? | jassertfalse; // unknown type? | ||||
@@ -715,7 +715,7 @@ static String readWindowsLnkFile (File lnkFile, bool wantsAbsolutePath) | |||||
if (SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) | if (SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) | ||||
&& SUCCEEDED (shellLink.QueryInterface (persistFile)) | && SUCCEEDED (shellLink.QueryInterface (persistFile)) | ||||
&& SUCCEEDED (persistFile->Load (lnkFile.getFullPathName().toWideCharPointer(), STGM_READ)) | && SUCCEEDED (persistFile->Load (lnkFile.getFullPathName().toWideCharPointer(), STGM_READ)) | ||||
&& (! wantsAbsolutePath || SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI)))) | |||||
&& (! wantsAbsolutePath || SUCCEEDED (shellLink->Resolve (nullptr, SLR_ANY_MATCH | SLR_NO_UI)))) | |||||
{ | { | ||||
WIN32_FIND_DATA winFindData; | WIN32_FIND_DATA winFindData; | ||||
WCHAR resolvedPath[MAX_PATH]; | WCHAR resolvedPath[MAX_PATH]; | ||||
@@ -741,7 +741,7 @@ static String readWindowsShortcutOrLink (const File& shortcut, bool wantsAbsolut | |||||
HANDLE h = CreateFile (shortcut.getFullPathName().toWideCharPointer(), | HANDLE h = CreateFile (shortcut.getFullPathName().toWideCharPointer(), | ||||
GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, | GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, | ||||
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, | FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, | ||||
0); | |||||
nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
@@ -809,7 +809,7 @@ static String readWindowsShortcutOrLink (const File& shortcut, bool wantsAbsolut | |||||
{ | { | ||||
HANDLE h = CreateFile (shortcut.getFullPathName().toWideCharPointer(), | HANDLE h = CreateFile (shortcut.getFullPathName().toWideCharPointer(), | ||||
GENERIC_READ, FILE_SHARE_READ, nullptr, | GENERIC_READ, FILE_SHARE_READ, nullptr, | ||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); | |||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); | |||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
@@ -861,7 +861,7 @@ bool File::createShortcut (const String& description, const File& linkFileToCrea | |||||
ComSmartPtr<IShellLink> shellLink; | ComSmartPtr<IShellLink> shellLink; | ||||
ComSmartPtr<IPersistFile> persistFile; | ComSmartPtr<IPersistFile> persistFile; | ||||
CoInitialize (0); | |||||
CoInitialize (nullptr); | |||||
return SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) | return SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) | ||||
&& SUCCEEDED (shellLink->SetPath (getFullPathName().toWideCharPointer())) | && SUCCEEDED (shellLink->SetPath (getFullPathName().toWideCharPointer())) | ||||
@@ -945,8 +945,8 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, | |||||
//============================================================================== | //============================================================================== | ||||
bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) | bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) | ||||
{ | { | ||||
HINSTANCE hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), | |||||
parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); | |||||
HINSTANCE hInstance = ShellExecute (nullptr, nullptr, fileName.toWideCharPointer(), | |||||
parameters.toWideCharPointer(), nullptr, SW_SHOWDEFAULT); | |||||
return hInstance > (HINSTANCE) 32; | return hInstance > (HINSTANCE) 32; | ||||
} | } | ||||
@@ -975,14 +975,14 @@ public: | |||||
Pimpl (const String& pipeName, const bool createPipe, bool mustNotExist) | Pimpl (const String& pipeName, const bool createPipe, bool mustNotExist) | ||||
: filename ("\\\\.\\pipe\\" + File::createLegalFileName (pipeName)), | : filename ("\\\\.\\pipe\\" + File::createLegalFileName (pipeName)), | ||||
pipeH (INVALID_HANDLE_VALUE), | pipeH (INVALID_HANDLE_VALUE), | ||||
cancelEvent (CreateEvent (0, FALSE, FALSE, 0)), | |||||
cancelEvent (CreateEvent (nullptr, FALSE, FALSE, nullptr)), | |||||
connected (false), ownsPipe (createPipe), shouldStop (false) | connected (false), ownsPipe (createPipe), shouldStop (false) | ||||
{ | { | ||||
if (createPipe) | if (createPipe) | ||||
{ | { | ||||
pipeH = CreateNamedPipe (filename.toWideCharPointer(), | pipeH = CreateNamedPipe (filename.toWideCharPointer(), | ||||
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | ||||
PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, 0); | |||||
PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, nullptr); | |||||
if (mustNotExist && GetLastError() == ERROR_ALREADY_EXISTS) | if (mustNotExist && GetLastError() == ERROR_ALREADY_EXISTS) | ||||
closePipeHandle(); | closePipeHandle(); | ||||
@@ -1011,8 +1011,8 @@ public: | |||||
if (pipeH == INVALID_HANDLE_VALUE) | if (pipeH == INVALID_HANDLE_VALUE) | ||||
pipeH = CreateFile (filename.toWideCharPointer(), | pipeH = CreateFile (filename.toWideCharPointer(), | ||||
GENERIC_READ | GENERIC_WRITE, 0, 0, | |||||
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | |||||
GENERIC_READ | GENERIC_WRITE, 0, nullptr, | |||||
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr); | |||||
} | } | ||||
if (pipeH != INVALID_HANDLE_VALUE) | if (pipeH != INVALID_HANDLE_VALUE) | ||||
@@ -1136,7 +1136,7 @@ private: | |||||
OverlappedEvent() | OverlappedEvent() | ||||
{ | { | ||||
zerostruct (over); | zerostruct (over); | ||||
over.hEvent = CreateEvent (0, TRUE, FALSE, 0); | |||||
over.hEvent = CreateEvent (nullptr, TRUE, FALSE, nullptr); | |||||
} | } | ||||
~OverlappedEvent() | ~OverlappedEvent() | ||||
@@ -1154,7 +1154,7 @@ private: | |||||
HANDLE handles[] = { over.over.hEvent, cancelEvent }; | HANDLE handles[] = { over.over.hEvent, cancelEvent }; | ||||
DWORD waitResult = WaitForMultipleObjects (2, handles, FALSE, | DWORD waitResult = WaitForMultipleObjects (2, handles, FALSE, | ||||
timeOutMilliseconds >= 0 ? timeOutMilliseconds | |||||
timeOutMilliseconds >= 0 ? (DWORD) timeOutMilliseconds | |||||
: INFINITE); | : INFINITE); | ||||
if (waitResult == WAIT_OBJECT_0) | if (waitResult == WAIT_OBJECT_0) | ||||
@@ -90,7 +90,7 @@ public: | |||||
{ | { | ||||
HeapBlock<char> buffer (bufferSizeBytes); | HeapBlock<char> buffer (bufferSizeBytes); | ||||
if (HttpQueryInfo (request, HTTP_QUERY_RAW_HEADERS_CRLF, buffer.getData(), &bufferSizeBytes, 0)) | |||||
if (HttpQueryInfo (request, HTTP_QUERY_RAW_HEADERS_CRLF, buffer.getData(), &bufferSizeBytes, nullptr)) | |||||
{ | { | ||||
StringArray headersArray; | StringArray headersArray; | ||||
headersArray.addLines (String (reinterpret_cast<const WCHAR*> (buffer.getData()))); | headersArray.addLines (String (reinterpret_cast<const WCHAR*> (buffer.getData()))); | ||||
@@ -116,7 +116,7 @@ public: | |||||
DWORD status = 0; | DWORD status = 0; | ||||
DWORD statusSize = sizeof (status); | DWORD statusSize = sizeof (status); | ||||
if (HttpQueryInfo (request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &statusSize, 0)) | |||||
if (HttpQueryInfo (request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &statusSize, nullptr)) | |||||
{ | { | ||||
statusCode = (int) status; | statusCode = (int) status; | ||||
@@ -151,10 +151,10 @@ public: | |||||
break; | break; | ||||
} | } | ||||
return (request != 0); | |||||
return (request != nullptr); | |||||
} | } | ||||
bool isError() const { return request == 0; } | |||||
bool isError() const { return request == nullptr; } | |||||
bool isExhausted() { return finished; } | bool isExhausted() { return finished; } | ||||
int64 getPosition() { return position; } | int64 getPosition() { return position; } | ||||
@@ -207,7 +207,7 @@ public: | |||||
if (wantedPos != position) | if (wantedPos != position) | ||||
{ | { | ||||
finished = false; | finished = false; | ||||
position = (int64) InternetSetFilePointer (request, (LONG) wantedPos, 0, FILE_BEGIN, 0); | |||||
position = (int64) InternetSetFilePointer (request, (LONG) wantedPos, nullptr, FILE_BEGIN, 0); | |||||
if (position == wantedPos) | if (position == wantedPos) | ||||
return true; | return true; | ||||
@@ -232,7 +232,7 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
WebInputStream& owner; | WebInputStream& owner; | ||||
const URL url; | const URL url; | ||||
HINTERNET connection = 0, request = 0; | |||||
HINTERNET connection = nullptr, request = nullptr; | |||||
String headers; | String headers; | ||||
MemoryBlock postData; | MemoryBlock postData; | ||||
int64 position = 0; | int64 position = 0; | ||||
@@ -249,25 +249,25 @@ private: | |||||
{ | { | ||||
HINTERNET requestCopy = request; | HINTERNET requestCopy = request; | ||||
request = 0; | |||||
request = nullptr; | |||||
if (requestCopy != 0) | |||||
if (requestCopy != nullptr) | |||||
InternetCloseHandle (requestCopy); | InternetCloseHandle (requestCopy); | ||||
if (connection != 0) | |||||
if (connection != nullptr) | |||||
{ | { | ||||
InternetCloseHandle (connection); | InternetCloseHandle (connection); | ||||
connection = 0; | |||||
connection = nullptr; | |||||
} | } | ||||
} | } | ||||
void createConnection (const String& address, WebInputStream::Listener* listener) | void createConnection (const String& address, WebInputStream::Listener* listener) | ||||
{ | { | ||||
static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0); | |||||
static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0); | |||||
closeConnection(); | closeConnection(); | ||||
if (sessionHandle != 0) | |||||
if (sessionHandle != nullptr) | |||||
{ | { | ||||
// break up the url.. | // break up the url.. | ||||
const int fileNumChars = 65536; | const int fileNumChars = 65536; | ||||
@@ -319,7 +319,7 @@ private: | |||||
{ | { | ||||
const ScopedLock lock (createConnectionLock); | const ScopedLock lock (createConnectionLock); | ||||
connection = hasBeenCancelled ? 0 | |||||
connection = hasBeenCancelled ? nullptr | |||||
: InternetConnect (sessionHandle, | : InternetConnect (sessionHandle, | ||||
uc.lpszHostName, uc.nPort, | uc.lpszHostName, uc.nPort, | ||||
uc.lpszUserName, uc.lpszPassword, | uc.lpszUserName, uc.lpszPassword, | ||||
@@ -328,7 +328,7 @@ private: | |||||
0, 0); | 0, 0); | ||||
} | } | ||||
if (connection != 0) | |||||
if (connection != nullptr) | |||||
{ | { | ||||
if (isFtp) | if (isFtp) | ||||
request = FtpOpenFile (connection, uc.lpszUrlPath, GENERIC_READ, | request = FtpOpenFile (connection, uc.lpszUrlPath, GENERIC_READ, | ||||
@@ -345,7 +345,7 @@ private: | |||||
void sendHTTPRequest (INTERNET_BUFFERS& buffers, WebInputStream::Listener* listener) | void sendHTTPRequest (INTERNET_BUFFERS& buffers, WebInputStream::Listener* listener) | ||||
{ | { | ||||
if (! HttpSendRequestEx (request, &buffers, 0, HSR_INITIATE, 0)) | |||||
if (! HttpSendRequestEx (request, &buffers, nullptr, HSR_INITIATE, 0)) | |||||
return; | return; | ||||
int totalBytesSent = 0; | int totalBytesSent = 0; | ||||
@@ -362,7 +362,7 @@ private: | |||||
return; | return; | ||||
} | } | ||||
totalBytesSent += bytesSent; | |||||
totalBytesSent += (int) bytesSent; | |||||
if (listener != nullptr | if (listener != nullptr | ||||
&& ! listener->postDataSendProgress (owner, totalBytesSent, (int) postData.getSize())) | && ! listener->postDataSendProgress (owner, totalBytesSent, (int) postData.getSize())) | ||||
@@ -386,12 +386,12 @@ private: | |||||
{ | { | ||||
const ScopedLock lock (createConnectionLock); | const ScopedLock lock (createConnectionLock); | ||||
request = hasBeenCancelled ? 0 | |||||
request = hasBeenCancelled ? nullptr | |||||
: HttpOpenRequest (connection, httpRequestCmd.toWideCharPointer(), | : HttpOpenRequest (connection, httpRequestCmd.toWideCharPointer(), | ||||
uc.lpszUrlPath, 0, 0, mimeTypes, flags, 0); | |||||
uc.lpszUrlPath, nullptr, nullptr, mimeTypes, flags, 0); | |||||
} | } | ||||
if (request != 0) | |||||
if (request != nullptr) | |||||
{ | { | ||||
INTERNET_BUFFERS buffers = {}; | INTERNET_BUFFERS buffers = {}; | ||||
buffers.dwStructSize = sizeof (INTERNET_BUFFERS); | buffers.dwStructSize = sizeof (INTERNET_BUFFERS); | ||||
@@ -403,7 +403,7 @@ private: | |||||
{ | { | ||||
sendHTTPRequest (buffers, listener); | sendHTTPRequest (buffers, listener); | ||||
if (HttpEndRequest (request, 0, 0, 0)) | |||||
if (HttpEndRequest (request, nullptr, 0, 0)) | |||||
return true; | return true; | ||||
return false; | return false; | ||||
@@ -440,10 +440,10 @@ struct GetAdaptersAddressesHelper | |||||
adaptersAddresses.malloc (1); | adaptersAddresses.malloc (1); | ||||
ULONG len = sizeof (IP_ADAPTER_ADDRESSES); | ULONG len = sizeof (IP_ADAPTER_ADDRESSES); | ||||
if (getAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, adaptersAddresses, &len) == ERROR_BUFFER_OVERFLOW) | |||||
if (getAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, nullptr, adaptersAddresses, &len) == ERROR_BUFFER_OVERFLOW) | |||||
adaptersAddresses.malloc (len, 1); | adaptersAddresses.malloc (len, 1); | ||||
return getAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, adaptersAddresses, &len) == NO_ERROR; | |||||
return getAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, nullptr, adaptersAddresses, &len) == NO_ERROR; | |||||
} | } | ||||
HeapBlock<IP_ADAPTER_ADDRESSES> adaptersAddresses; | HeapBlock<IP_ADAPTER_ADDRESSES> adaptersAddresses; | ||||
@@ -476,7 +476,7 @@ namespace MACAddressHelpers | |||||
DynamicLibrary dll ("netapi32.dll"); | DynamicLibrary dll ("netapi32.dll"); | ||||
JUCE_LOAD_WINAPI_FUNCTION (dll, Netbios, NetbiosCall, UCHAR, (PNCB)) | JUCE_LOAD_WINAPI_FUNCTION (dll, Netbios, NetbiosCall, UCHAR, (PNCB)) | ||||
if (NetbiosCall != 0) | |||||
if (NetbiosCall != nullptr) | |||||
{ | { | ||||
LANA_ENUM enums = {}; | LANA_ENUM enums = {}; | ||||
@@ -40,8 +40,8 @@ struct RegistryKeyWrapper | |||||
DWORD result; | DWORD result; | ||||
if (createForWriting) | if (createForWriting) | ||||
RegCreateKeyEx (rootKey, wideCharName, 0, 0, REG_OPTION_NON_VOLATILE, | |||||
KEY_WRITE | KEY_QUERY_VALUE | wow64Flags, 0, &key, &result); | |||||
RegCreateKeyEx (rootKey, wideCharName, 0, nullptr, REG_OPTION_NON_VOLATILE, | |||||
KEY_WRITE | KEY_QUERY_VALUE | wow64Flags, nullptr, &key, &result); | |||||
else | else | ||||
RegOpenKeyEx (rootKey, wideCharName, 0, KEY_READ | wow64Flags, &key); | RegOpenKeyEx (rootKey, wideCharName, 0, KEY_READ | wow64Flags, &key); | ||||
} | } | ||||
@@ -65,7 +65,7 @@ struct RegistryKeyWrapper | |||||
if (name.startsWithIgnoreCase ("HKU\\")) return HKEY_USERS; | if (name.startsWithIgnoreCase ("HKU\\")) return HKEY_USERS; | ||||
jassertfalse; // The name starts with an unknown root key (or maybe an old Win9x type) | jassertfalse; // The name starts with an unknown root key (or maybe an old Win9x type) | ||||
return 0; | |||||
return nullptr; | |||||
} | } | ||||
static bool setValue (const String& regValuePath, const DWORD type, | static bool setValue (const String& regValuePath, const DWORD type, | ||||
@@ -90,7 +90,7 @@ struct RegistryKeyWrapper | |||||
result.setSize (bufferSize, false); | result.setSize (bufferSize, false); | ||||
DWORD type = REG_NONE; | DWORD type = REG_NONE; | ||||
auto err = RegQueryValueEx (key.key, key.wideCharValueName, 0, &type, | |||||
auto err = RegQueryValueEx (key.key, key.wideCharValueName, nullptr, &type, | |||||
(LPBYTE) result.getData(), &bufferSize); | (LPBYTE) result.getData(), &bufferSize); | ||||
if (err == ERROR_SUCCESS) | if (err == ERROR_SUCCESS) | ||||
@@ -138,7 +138,7 @@ struct RegistryKeyWrapper | |||||
DWORD type = 0; | DWORD type = 0; | ||||
auto result = RegQueryValueEx (key.key, key.wideCharValueName, | auto result = RegQueryValueEx (key.key, key.wideCharValueName, | ||||
0, &type, buffer, &bufferSize); | |||||
nullptr, &type, buffer, &bufferSize); | |||||
return result == ERROR_SUCCESS || result == ERROR_MORE_DATA; | return result == ERROR_SUCCESS || result == ERROR_MORE_DATA; | ||||
} | } | ||||
@@ -44,7 +44,8 @@ void Logger::outputDebugString (const String& text) | |||||
#if JUCE_MINGW || JUCE_CLANG | #if JUCE_MINGW || JUCE_CLANG | ||||
static void callCPUID (int result[4], uint32 type) | static void callCPUID (int result[4], uint32 type) | ||||
{ | { | ||||
uint32 la = result[0], lb = result[1], lc = result[2], ld = result[3]; | |||||
uint32 la = (uint32) result[0], lb = (uint32) result[1], | |||||
lc = (uint32) result[2], ld = (uint32) result[3]; | |||||
asm ("mov %%ebx, %%esi \n\t" | asm ("mov %%ebx, %%esi \n\t" | ||||
"cpuid \n\t" | "cpuid \n\t" | ||||
@@ -55,7 +56,8 @@ static void callCPUID (int result[4], uint32 type) | |||||
#endif | #endif | ||||
); | ); | ||||
result[0] = la; result[1] = lb; result[2] = lc; result[3] = ld; | |||||
result[0] = (int) la; result[1] = (int) lb; | |||||
result[2] = (int) lc; result[3] = (int) ld; | |||||
} | } | ||||
#else | #else | ||||
static void callCPUID (int result[4], int infoType) | static void callCPUID (int result[4], int infoType) | ||||
@@ -155,17 +157,17 @@ void CPUInformation::initialise() noexcept | |||||
callCPUID (info, 7); | callCPUID (info, 7); | ||||
hasAVX2 = (info[1] & (1 << 5)) != 0; | |||||
hasAVX512F = (info[1] & (1u << 16)) != 0; | |||||
hasAVX512DQ = (info[1] & (1u << 17)) != 0; | |||||
hasAVX512IFMA = (info[1] & (1u << 21)) != 0; | |||||
hasAVX512PF = (info[1] & (1u << 26)) != 0; | |||||
hasAVX512ER = (info[1] & (1u << 27)) != 0; | |||||
hasAVX512CD = (info[1] & (1u << 28)) != 0; | |||||
hasAVX512BW = (info[1] & (1u << 30)) != 0; | |||||
hasAVX512VL = (info[1] & (1u << 31)) != 0; | |||||
hasAVX512VBMI = (info[2] & (1u << 1)) != 0; | |||||
hasAVX512VPOPCNTDQ = (info[2] & (1u << 14)) != 0; | |||||
hasAVX2 = ((unsigned int) info[1] & (1 << 5)) != 0; | |||||
hasAVX512F = ((unsigned int) info[1] & (1u << 16)) != 0; | |||||
hasAVX512DQ = ((unsigned int) info[1] & (1u << 17)) != 0; | |||||
hasAVX512IFMA = ((unsigned int) info[1] & (1u << 21)) != 0; | |||||
hasAVX512PF = ((unsigned int) info[1] & (1u << 26)) != 0; | |||||
hasAVX512ER = ((unsigned int) info[1] & (1u << 27)) != 0; | |||||
hasAVX512CD = ((unsigned int) info[1] & (1u << 28)) != 0; | |||||
hasAVX512BW = ((unsigned int) info[1] & (1u << 30)) != 0; | |||||
hasAVX512VL = ((unsigned int) info[1] & (1u << 31)) != 0; | |||||
hasAVX512VBMI = ((unsigned int) info[2] & (1u << 1)) != 0; | |||||
hasAVX512VPOPCNTDQ = ((unsigned int) info[2] & (1u << 14)) != 0; | |||||
SYSTEM_INFO systemInfo; | SYSTEM_INFO systemInfo; | ||||
GetNativeSystemInfo (&systemInfo); | GetNativeSystemInfo (&systemInfo); | ||||
@@ -274,6 +276,26 @@ String SystemStats::getOperatingSystemName() | |||||
case WinVista: name = "Windows Vista"; break; | case WinVista: name = "Windows Vista"; break; | ||||
case WinXP: name = "Windows XP"; break; | case WinXP: name = "Windows XP"; break; | ||||
case Win2000: name = "Windows 2000"; break; | case Win2000: name = "Windows 2000"; break; | ||||
case MacOSX: JUCE_FALLTHROUGH | |||||
case Windows: JUCE_FALLTHROUGH | |||||
case Linux: JUCE_FALLTHROUGH | |||||
case Android: JUCE_FALLTHROUGH | |||||
case iOS: JUCE_FALLTHROUGH | |||||
case MacOSX_10_4: JUCE_FALLTHROUGH | |||||
case MacOSX_10_5: JUCE_FALLTHROUGH | |||||
case MacOSX_10_6: JUCE_FALLTHROUGH | |||||
case MacOSX_10_7: JUCE_FALLTHROUGH | |||||
case MacOSX_10_8: JUCE_FALLTHROUGH | |||||
case MacOSX_10_9: JUCE_FALLTHROUGH | |||||
case MacOSX_10_10: JUCE_FALLTHROUGH | |||||
case MacOSX_10_11: JUCE_FALLTHROUGH | |||||
case MacOSX_10_12: JUCE_FALLTHROUGH | |||||
case MacOSX_10_13: JUCE_FALLTHROUGH | |||||
case MacOSX_10_14: JUCE_FALLTHROUGH | |||||
case UnknownOS: JUCE_FALLTHROUGH | |||||
default: jassertfalse; break; // !! new type of OS? | default: jassertfalse; break; // !! new type of OS? | ||||
} | } | ||||
@@ -23,12 +23,12 @@ | |||||
namespace juce | namespace juce | ||||
{ | { | ||||
HWND juce_messageWindowHandle = 0; // (this is used by other parts of the codebase) | |||||
HWND juce_messageWindowHandle = nullptr; // (this is used by other parts of the codebase) | |||||
void* getUser32Function (const char* functionName) | void* getUser32Function (const char* functionName) | ||||
{ | { | ||||
HMODULE module = GetModuleHandleA ("user32.dll"); | HMODULE module = GetModuleHandleA ("user32.dll"); | ||||
jassert (module != 0); | |||||
jassert (module != nullptr); | |||||
return (void*) GetProcAddress (module, functionName); | return (void*) GetProcAddress (module, functionName); | ||||
} | } | ||||
@@ -53,8 +53,8 @@ void JUCE_API juce_threadEntryPoint (void*); | |||||
static unsigned int __stdcall threadEntryProc (void* userData) | static unsigned int __stdcall threadEntryProc (void* userData) | ||||
{ | { | ||||
if (juce_messageWindowHandle != 0) | |||||
AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||||
if (juce_messageWindowHandle != nullptr) | |||||
AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, nullptr), | |||||
GetCurrentThreadId(), TRUE); | GetCurrentThreadId(), TRUE); | ||||
juce_threadEntryPoint (userData); | juce_threadEntryPoint (userData); | ||||
@@ -66,7 +66,7 @@ static unsigned int __stdcall threadEntryProc (void* userData) | |||||
void Thread::launchThread() | void Thread::launchThread() | ||||
{ | { | ||||
unsigned int newThreadId; | unsigned int newThreadId; | ||||
threadHandle = (void*) _beginthreadex (0, (unsigned int) threadStackSize, | |||||
threadHandle = (void*) _beginthreadex (nullptr, (unsigned int) threadStackSize, | |||||
&threadEntryProc, this, 0, &newThreadId); | &threadEntryProc, this, 0, &newThreadId); | ||||
threadId = (ThreadID) (pointer_sized_int) newThreadId; | threadId = (ThreadID) (pointer_sized_int) newThreadId; | ||||
} | } | ||||
@@ -74,13 +74,13 @@ void Thread::launchThread() | |||||
void Thread::closeThreadHandle() | void Thread::closeThreadHandle() | ||||
{ | { | ||||
CloseHandle ((HANDLE) threadHandle.get()); | CloseHandle ((HANDLE) threadHandle.get()); | ||||
threadId = 0; | |||||
threadHandle = 0; | |||||
threadId = nullptr; | |||||
threadHandle = nullptr; | |||||
} | } | ||||
void Thread::killThread() | void Thread::killThread() | ||||
{ | { | ||||
if (threadHandle.get() != 0) | |||||
if (threadHandle.get() != nullptr) | |||||
{ | { | ||||
#if JUCE_DEBUG | #if JUCE_DEBUG | ||||
OutputDebugStringA ("** Warning - Forced thread termination **\n"); | OutputDebugStringA ("** Warning - Forced thread termination **\n"); | ||||
@@ -132,7 +132,7 @@ bool Thread::setThreadPriority (void* handle, int priority) | |||||
else if (priority < 9) pri = THREAD_PRIORITY_ABOVE_NORMAL; | else if (priority < 9) pri = THREAD_PRIORITY_ABOVE_NORMAL; | ||||
else if (priority < 10) pri = THREAD_PRIORITY_HIGHEST; | else if (priority < 10) pri = THREAD_PRIORITY_HIGHEST; | ||||
if (handle == 0) | |||||
if (handle == nullptr) | |||||
handle = GetCurrentThread(); | handle = GetCurrentThread(); | ||||
return SetThreadPriority (handle, pri) != FALSE; | return SetThreadPriority (handle, pri) != FALSE; | ||||
@@ -158,7 +158,7 @@ struct SleepEvent | |||||
~SleepEvent() noexcept | ~SleepEvent() noexcept | ||||
{ | { | ||||
CloseHandle (handle); | CloseHandle (handle); | ||||
handle = 0; | |||||
handle = nullptr; | |||||
} | } | ||||
HANDLE handle; | HANDLE handle; | ||||
@@ -170,7 +170,7 @@ void JUCE_CALLTYPE Thread::sleep (const int millisecs) | |||||
{ | { | ||||
jassert (millisecs >= 0); | jassert (millisecs >= 0); | ||||
if (millisecs >= 10 || sleepEvent.handle == 0) | |||||
if (millisecs >= 10 || sleepEvent.handle == nullptr) | |||||
Sleep ((DWORD) millisecs); | Sleep ((DWORD) millisecs); | ||||
else | else | ||||
// unlike Sleep() this is guaranteed to return to the current thread after | // unlike Sleep() this is guaranteed to return to the current thread after | ||||
@@ -260,7 +260,7 @@ void JUCE_CALLTYPE Process::terminate() | |||||
bool juce_isRunningInWine() | bool juce_isRunningInWine() | ||||
{ | { | ||||
HMODULE ntdll = GetModuleHandleA ("ntdll"); | HMODULE ntdll = GetModuleHandleA ("ntdll"); | ||||
return ntdll != 0 && GetProcAddress (ntdll, "wine_get_version") != nullptr; | |||||
return ntdll != nullptr && GetProcAddress (ntdll, "wine_get_version") != nullptr; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -292,18 +292,18 @@ class InterProcessLock::Pimpl | |||||
{ | { | ||||
public: | public: | ||||
Pimpl (String name, const int timeOutMillisecs) | Pimpl (String name, const int timeOutMillisecs) | ||||
: handle (0), refCount (1) | |||||
: handle (nullptr), refCount (1) | |||||
{ | { | ||||
name = name.replaceCharacter ('\\', '/'); | name = name.replaceCharacter ('\\', '/'); | ||||
handle = CreateMutexW (0, TRUE, ("Global\\" + name).toWideCharPointer()); | |||||
handle = CreateMutexW (nullptr, TRUE, ("Global\\" + name).toWideCharPointer()); | |||||
// Not 100% sure why a global mutex sometimes can't be allocated, but if it fails, fall back to | // Not 100% sure why a global mutex sometimes can't be allocated, but if it fails, fall back to | ||||
// a local one. (A local one also sometimes fails on other machines so neither type appears to be | // a local one. (A local one also sometimes fails on other machines so neither type appears to be | ||||
// universally reliable) | // universally reliable) | ||||
if (handle == 0) | |||||
handle = CreateMutexW (0, TRUE, ("Local\\" + name).toWideCharPointer()); | |||||
if (handle == nullptr) | |||||
handle = CreateMutexW (nullptr, TRUE, ("Local\\" + name).toWideCharPointer()); | |||||
if (handle != 0 && GetLastError() == ERROR_ALREADY_EXISTS) | |||||
if (handle != nullptr && GetLastError() == ERROR_ALREADY_EXISTS) | |||||
{ | { | ||||
if (timeOutMillisecs == 0) | if (timeOutMillisecs == 0) | ||||
{ | { | ||||
@@ -311,7 +311,7 @@ public: | |||||
return; | return; | ||||
} | } | ||||
switch (WaitForSingleObject (handle, timeOutMillisecs < 0 ? INFINITE : timeOutMillisecs)) | |||||
switch (WaitForSingleObject (handle, timeOutMillisecs < 0 ? INFINITE : (DWORD) timeOutMillisecs)) | |||||
{ | { | ||||
case WAIT_OBJECT_0: | case WAIT_OBJECT_0: | ||||
case WAIT_ABANDONED: | case WAIT_ABANDONED: | ||||
@@ -332,11 +332,11 @@ public: | |||||
void close() | void close() | ||||
{ | { | ||||
if (handle != 0) | |||||
if (handle != nullptr) | |||||
{ | { | ||||
ReleaseMutex (handle); | ReleaseMutex (handle); | ||||
CloseHandle (handle); | CloseHandle (handle); | ||||
handle = 0; | |||||
handle = nullptr; | |||||
} | } | ||||
} | } | ||||
@@ -361,7 +361,7 @@ bool InterProcessLock::enter (const int timeOutMillisecs) | |||||
{ | { | ||||
pimpl.reset (new Pimpl (name, timeOutMillisecs)); | pimpl.reset (new Pimpl (name, timeOutMillisecs)); | ||||
if (pimpl->handle == 0) | |||||
if (pimpl->handle == nullptr) | |||||
pimpl.reset(); | pimpl.reset(); | ||||
} | } | ||||
else | else | ||||
@@ -388,7 +388,7 @@ class ChildProcess::ActiveProcess | |||||
{ | { | ||||
public: | public: | ||||
ActiveProcess (const String& command, int streamFlags) | ActiveProcess (const String& command, int streamFlags) | ||||
: ok (false), readPipe (0), writePipe (0) | |||||
: ok (false), readPipe (nullptr), writePipe (nullptr) | |||||
{ | { | ||||
SECURITY_ATTRIBUTES securityAtts = {}; | SECURITY_ATTRIBUTES securityAtts = {}; | ||||
securityAtts.nLength = sizeof (securityAtts); | securityAtts.nLength = sizeof (securityAtts); | ||||
@@ -400,8 +400,8 @@ public: | |||||
STARTUPINFOW startupInfo = {}; | STARTUPINFOW startupInfo = {}; | ||||
startupInfo.cb = sizeof (startupInfo); | startupInfo.cb = sizeof (startupInfo); | ||||
startupInfo.hStdOutput = (streamFlags & wantStdOut) != 0 ? writePipe : 0; | |||||
startupInfo.hStdError = (streamFlags & wantStdErr) != 0 ? writePipe : 0; | |||||
startupInfo.hStdOutput = (streamFlags & wantStdOut) != 0 ? writePipe : nullptr; | |||||
startupInfo.hStdError = (streamFlags & wantStdErr) != 0 ? writePipe : nullptr; | |||||
startupInfo.dwFlags = STARTF_USESTDHANDLES; | startupInfo.dwFlags = STARTF_USESTDHANDLES; | ||||
ok = CreateProcess (nullptr, const_cast<LPWSTR> (command.toWideCharPointer()), | ok = CreateProcess (nullptr, const_cast<LPWSTR> (command.toWideCharPointer()), | ||||
@@ -418,10 +418,10 @@ public: | |||||
CloseHandle (processInfo.hProcess); | CloseHandle (processInfo.hProcess); | ||||
} | } | ||||
if (readPipe != 0) | |||||
if (readPipe != nullptr) | |||||
CloseHandle (readPipe); | CloseHandle (readPipe); | ||||
if (writePipe != 0) | |||||
if (writePipe != nullptr) | |||||
CloseHandle (writePipe); | CloseHandle (writePipe); | ||||
} | } | ||||
@@ -453,12 +453,12 @@ public: | |||||
else | else | ||||
{ | { | ||||
DWORD numRead = 0; | DWORD numRead = 0; | ||||
if (! ReadFile ((HANDLE) readPipe, dest, numToDo, &numRead, nullptr)) | |||||
if (! ReadFile ((HANDLE) readPipe, dest, (DWORD) numToDo, &numRead, nullptr)) | |||||
break; | break; | ||||
total += numRead; | |||||
total += (int) numRead; | |||||
dest = addBytesToPointer (dest, numRead); | dest = addBytesToPointer (dest, numRead); | ||||
numNeeded -= numRead; | |||||
numNeeded -= (int) numRead; | |||||
} | } | ||||
} | } | ||||
@@ -539,7 +539,7 @@ struct HighResolutionTimer::Pimpl | |||||
{ | { | ||||
const int actualPeriod = jlimit ((int) tc.wPeriodMin, (int) tc.wPeriodMax, newPeriod); | const int actualPeriod = jlimit ((int) tc.wPeriodMin, (int) tc.wPeriodMax, newPeriod); | ||||
timerID = timeSetEvent (actualPeriod, tc.wPeriodMin, callbackFunction, (DWORD_PTR) this, | |||||
timerID = timeSetEvent ((UINT) actualPeriod, tc.wPeriodMin, callbackFunction, (DWORD_PTR) this, | |||||
TIME_PERIODIC | TIME_CALLBACK_FUNCTION | 0x100 /*TIME_KILL_SYNCHRONOUS*/); | TIME_PERIODIC | TIME_CALLBACK_FUNCTION | 0x100 /*TIME_KILL_SYNCHRONOUS*/); | ||||
} | } | ||||
} | } | ||||
@@ -94,7 +94,7 @@ namespace SocketHelpers | |||||
static void closeSocket (std::atomic<int>& handle, CriticalSection& readLock, | static void closeSocket (std::atomic<int>& handle, CriticalSection& readLock, | ||||
bool isListener, int portNumber, std::atomic<bool>& connected) noexcept | bool isListener, int portNumber, std::atomic<bool>& connected) noexcept | ||||
{ | { | ||||
const SocketHandle h = handle.load(); | |||||
const auto h = (SocketHandle) handle.load(); | |||||
handle = -1; | handle = -1; | ||||
#if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
@@ -187,7 +187,7 @@ namespace SocketHelpers | |||||
{ | { | ||||
#if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
u_long nonBlocking = shouldBlock ? 0 : (u_long) 1; | u_long nonBlocking = shouldBlock ? 0 : (u_long) 1; | ||||
return ioctlsocket (handle, FIONBIO, &nonBlocking) == 0; | |||||
return ioctlsocket (handle, (long) FIONBIO, &nonBlocking) == 0; | |||||
#else | #else | ||||
int socketFlags = fcntl (handle, F_GETFL, 0); | int socketFlags = fcntl (handle, F_GETFL, 0); | ||||
@@ -282,9 +282,9 @@ namespace SocketHelpers | |||||
auto hasErrorOccurred = [&handle] () -> bool | auto hasErrorOccurred = [&handle] () -> bool | ||||
{ | { | ||||
auto h = handle.load(); | |||||
auto h = (SocketHandle) handle.load(); | |||||
if (static_cast<SocketHandle> (h) == invalidSocket) | |||||
if (h == invalidSocket) | |||||
return true; | return true; | ||||
int opt; | int opt; | ||||
@@ -315,9 +315,9 @@ namespace SocketHelpers | |||||
fd_set rset, wset; | fd_set rset, wset; | ||||
FD_ZERO (&rset); | FD_ZERO (&rset); | ||||
FD_SET (static_cast<SocketHandle> (h), &rset); | |||||
FD_SET ((SOCKET) h, &rset); | |||||
FD_ZERO (&wset); | FD_ZERO (&wset); | ||||
FD_SET (static_cast<SocketHandle> (h), &wset); | |||||
FD_SET ((SOCKET) h, &wset); | |||||
fd_set* prset = forReading ? &rset : nullptr; | fd_set* prset = forReading ? &rset : nullptr; | ||||
fd_set* pwset = forReading ? nullptr : &wset; | fd_set* pwset = forReading ? nullptr : &wset; | ||||
@@ -418,8 +418,9 @@ namespace SocketHelpers | |||||
if (success) | if (success) | ||||
{ | { | ||||
setSocketBlockingState (handle, true); | |||||
resetSocketOptions (handle, false, false); | |||||
auto h = (SocketHandle) handle.load(); | |||||
setSocketBlockingState (h, true); | |||||
resetSocketOptions (h, false, false); | |||||
} | } | ||||
} | } | ||||
@@ -428,7 +429,7 @@ namespace SocketHelpers | |||||
static void makeReusable (int handle) noexcept | static void makeReusable (int handle) noexcept | ||||
{ | { | ||||
setOption (handle, SO_REUSEADDR, (int) 1); | |||||
setOption ((SocketHandle) handle, SO_REUSEADDR, (int) 1); | |||||
} | } | ||||
static bool multicast (int handle, const String& multicastIPAddress, | static bool multicast (int handle, const String& multicastIPAddress, | ||||
@@ -443,7 +444,7 @@ namespace SocketHelpers | |||||
if (interfaceIPAddress.isNotEmpty()) | if (interfaceIPAddress.isNotEmpty()) | ||||
mreq.imr_interface.s_addr = inet_addr (interfaceIPAddress.toRawUTF8()); | mreq.imr_interface.s_addr = inet_addr (interfaceIPAddress.toRawUTF8()); | ||||
return setsockopt (handle, IPPROTO_IP, | |||||
return setsockopt ((SocketHandle) handle, IPPROTO_IP, | |||||
join ? IP_ADD_MEMBERSHIP | join ? IP_ADD_MEMBERSHIP | ||||
: IP_DROP_MEMBERSHIP, | : IP_DROP_MEMBERSHIP, | ||||
(const char*) &mreq, sizeof (mreq)) == 0; | (const char*) &mreq, sizeof (mreq)) == 0; | ||||
@@ -465,7 +466,7 @@ StreamingSocket::StreamingSocket (const String& host, int portNum, int h) | |||||
jassert (SocketHelpers::isValidPortNumber (portNum)); | jassert (SocketHelpers::isValidPortNumber (portNum)); | ||||
SocketHelpers::initSockets(); | SocketHelpers::initSockets(); | ||||
SocketHelpers::resetSocketOptions (h, false, false); | |||||
SocketHelpers::resetSocketOptions ((SocketHandle) h, false, false); | |||||
} | } | ||||
StreamingSocket::~StreamingSocket() | StreamingSocket::~StreamingSocket() | ||||
@@ -476,7 +477,7 @@ StreamingSocket::~StreamingSocket() | |||||
//============================================================================== | //============================================================================== | ||||
int StreamingSocket::read (void* destBuffer, int maxBytesToRead, bool shouldBlock) | int StreamingSocket::read (void* destBuffer, int maxBytesToRead, bool shouldBlock) | ||||
{ | { | ||||
return (connected && ! isListener) ? SocketHelpers::readSocket (handle, destBuffer, maxBytesToRead, | |||||
return (connected && ! isListener) ? SocketHelpers::readSocket ((SocketHandle) handle.load(), destBuffer,maxBytesToRead, | |||||
connected, shouldBlock, readLock) | connected, shouldBlock, readLock) | ||||
: -1; | : -1; | ||||
} | } | ||||
@@ -486,7 +487,7 @@ int StreamingSocket::write (const void* sourceBuffer, int numBytesToWrite) | |||||
if (isListener || ! connected) | if (isListener || ! connected) | ||||
return -1; | return -1; | ||||
return (int) ::send (handle, (const char*) sourceBuffer, (juce_recvsend_size_t) numBytesToWrite, 0); | |||||
return (int) ::send ((SocketHandle) handle.load(), (const char*) sourceBuffer, (juce_recvsend_size_t) numBytesToWrite, 0); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -506,12 +507,12 @@ bool StreamingSocket::bindToPort (int port, const String& addr) | |||||
{ | { | ||||
jassert (SocketHelpers::isValidPortNumber (port)); | jassert (SocketHelpers::isValidPortNumber (port)); | ||||
return SocketHelpers::bindSocket (handle, port, addr); | |||||
return SocketHelpers::bindSocket ((SocketHandle) handle.load(), port, addr); | |||||
} | } | ||||
int StreamingSocket::getBoundPort() const noexcept | int StreamingSocket::getBoundPort() const noexcept | ||||
{ | { | ||||
return SocketHelpers::getBoundPort (handle); | |||||
return SocketHelpers::getBoundPort ((SocketHandle) handle.load()); | |||||
} | } | ||||
bool StreamingSocket::connect (const String& remoteHostName, int remotePortNumber, int timeOutMillisecs) | bool StreamingSocket::connect (const String& remoteHostName, int remotePortNumber, int timeOutMillisecs) | ||||
@@ -538,7 +539,7 @@ bool StreamingSocket::connect (const String& remoteHostName, int remotePortNumbe | |||||
if (! connected) | if (! connected) | ||||
return false; | return false; | ||||
if (! SocketHelpers::resetSocketOptions (handle, false, false)) | |||||
if (! SocketHelpers::resetSocketOptions ((SocketHandle) handle.load(), false, false)) | |||||
{ | { | ||||
close(); | close(); | ||||
return false; | return false; | ||||
@@ -579,8 +580,8 @@ bool StreamingSocket::createListener (int newPortNumber, const String& localHost | |||||
SocketHelpers::makeReusable (handle); | SocketHelpers::makeReusable (handle); | ||||
#endif | #endif | ||||
if (SocketHelpers::bindSocket (handle, portNumber, localHostName) | |||||
&& listen (handle, SOMAXCONN) >= 0) | |||||
if (SocketHelpers::bindSocket ((SocketHandle) handle.load(), portNumber, localHostName) | |||||
&& listen ((SocketHandle) handle.load(), SOMAXCONN) >= 0) | |||||
{ | { | ||||
connected = true; | connected = true; | ||||
return true; | return true; | ||||
@@ -600,7 +601,7 @@ StreamingSocket* StreamingSocket::waitForNextConnection() const | |||||
{ | { | ||||
struct sockaddr_storage address; | struct sockaddr_storage address; | ||||
juce_socklen_t len = sizeof (address); | juce_socklen_t len = sizeof (address); | ||||
auto newSocket = (int) accept (handle, (struct sockaddr*) &address, &len); | |||||
auto newSocket = (int) accept ((SocketHandle) handle.load(), (struct sockaddr*) &address, &len); | |||||
if (newSocket >= 0 && connected) | if (newSocket >= 0 && connected) | ||||
return new StreamingSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr), | return new StreamingSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr), | ||||
@@ -615,7 +616,7 @@ bool StreamingSocket::isLocal() const noexcept | |||||
if (! isConnected()) | if (! isConnected()) | ||||
return false; | return false; | ||||
IPAddress currentIP (SocketHelpers::getConnectedAddress (handle)); | |||||
IPAddress currentIP (SocketHelpers::getConnectedAddress ((SocketHandle) handle.load())); | |||||
for (auto& a : IPAddress::getAllAddresses()) | for (auto& a : IPAddress::getAllAddresses()) | ||||
if (a == currentIP) | if (a == currentIP) | ||||
@@ -635,7 +636,7 @@ DatagramSocket::DatagramSocket (bool canBroadcast) | |||||
if (handle >= 0) | if (handle >= 0) | ||||
{ | { | ||||
SocketHelpers::resetSocketOptions (handle, true, canBroadcast); | |||||
SocketHelpers::resetSocketOptions ((SocketHandle) handle.load(), true, canBroadcast); | |||||
SocketHelpers::makeReusable (handle); | SocketHelpers::makeReusable (handle); | ||||
} | } | ||||
} | } | ||||
@@ -674,7 +675,7 @@ bool DatagramSocket::bindToPort (int port, const String& addr) | |||||
if (handle < 0) | if (handle < 0) | ||||
return false; | return false; | ||||
if (SocketHelpers::bindSocket (handle, port, addr)) | |||||
if (SocketHelpers::bindSocket ((SocketHandle) handle.load(), port, addr)) | |||||
{ | { | ||||
isBound = true; | isBound = true; | ||||
lastBindAddress = addr; | lastBindAddress = addr; | ||||
@@ -686,7 +687,7 @@ bool DatagramSocket::bindToPort (int port, const String& addr) | |||||
int DatagramSocket::getBoundPort() const noexcept | int DatagramSocket::getBoundPort() const noexcept | ||||
{ | { | ||||
return (handle >= 0 && isBound) ? SocketHelpers::getBoundPort (handle) : -1; | |||||
return (handle >= 0 && isBound) ? SocketHelpers::getBoundPort ((SocketHandle) handle.load()) : -1; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -704,7 +705,7 @@ int DatagramSocket::read (void* destBuffer, int maxBytesToRead, bool shouldBlock | |||||
return -1; | return -1; | ||||
std::atomic<bool> connected { true }; | std::atomic<bool> connected { true }; | ||||
return SocketHelpers::readSocket (handle, destBuffer, maxBytesToRead, | |||||
return SocketHelpers::readSocket ((SocketHandle) handle.load(), destBuffer, maxBytesToRead, | |||||
connected, shouldBlock, readLock); | connected, shouldBlock, readLock); | ||||
} | } | ||||
@@ -714,7 +715,7 @@ int DatagramSocket::read (void* destBuffer, int maxBytesToRead, bool shouldBlock | |||||
return -1; | return -1; | ||||
std::atomic<bool> connected { true }; | std::atomic<bool> connected { true }; | ||||
return SocketHelpers::readSocket (handle, destBuffer, maxBytesToRead, connected, | |||||
return SocketHelpers::readSocket ((SocketHandle) handle.load(), destBuffer, maxBytesToRead, connected, | |||||
shouldBlock, readLock, &senderIPAddress, &senderPort); | shouldBlock, readLock, &senderIPAddress, &senderPort); | ||||
} | } | ||||
@@ -741,7 +742,7 @@ int DatagramSocket::write (const String& remoteHostname, int remotePortNumber, | |||||
lastServerPort = remotePortNumber; | lastServerPort = remotePortNumber; | ||||
} | } | ||||
return (int) ::sendto (handle, (const char*) sourceBuffer, | |||||
return (int) ::sendto ((SocketHandle) handle.load(), (const char*) sourceBuffer, | |||||
(juce_recvsend_size_t) numBytesToWrite, 0, | (juce_recvsend_size_t) numBytesToWrite, 0, | ||||
info->ai_addr, (socklen_t) info->ai_addrlen); | info->ai_addr, (socklen_t) info->ai_addrlen); | ||||
} | } | ||||
@@ -767,7 +768,7 @@ bool DatagramSocket::setMulticastLoopbackEnabled (bool enable) | |||||
if (handle < 0 || ! isBound) | if (handle < 0 || ! isBound) | ||||
return false; | return false; | ||||
return SocketHelpers::setOption<bool> (handle, IPPROTO_IP, IP_MULTICAST_LOOP, enable); | |||||
return SocketHelpers::setOption<bool> ((SocketHandle) handle.load(), IPPROTO_IP, IP_MULTICAST_LOOP, enable); | |||||
} | } | ||||
bool DatagramSocket::setEnablePortReuse (bool enabled) | bool DatagramSocket::setEnablePortReuse (bool enabled) | ||||
@@ -776,7 +777,7 @@ bool DatagramSocket::setEnablePortReuse (bool enabled) | |||||
ignoreUnused (enabled); | ignoreUnused (enabled); | ||||
#else | #else | ||||
if (handle >= 0) | if (handle >= 0) | ||||
return SocketHelpers::setOption (handle, | |||||
return SocketHelpers::setOption ((SocketHandle) handle.load(), | |||||
#if JUCE_WINDOWS || JUCE_LINUX | #if JUCE_WINDOWS || JUCE_LINUX | ||||
SO_REUSEADDR, // port re-use is implied by addr re-use on these platforms | SO_REUSEADDR, // port re-use is implied by addr re-use on these platforms | ||||
#else | #else | ||||
@@ -1837,6 +1837,10 @@ String String::formattedRaw (const char* pf, ...) | |||||
va_list args; | va_list args; | ||||
va_start (args, pf); | va_start (args, pf); | ||||
#if JUCE_WINDOWS | |||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") | |||||
#endif | |||||
#if JUCE_ANDROID | #if JUCE_ANDROID | ||||
HeapBlock<char> temp (bufferSize); | HeapBlock<char> temp (bufferSize); | ||||
int num = (int) vsnprintf (temp.get(), bufferSize - 1, pf, args); | int num = (int) vsnprintf (temp.get(), bufferSize - 1, pf, args); | ||||
@@ -1847,17 +1851,16 @@ String String::formattedRaw (const char* pf, ...) | |||||
HeapBlock<wchar_t> temp (bufferSize); | HeapBlock<wchar_t> temp (bufferSize); | ||||
const int num = (int) | const int num = (int) | ||||
#if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") | |||||
_vsnwprintf | _vsnwprintf | ||||
#else | #else | ||||
vswprintf | vswprintf | ||||
#endif | #endif | ||||
(temp.get(), bufferSize - 1, wideCharVersion.toWideCharPointer(), args); | (temp.get(), bufferSize - 1, wideCharVersion.toWideCharPointer(), args); | ||||
#endif | |||||
#if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE | |||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE | |||||
#endif | #endif | ||||
#endif | |||||
va_end (args); | va_end (args); | ||||
if (num > 0) | if (num > 0) | ||||
@@ -1894,7 +1897,7 @@ int String::getTrailingIntValue() const noexcept | |||||
break; | break; | ||||
} | } | ||||
n += static_cast<juce_wchar> (mult) * (*t - '0'); | |||||
n += (int) (((juce_wchar) mult) * (*t - '0')); | |||||
mult *= 10; | mult *= 10; | ||||
} | } | ||||
@@ -45,14 +45,15 @@ public: | |||||
jassert (atom != 0); | jassert (atom != 0); | ||||
hwnd = CreateWindow (getClassNameFromAtom(), messageWindowName, | hwnd = CreateWindow (getClassNameFromAtom(), messageWindowName, | ||||
0, 0, 0, 0, 0, 0, 0, moduleHandle, 0); | |||||
jassert (hwnd != 0); | |||||
0, 0, 0, 0, 0, | |||||
nullptr, nullptr, moduleHandle, nullptr); | |||||
jassert (hwnd != nullptr); | |||||
} | } | ||||
~HiddenMessageWindow() | ~HiddenMessageWindow() | ||||
{ | { | ||||
DestroyWindow (hwnd); | DestroyWindow (hwnd); | ||||
UnregisterClass (getClassNameFromAtom(), 0); | |||||
UnregisterClass (getClassNameFromAtom(), nullptr); | |||||
} | } | ||||
inline HWND getHWND() const noexcept { return hwnd; } | inline HWND getHWND() const noexcept { return hwnd; } | ||||
@@ -51,7 +51,7 @@ public: | |||||
~InternalMessageQueue() | ~InternalMessageQueue() | ||||
{ | { | ||||
juce_messageWindowHandle = 0; | |||||
juce_messageWindowHandle = nullptr; | |||||
clearSingletonInstance(); | clearSingletonInstance(); | ||||
} | } | ||||
@@ -69,7 +69,7 @@ public: | |||||
{ | { | ||||
COPYDATASTRUCT data; | COPYDATASTRUCT data; | ||||
data.dwData = broadcastMessageMagicNumber; | data.dwData = broadcastMessageMagicNumber; | ||||
data.cbData = (localCopy.length() + 1) * sizeof (CharPointer_UTF32::CharType); | |||||
data.cbData = ((size_t) localCopy.length() + 1) * sizeof (CharPointer_UTF32::CharType); | |||||
data.lpData = (void*) localCopy.toUTF32().getAddress(); | data.lpData = (void*) localCopy.toUTF32().getAddress(); | ||||
DWORD_PTR result; | DWORD_PTR result; | ||||
@@ -109,10 +109,10 @@ public: | |||||
{ | { | ||||
MSG m; | MSG m; | ||||
if (returnIfNoPendingMessages && ! PeekMessage (&m, (HWND) 0, 0, 0, PM_NOREMOVE)) | |||||
if (returnIfNoPendingMessages && ! PeekMessage (&m, nullptr, 0, 0, PM_NOREMOVE)) | |||||
return false; | return false; | ||||
if (GetMessage (&m, (HWND) 0, 0, 0) >= 0) | |||||
if (GetMessage (&m, nullptr, 0, 0) >= 0) | |||||
{ | { | ||||
#if JUCE_MODULE_AVAILABLE_juce_gui_extra | #if JUCE_MODULE_AVAILABLE_juce_gui_extra | ||||
if (juce_offerEventToActiveXControl (m) != S_FALSE) | if (juce_offerEventToActiveXControl (m) != S_FALSE) | ||||
@@ -137,7 +137,7 @@ public: | |||||
// currently on a juce window, pass the kb focus over.. | // currently on a juce window, pass the kb focus over.. | ||||
auto currentFocus = GetFocus(); | auto currentFocus = GetFocus(); | ||||
if (currentFocus == 0 || JuceWindowIdentifier::isJUCEWindow (currentFocus)) | |||||
if (currentFocus == nullptr || JuceWindowIdentifier::isJUCEWindow (currentFocus)) | |||||
SetFocus (m.hwnd); | SetFocus (m.hwnd); | ||||
} | } | ||||
@@ -288,7 +288,7 @@ void MessageManager::broadcastMessage (const String& value) | |||||
//============================================================================== | //============================================================================== | ||||
void MessageManager::doPlatformSpecificInitialisation() | void MessageManager::doPlatformSpecificInitialisation() | ||||
{ | { | ||||
OleInitialize (0); | |||||
OleInitialize (nullptr); | |||||
InternalMessageQueue::getInstance(); | InternalMessageQueue::getInstance(); | ||||
} | } | ||||
@@ -157,7 +157,7 @@ namespace FontEnumerators | |||||
const String fontName (lpelfe->elfLogFont.lfFaceName); | const String fontName (lpelfe->elfLogFont.lfFaceName); | ||||
fontName.copyToUTF16 (lf.lfFaceName, sizeof (lf.lfFaceName)); | fontName.copyToUTF16 (lf.lfFaceName, sizeof (lf.lfFaceName)); | ||||
auto dc = CreateCompatibleDC (0); | |||||
auto dc = CreateCompatibleDC (nullptr); | |||||
EnumFontFamiliesEx (dc, &lf, (FONTENUMPROCW) &fontEnum2, lParam, 0); | EnumFontFamiliesEx (dc, &lf, (FONTENUMPROCW) &fontEnum2, lParam, 0); | ||||
DeleteDC (dc); | DeleteDC (dc); | ||||
} | } | ||||
@@ -190,7 +190,7 @@ StringArray Font::findAllTypefaceNames() | |||||
else | else | ||||
#endif | #endif | ||||
{ | { | ||||
auto dc = CreateCompatibleDC (0); | |||||
auto dc = CreateCompatibleDC (nullptr); | |||||
{ | { | ||||
LOGFONTW lf = {}; | LOGFONTW lf = {}; | ||||
@@ -332,10 +332,10 @@ public: | |||||
SelectObject (dc, previousFontH); // Replacing the previous font before deleting the DC avoids a warning in BoundsChecker | SelectObject (dc, previousFontH); // Replacing the previous font before deleting the DC avoids a warning in BoundsChecker | ||||
DeleteDC (dc); | DeleteDC (dc); | ||||
if (fontH != 0) | |||||
if (fontH != nullptr) | |||||
DeleteObject (fontH); | DeleteObject (fontH); | ||||
if (memoryFont != 0) | |||||
if (memoryFont != nullptr) | |||||
RemoveFontMemResourceEx (memoryFont); | RemoveFontMemResourceEx (memoryFont); | ||||
} | } | ||||
@@ -392,13 +392,13 @@ public: | |||||
GLYPHMETRICS gm; | GLYPHMETRICS gm; | ||||
// (although GetGlyphOutline returns a DWORD, it may be -1 on failure, so treat it as signed int..) | // (although GetGlyphOutline returns a DWORD, it may be -1 on failure, so treat it as signed int..) | ||||
auto bufSize = (int) GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, | auto bufSize = (int) GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, | ||||
&gm, 0, 0, &identityMatrix); | |||||
&gm, 0, nullptr, &identityMatrix); | |||||
if (bufSize > 0) | if (bufSize > 0) | ||||
{ | { | ||||
HeapBlock<char> data (bufSize); | HeapBlock<char> data (bufSize); | ||||
GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, | GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, | ||||
bufSize, data, &identityMatrix); | |||||
(DWORD) bufSize, data, &identityMatrix); | |||||
auto pheader = reinterpret_cast<const TTPOLYGONHEADER*> (data.getData()); | auto pheader = reinterpret_cast<const TTPOLYGONHEADER*> (data.getData()); | ||||
@@ -456,7 +456,7 @@ private: | |||||
static const MAT2 identityMatrix; | static const MAT2 identityMatrix; | ||||
HFONT fontH = {}; | HFONT fontH = {}; | ||||
HGDIOBJ previousFontH = {}; | HGDIOBJ previousFontH = {}; | ||||
HDC dc { CreateCompatibleDC (0) }; | |||||
HDC dc { CreateCompatibleDC (nullptr) }; | |||||
TEXTMETRIC tm; | TEXTMETRIC tm; | ||||
HANDLE memoryFont = {}; | HANDLE memoryFont = {}; | ||||
float ascent = 1.0f, heightToPointsFactor = 1.0f; | float ascent = 1.0f, heightToPointsFactor = 1.0f; | ||||
@@ -486,17 +486,17 @@ private: | |||||
auto standardSizedFont = CreateFontIndirect (&lf); | auto standardSizedFont = CreateFontIndirect (&lf); | ||||
if (standardSizedFont != 0) | |||||
if (standardSizedFont != nullptr) | |||||
{ | { | ||||
if ((previousFontH = SelectObject (dc, standardSizedFont)) != 0) | |||||
if ((previousFontH = SelectObject (dc, standardSizedFont)) != nullptr) | |||||
{ | { | ||||
fontH = standardSizedFont; | fontH = standardSizedFont; | ||||
OUTLINETEXTMETRIC otm; | OUTLINETEXTMETRIC otm; | ||||
if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0) | if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0) | ||||
{ | { | ||||
heightInPoints = otm.otmEMSquare; | |||||
lf.lfHeight = -(int) heightInPoints; | |||||
heightInPoints = (int) otm.otmEMSquare; | |||||
lf.lfHeight = -heightInPoints; | |||||
fontH = CreateFontIndirect (&lf); | fontH = CreateFontIndirect (&lf); | ||||
SelectObject (dc, fontH); | SelectObject (dc, fontH); | ||||
@@ -519,7 +519,7 @@ private: | |||||
void createKerningPairs (HDC hdc, std::unordered_map<int, int>& glyphsForChars, float height) | void createKerningPairs (HDC hdc, std::unordered_map<int, int>& glyphsForChars, float height) | ||||
{ | { | ||||
HeapBlock<KERNINGPAIR> rawKerning; | HeapBlock<KERNINGPAIR> rawKerning; | ||||
auto numKPs = GetKerningPairs (hdc, 0, 0); | |||||
auto numKPs = GetKerningPairs (hdc, 0, nullptr); | |||||
rawKerning.calloc (numKPs); | rawKerning.calloc (numKPs); | ||||
GetKerningPairs (hdc, numKPs, rawKerning); | GetKerningPairs (hdc, numKPs, rawKerning); | ||||
@@ -570,7 +570,7 @@ private: | |||||
{ | { | ||||
GLYPHMETRICS gm; | GLYPHMETRICS gm; | ||||
gm.gmCellIncX = 0; | gm.gmCellIncX = 0; | ||||
GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, 0, 0, &identityMatrix); | |||||
GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, 0, nullptr, &identityMatrix); | |||||
return gm.gmCellIncX; | return gm.gmCellIncX; | ||||
} | } | ||||
@@ -50,7 +50,7 @@ namespace DragAndDropHelpers | |||||
JUCE_COMRESULT Clone (IEnumFORMATETC** result) override | JUCE_COMRESULT Clone (IEnumFORMATETC** result) override | ||||
{ | { | ||||
if (result == 0) | |||||
if (result == nullptr) | |||||
return E_POINTER; | return E_POINTER; | ||||
auto newOne = new JuceEnumFormatEtc (format); | auto newOne = new JuceEnumFormatEtc (format); | ||||
@@ -66,7 +66,7 @@ namespace DragAndDropHelpers | |||||
else if (celt != 1) | else if (celt != 1) | ||||
return S_FALSE; | return S_FALSE; | ||||
if (index == 0 && celt > 0 && lpFormatEtc != 0) | |||||
if (index == 0 && celt > 0 && lpFormatEtc != nullptr) | |||||
{ | { | ||||
copyFormatEtc (lpFormatEtc [0], *format); | copyFormatEtc (lpFormatEtc [0], *format); | ||||
++index; | ++index; | ||||
@@ -85,7 +85,7 @@ namespace DragAndDropHelpers | |||||
if (index + (int) celt >= 1) | if (index + (int) celt >= 1) | ||||
return S_FALSE; | return S_FALSE; | ||||
index += celt; | |||||
index += (int) celt; | |||||
return S_OK; | return S_OK; | ||||
} | } | ||||
@@ -103,7 +103,7 @@ namespace DragAndDropHelpers | |||||
{ | { | ||||
dest = source; | dest = source; | ||||
if (source.ptd != 0) | |||||
if (source.ptd != nullptr) | |||||
{ | { | ||||
dest.ptd = (DVTARGETDEVICE*) CoTaskMemAlloc (sizeof (DVTARGETDEVICE)); | dest.ptd = (DVTARGETDEVICE*) CoTaskMemAlloc (sizeof (DVTARGETDEVICE)); | ||||
*(dest.ptd) = *(source.ptd); | *(dest.ptd) = *(source.ptd); | ||||
@@ -134,7 +134,7 @@ namespace DragAndDropHelpers | |||||
&& pFormatEtc->dwAspect == format->dwAspect) | && pFormatEtc->dwAspect == format->dwAspect) | ||||
{ | { | ||||
pMedium->tymed = format->tymed; | pMedium->tymed = format->tymed; | ||||
pMedium->pUnkForRelease = 0; | |||||
pMedium->pUnkForRelease = nullptr; | |||||
if (format->tymed == TYMED_HGLOBAL) | if (format->tymed == TYMED_HGLOBAL) | ||||
{ | { | ||||
@@ -156,7 +156,7 @@ namespace DragAndDropHelpers | |||||
JUCE_COMRESULT QueryGetData (FORMATETC* f) | JUCE_COMRESULT QueryGetData (FORMATETC* f) | ||||
{ | { | ||||
if (f == 0) | |||||
if (f == nullptr) | |||||
return E_INVALIDARG; | return E_INVALIDARG; | ||||
if (f->tymed == format->tymed | if (f->tymed == format->tymed | ||||
@@ -169,13 +169,13 @@ namespace DragAndDropHelpers | |||||
JUCE_COMRESULT GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut) | JUCE_COMRESULT GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut) | ||||
{ | { | ||||
pFormatEtcOut->ptd = 0; | |||||
pFormatEtcOut->ptd = nullptr; | |||||
return E_NOTIMPL; | return E_NOTIMPL; | ||||
} | } | ||||
JUCE_COMRESULT EnumFormatEtc (DWORD direction, IEnumFORMATETC** result) | JUCE_COMRESULT EnumFormatEtc (DWORD direction, IEnumFORMATETC** result) | ||||
{ | { | ||||
if (result == 0) | |||||
if (result == nullptr) | |||||
return E_POINTER; | return E_POINTER; | ||||
if (direction == DATADIR_GET) | if (direction == DATADIR_GET) | ||||
@@ -184,7 +184,7 @@ namespace DragAndDropHelpers | |||||
return S_OK; | return S_OK; | ||||
} | } | ||||
*result = 0; | |||||
*result = nullptr; | |||||
return E_NOTIMPL; | return E_NOTIMPL; | ||||
} | } | ||||
@@ -204,13 +204,13 @@ namespace DragAndDropHelpers | |||||
//============================================================================== | //============================================================================== | ||||
HDROP createHDrop (const StringArray& fileNames) | HDROP createHDrop (const StringArray& fileNames) | ||||
{ | { | ||||
int totalBytes = 0; | |||||
size_t totalBytes = 0; | |||||
for (int i = fileNames.size(); --i >= 0;) | for (int i = fileNames.size(); --i >= 0;) | ||||
totalBytes += (int) CharPointer_UTF16::getBytesRequiredFor (fileNames[i].getCharPointer()) + sizeof (WCHAR); | |||||
totalBytes += CharPointer_UTF16::getBytesRequiredFor (fileNames[i].getCharPointer()) + sizeof (WCHAR); | |||||
HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (DROPFILES) + totalBytes + 4); | HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (DROPFILES) + totalBytes + 4); | ||||
if (hDrop != 0) | |||||
if (hDrop != nullptr) | |||||
{ | { | ||||
auto pDropFiles = (LPDROPFILES) GlobalLock (hDrop); | auto pDropFiles = (LPDROPFILES) GlobalLock (hDrop); | ||||
pDropFiles->pFiles = sizeof (DROPFILES); | pDropFiles->pFiles = sizeof (DROPFILES); | ||||
@@ -243,7 +243,7 @@ namespace DragAndDropHelpers | |||||
JobStatus runJob() override | JobStatus runJob() override | ||||
{ | { | ||||
OleInitialize (0); | |||||
OleInitialize (nullptr); | |||||
auto source = new JuceDropSource(); | auto source = new JuceDropSource(); | ||||
auto data = new JuceDataObject (&format, &medium); | auto data = new JuceDataObject (&format, &medium); | ||||
@@ -300,8 +300,8 @@ bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& fi | |||||
if (files.isEmpty()) | if (files.isEmpty()) | ||||
return false; | return false; | ||||
FORMATETC format = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM medium = { TYMED_HGLOBAL, { 0 }, 0 }; | |||||
FORMATETC format = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM medium = { TYMED_HGLOBAL, { nullptr }, nullptr }; | |||||
medium.hGlobal = DragAndDropHelpers::createHDrop (files); | medium.hGlobal = DragAndDropHelpers::createHDrop (files); | ||||
@@ -319,8 +319,8 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text, Co | |||||
if (text.isEmpty()) | if (text.isEmpty()) | ||||
return false; | return false; | ||||
FORMATETC format = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM medium = { TYMED_HGLOBAL, { 0 }, 0 }; | |||||
FORMATETC format = { CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM medium = { TYMED_HGLOBAL, { nullptr }, nullptr }; | |||||
auto numBytes = CharPointer_UTF16::getBytesRequiredFor (text.getCharPointer()); | auto numBytes = CharPointer_UTF16::getBytesRequiredFor (text.getCharPointer()); | ||||
@@ -363,7 +363,7 @@ private: | |||||
auto scale = Desktop::getInstance().getDisplays().findDisplayForRect (screenRectangle, true).scale; | auto scale = Desktop::getInstance().getDisplays().findDisplayForRect (screenRectangle, true).scale; | ||||
auto physicalComponentWidth = roundToInt (safeCustomComponent->getWidth() * scale); | auto physicalComponentWidth = roundToInt (safeCustomComponent->getWidth() * scale); | ||||
SetWindowPos (hdlg, 0, screenRectangle.getX(), screenRectangle.getY(), | |||||
SetWindowPos (hdlg, nullptr, screenRectangle.getX(), screenRectangle.getY(), | |||||
physicalComponentWidth + jmax (150, screenRectangle.getWidth()), | physicalComponentWidth + jmax (150, screenRectangle.getWidth()), | ||||
jmax (150, screenRectangle.getHeight()), | jmax (150, screenRectangle.getHeight()), | ||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); | ||||
@@ -494,7 +494,7 @@ private: | |||||
HWND dialogH = GetParent (hwnd); | HWND dialogH = GetParent (hwnd); | ||||
if (dialogH == 0) | |||||
if (dialogH == nullptr) | |||||
dialogH = hwnd; | dialogH = hwnd; | ||||
return dialogH; | return dialogH; | ||||
@@ -27,6 +27,8 @@ | |||||
namespace juce | namespace juce | ||||
{ | { | ||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wcast-function-type") | |||||
#undef GetSystemMetrics // multimon overrides this for some reason and causes a mess.. | #undef GetSystemMetrics // multimon overrides this for some reason and causes a mess.. | ||||
// these are in the windows SDK, but need to be repeated here for GCC.. | // these are in the windows SDK, but need to be repeated here for GCC.. | ||||
@@ -44,16 +46,15 @@ namespace juce | |||||
#define WM_APPCOMMAND 0x0319 | #define WM_APPCOMMAND 0x0319 | ||||
#endif | #endif | ||||
extern void juce_repeatLastProcessPriority(); | |||||
extern void juce_checkCurrentlyFocusedTopLevelWindow(); // in juce_TopLevelWindow.cpp | |||||
extern bool juce_isRunningInWine(); | |||||
void juce_repeatLastProcessPriority(); | |||||
bool juce_isRunningInWine(); | |||||
using CheckEventBlockedByModalComps = bool (*) (const MSG&); | using CheckEventBlockedByModalComps = bool (*) (const MSG&); | ||||
extern CheckEventBlockedByModalComps isEventBlockedByModalComps; | extern CheckEventBlockedByModalComps isEventBlockedByModalComps; | ||||
static bool shouldDeactivateTitleBar = true; | static bool shouldDeactivateTitleBar = true; | ||||
extern void* getUser32Function (const char*); | |||||
void* getUser32Function (const char*); | |||||
//============================================================================== | //============================================================================== | ||||
#ifndef WM_TOUCH | #ifndef WM_TOUCH | ||||
@@ -356,7 +357,7 @@ static void setDPIAwareness() | |||||
HMODULE shcoreModule = GetModuleHandleA ("SHCore.dll"); | HMODULE shcoreModule = GetModuleHandleA ("SHCore.dll"); | ||||
if (shcoreModule != 0) | |||||
if (shcoreModule != nullptr) | |||||
{ | { | ||||
getDPIForMonitor = (GetDPIForMonitorFunc) GetProcAddress (shcoreModule, "GetDpiForMonitor"); | getDPIForMonitor = (GetDPIForMonitorFunc) GetProcAddress (shcoreModule, "GetDpiForMonitor"); | ||||
@@ -407,7 +408,7 @@ static bool isPerMonitorDPIAwareProcess() | |||||
return false; | return false; | ||||
DPI_Awareness context; | DPI_Awareness context; | ||||
getProcessDPIAwareness (0, &context); | |||||
getProcessDPIAwareness (nullptr, &context); | |||||
return context == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; | return context == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware; | ||||
}(); | }(); | ||||
@@ -453,9 +454,9 @@ static double getGlobalDPI() | |||||
{ | { | ||||
setDPIAwareness(); | setDPIAwareness(); | ||||
HDC dc = GetDC (0); | |||||
HDC dc = GetDC (nullptr); | |||||
auto dpi = (GetDeviceCaps (dc, LOGPIXELSX) + GetDeviceCaps (dc, LOGPIXELSY)) / 2.0; | auto dpi = (GetDeviceCaps (dc, LOGPIXELSX) + GetDeviceCaps (dc, LOGPIXELSY)) / 2.0; | ||||
ReleaseDC (0, dc); | |||||
ReleaseDC (nullptr, dc); | |||||
return dpi; | return dpi; | ||||
} | } | ||||
@@ -588,7 +589,7 @@ static void setWindowPos (HWND hwnd, Rectangle<int> bounds, UINT flags, bool adj | |||||
bounds = convertLogicalScreenRectangleToPhysical (bounds, hwnd); | bounds = convertLogicalScreenRectangleToPhysical (bounds, hwnd); | ||||
} | } | ||||
SetWindowPos (hwnd, 0, bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), flags); | |||||
SetWindowPos (hwnd, nullptr, bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), flags); | |||||
} | } | ||||
static RECT getWindowRect (HWND hwnd) | static RECT getWindowRect (HWND hwnd) | ||||
@@ -758,14 +759,14 @@ public: | |||||
bitmapInfo.bV4V4Compression = BI_RGB; | bitmapInfo.bV4V4Compression = BI_RGB; | ||||
} | } | ||||
HDC dc = GetDC (0); | |||||
HDC dc = GetDC (nullptr); | |||||
hdc = CreateCompatibleDC (dc); | hdc = CreateCompatibleDC (dc); | ||||
ReleaseDC (0, dc); | |||||
ReleaseDC (nullptr, dc); | |||||
SetMapMode (hdc, MM_TEXT); | SetMapMode (hdc, MM_TEXT); | ||||
hBitmap = CreateDIBSection (hdc, (BITMAPINFO*) &(bitmapInfo), DIB_RGB_COLORS, | hBitmap = CreateDIBSection (hdc, (BITMAPINFO*) &(bitmapInfo), DIB_RGB_COLORS, | ||||
(void**) &bitmapData, 0, 0); | |||||
(void**) &bitmapData, nullptr, 0); | |||||
previousBitmap = SelectObject (hdc, hBitmap); | previousBitmap = SelectObject (hdc, hBitmap); | ||||
@@ -830,7 +831,7 @@ public: | |||||
bf.BlendOp = AC_SRC_OVER; | bf.BlendOp = AC_SRC_OVER; | ||||
bf.SourceConstantAlpha = updateLayeredWindowAlpha; | bf.SourceConstantAlpha = updateLayeredWindowAlpha; | ||||
UpdateLayeredWindow (hwnd, 0, &pos, &size, hdc, &p, 0, &bf, 2 /*ULW_ALPHA*/); | |||||
UpdateLayeredWindow (hwnd, nullptr, &pos, &size, hdc, &p, 0, &bf, 2 /*ULW_ALPHA*/); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -853,9 +854,9 @@ public: | |||||
private: | private: | ||||
static bool isGraphicsCard32Bit() | static bool isGraphicsCard32Bit() | ||||
{ | { | ||||
auto dc = GetDC (0); | |||||
auto dc = GetDC (nullptr); | |||||
auto bitsPerPixel = GetDeviceCaps (dc, BITSPIXEL); | auto bitsPerPixel = GetDeviceCaps (dc, BITSPIXEL); | ||||
ReleaseDC (0, dc); | |||||
ReleaseDC (nullptr, dc); | |||||
return bitsPerPixel > 24; | return bitsPerPixel > 24; | ||||
} | } | ||||
@@ -962,7 +963,7 @@ namespace IconConverters | |||||
auto oldObject = ::SelectObject (dc, dib); | auto oldObject = ::SelectObject (dc, dib); | ||||
auto numPixels = bm.bmWidth * bm.bmHeight; | auto numPixels = bm.bmWidth * bm.bmHeight; | ||||
auto numColourComponents = numPixels * 4; | |||||
auto numColourComponents = (size_t) numPixels * 4; | |||||
// Windows icon data comes as two layers, an XOR mask which contains the bulk | // Windows icon data comes as two layers, an XOR mask which contains the bulk | ||||
// of the image data and an AND mask which provides the transparency. Annoyingly | // of the image data and an AND mask which provides the transparency. Annoyingly | ||||
@@ -1024,7 +1025,7 @@ namespace IconConverters | |||||
g.drawImageAt (image, 0, 0); | g.drawImageAt (image, 0, 0); | ||||
} | } | ||||
auto mask = CreateBitmap (image.getWidth(), image.getHeight(), 1, 1, 0); | |||||
auto mask = CreateBitmap (image.getWidth(), image.getHeight(), 1, 1, nullptr); | |||||
ICONINFO info; | ICONINFO info; | ||||
info.fIcon = isIcon; | info.fIcon = isIcon; | ||||
@@ -1307,7 +1308,7 @@ public: | |||||
callFunctionIfNotLocked (&destroyWindowCallback, (void*) hwnd); | callFunctionIfNotLocked (&destroyWindowCallback, (void*) hwnd); | ||||
if (currentWindowIcon != 0) | |||||
if (currentWindowIcon != nullptr) | |||||
DestroyIcon (currentWindowIcon); | DestroyIcon (currentWindowIcon); | ||||
if (dropTarget != nullptr) | if (dropTarget != nullptr) | ||||
@@ -1330,7 +1331,7 @@ public: | |||||
ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ||||
if (shouldBeVisible) | if (shouldBeVisible) | ||||
InvalidateRect (hwnd, 0, 0); | |||||
InvalidateRect (hwnd, nullptr, 0); | |||||
else | else | ||||
lastPaintTime = 0; | lastPaintTime = 0; | ||||
} | } | ||||
@@ -1449,7 +1450,7 @@ public: | |||||
else | else | ||||
{ | { | ||||
SetWindowLong (hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); | SetWindowLong (hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); | ||||
RedrawWindow (hwnd, 0, 0, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); | |||||
RedrawWindow (hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); | |||||
} | } | ||||
} | } | ||||
else | else | ||||
@@ -1602,7 +1603,7 @@ public: | |||||
bool isFocused() const override | bool isFocused() const override | ||||
{ | { | ||||
return callFunctionIfNotLocked (&getFocusCallback, 0) == (void*) hwnd; | |||||
return callFunctionIfNotLocked (&getFocusCallback, nullptr) == (void*) hwnd; | |||||
} | } | ||||
void grabFocus() override | void grabFocus() override | ||||
@@ -1671,7 +1672,7 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
static HWNDComponentPeer* getOwnerOfWindow (HWND h) noexcept | static HWNDComponentPeer* getOwnerOfWindow (HWND h) noexcept | ||||
{ | { | ||||
if (h != 0 && JuceWindowIdentifier::isJUCEWindow (h)) | |||||
if (h != nullptr && JuceWindowIdentifier::isJUCEWindow (h)) | |||||
return (HWNDComponentPeer*) GetWindowLongPtr (h, 8); | return (HWNDComponentPeer*) GetWindowLongPtr (h, 8); | ||||
return nullptr; | return nullptr; | ||||
@@ -1808,8 +1809,8 @@ public: | |||||
{ | { | ||||
DroppedData (IDataObject* dataObject, CLIPFORMAT type) | DroppedData (IDataObject* dataObject, CLIPFORMAT type) | ||||
{ | { | ||||
FORMATETC format = { type, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM resetMedium = { TYMED_HGLOBAL, { 0 }, 0 }; | |||||
FORMATETC format = { type, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||||
STGMEDIUM resetMedium = { TYMED_HGLOBAL, { nullptr }, nullptr }; | |||||
medium = resetMedium; | medium = resetMedium; | ||||
if (SUCCEEDED (error = dataObject->GetData (&format, &medium))) | if (SUCCEEDED (error = dataObject->GetData (&format, &medium))) | ||||
@@ -1914,7 +1915,7 @@ private: | |||||
bool fullScreen = false, isDragging = false, isMouseOver = false, | bool fullScreen = false, isDragging = false, isMouseOver = false, | ||||
hasCreatedCaret = false, constrainerIsResizing = false; | hasCreatedCaret = false, constrainerIsResizing = false; | ||||
BorderSize<int> windowBorder; | BorderSize<int> windowBorder; | ||||
HICON currentWindowIcon = 0; | |||||
HICON currentWindowIcon = nullptr; | |||||
FileDropTarget* dropTarget = nullptr; | FileDropTarget* dropTarget = nullptr; | ||||
uint8 updateLayeredWindowAlpha = 255; | uint8 updateLayeredWindowAlpha = 255; | ||||
UWPUIViewSettings uwpViewSettings; | UWPUIViewSettings uwpViewSettings; | ||||
@@ -2111,7 +2112,7 @@ private: | |||||
if ((styleFlags & windowIsResizable) != 0) | if ((styleFlags & windowIsResizable) != 0) | ||||
type |= WS_THICKFRAME; | type |= WS_THICKFRAME; | ||||
} | } | ||||
else if (parentToAddTo != 0) | |||||
else if (parentToAddTo != nullptr) | |||||
{ | { | ||||
type |= WS_CHILD; | type |= WS_CHILD; | ||||
} | } | ||||
@@ -2131,10 +2132,10 @@ private: | |||||
if ((styleFlags & windowIsSemiTransparent) != 0) exstyle |= WS_EX_LAYERED; | if ((styleFlags & windowIsSemiTransparent) != 0) exstyle |= WS_EX_LAYERED; | ||||
hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->getWindowClassName(), | hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->getWindowClassName(), | ||||
L"", type, 0, 0, 0, 0, parentToAddTo, 0, | |||||
(HINSTANCE) Process::getCurrentModuleInstanceHandle(), 0); | |||||
L"", type, 0, 0, 0, 0, parentToAddTo, nullptr, | |||||
(HINSTANCE) Process::getCurrentModuleInstanceHandle(), nullptr); | |||||
if (hwnd != 0) | |||||
if (hwnd != nullptr) | |||||
{ | { | ||||
SetWindowLongPtr (hwnd, 0, 0); | SetWindowLongPtr (hwnd, 0, 0); | ||||
SetWindowLongPtr (hwnd, 8, (LONG_PTR) this); | SetWindowLongPtr (hwnd, 8, (LONG_PTR) this); | ||||
@@ -2265,7 +2266,7 @@ private: | |||||
SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); | SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); | ||||
SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon); | SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon); | ||||
if (currentWindowIcon != 0) | |||||
if (currentWindowIcon != nullptr) | |||||
DestroyIcon (currentWindowIcon); | DestroyIcon (currentWindowIcon); | ||||
currentWindowIcon = hicon; | currentWindowIcon = hicon; | ||||
@@ -2523,7 +2524,7 @@ private: | |||||
#endif | #endif | ||||
} | } | ||||
static int getMinTimeBetweenMouseMoves() | |||||
static uint32 getMinTimeBetweenMouseMoves() | |||||
{ | { | ||||
if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista) | if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista) | ||||
return 0; | return 0; | ||||
@@ -2781,7 +2782,7 @@ private: | |||||
HeapBlock<TOUCHINPUT> inputInfo (numInputs); | HeapBlock<TOUCHINPUT> inputInfo (numInputs); | ||||
if (getTouchInputInfo (eventHandle, numInputs, inputInfo, sizeof (TOUCHINPUT))) | |||||
if (getTouchInputInfo (eventHandle, (UINT) numInputs, inputInfo, sizeof (TOUCHINPUT))) | |||||
{ | { | ||||
for (int i = 0; i < numInputs; ++i) | for (int i = 0; i < numInputs; ++i) | ||||
{ | { | ||||
@@ -3292,7 +3293,7 @@ private: | |||||
ScreenToClient (GetParent (hwnd), &p); | ScreenToClient (GetParent (hwnd), &p); | ||||
auto ratio = *(double*) context; | auto ratio = *(double*) context; | ||||
SetWindowPos (hwnd, 0, roundToInt (p.x * ratio), roundToInt (p.y * ratio), | |||||
SetWindowPos (hwnd, nullptr, roundToInt (p.x * ratio), roundToInt (p.y * ratio), | |||||
roundToInt ((r.right - r.left) * ratio), roundToInt ((r.bottom - r.top) * ratio), | roundToInt ((r.right - r.left) * ratio), roundToInt ((r.bottom - r.top) * ratio), | ||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); | ||||
@@ -3722,7 +3723,7 @@ private: | |||||
return 0; | return 0; | ||||
case WM_DISPLAYCHANGE: | case WM_DISPLAYCHANGE: | ||||
InvalidateRect (h, 0, 0); | |||||
InvalidateRect (h, nullptr, 0); | |||||
// intentional fall-through... | // intentional fall-through... | ||||
JUCE_FALLTHROUGH | JUCE_FALLTHROUGH | ||||
case WM_SETTINGCHANGE: // note the fall-through in the previous case! | case WM_SETTINGCHANGE: // note the fall-through in the previous case! | ||||
@@ -3951,14 +3952,14 @@ private: | |||||
String getCompositionString (HIMC hImc, const DWORD type) const | String getCompositionString (HIMC hImc, const DWORD type) const | ||||
{ | { | ||||
jassert (hImc != 0); | |||||
jassert (hImc != nullptr); | |||||
const int stringSizeBytes = ImmGetCompositionString (hImc, type, 0, 0); | |||||
const auto stringSizeBytes = ImmGetCompositionString (hImc, type, nullptr, 0); | |||||
if (stringSizeBytes > 0) | if (stringSizeBytes > 0) | ||||
{ | { | ||||
HeapBlock<TCHAR> buffer; | HeapBlock<TCHAR> buffer; | ||||
buffer.calloc (stringSizeBytes / sizeof (TCHAR) + 1); | |||||
buffer.calloc ((size_t) stringSizeBytes / sizeof (TCHAR) + 1); | |||||
ImmGetCompositionString (hImc, type, buffer, (DWORD) stringSizeBytes); | ImmGetCompositionString (hImc, type, buffer, (DWORD) stringSizeBytes); | ||||
return String (buffer.get()); | return String (buffer.get()); | ||||
} | } | ||||
@@ -3968,14 +3969,14 @@ private: | |||||
int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const | int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const | ||||
{ | { | ||||
jassert (hImc != 0); | |||||
jassert (hImc != nullptr); | |||||
if ((lParam & CS_NOMOVECARET) != 0) | if ((lParam & CS_NOMOVECARET) != 0) | ||||
return compositionRange.getStart(); | return compositionRange.getStart(); | ||||
if ((lParam & GCS_CURSORPOS) != 0) | if ((lParam & GCS_CURSORPOS) != 0) | ||||
{ | { | ||||
const int localCaretPos = ImmGetCompositionString (hImc, GCS_CURSORPOS, 0, 0); | |||||
const int localCaretPos = ImmGetCompositionString (hImc, GCS_CURSORPOS, nullptr, 0); | |||||
return compositionRange.getStart() + jmax (0, localCaretPos); | return compositionRange.getStart() + jmax (0, localCaretPos); | ||||
} | } | ||||
@@ -3986,14 +3987,14 @@ private: | |||||
// returned range is relative to beginning of TextInputTarget, not composition string | // returned range is relative to beginning of TextInputTarget, not composition string | ||||
Range<int> getCompositionSelection (HIMC hImc, LPARAM lParam) const | Range<int> getCompositionSelection (HIMC hImc, LPARAM lParam) const | ||||
{ | { | ||||
jassert (hImc != 0); | |||||
jassert (hImc != nullptr); | |||||
int selectionStart = 0; | int selectionStart = 0; | ||||
int selectionEnd = 0; | int selectionEnd = 0; | ||||
if ((lParam & GCS_COMPATTR) != 0) | if ((lParam & GCS_COMPATTR) != 0) | ||||
{ | { | ||||
// Get size of attributes array: | // Get size of attributes array: | ||||
const int attributeSizeBytes = ImmGetCompositionString (hImc, GCS_COMPATTR, 0, 0); | |||||
const int attributeSizeBytes = ImmGetCompositionString (hImc, GCS_COMPATTR, nullptr, 0); | |||||
if (attributeSizeBytes > 0) | if (attributeSizeBytes > 0) | ||||
{ | { | ||||
@@ -4034,13 +4035,13 @@ private: | |||||
{ | { | ||||
Array<Range<int>> result; | Array<Range<int>> result; | ||||
if (hImc != 0 && (lParam & GCS_COMPCLAUSE) != 0) | |||||
if (hImc != nullptr && (lParam & GCS_COMPCLAUSE) != 0) | |||||
{ | { | ||||
auto clauseDataSizeBytes = ImmGetCompositionString (hImc, GCS_COMPCLAUSE, 0, 0); | |||||
auto clauseDataSizeBytes = ImmGetCompositionString (hImc, GCS_COMPCLAUSE, nullptr, 0); | |||||
if (clauseDataSizeBytes > 0) | if (clauseDataSizeBytes > 0) | ||||
{ | { | ||||
const size_t numItems = clauseDataSizeBytes / sizeof (uint32); | |||||
const auto numItems = (size_t) clauseDataSizeBytes / sizeof (uint32); | |||||
HeapBlock<uint32> clauseData (numItems); | HeapBlock<uint32> clauseData (numItems); | ||||
if (ImmGetCompositionString (hImc, GCS_COMPCLAUSE, clauseData, (DWORD) clauseDataSizeBytes) > 0) | if (ImmGetCompositionString (hImc, GCS_COMPCLAUSE, clauseData, (DWORD) clauseDataSizeBytes) > 0) | ||||
@@ -4228,6 +4229,7 @@ private: | |||||
case AlertWindow::QuestionIcon: flags |= MB_ICONQUESTION; break; | case AlertWindow::QuestionIcon: flags |= MB_ICONQUESTION; break; | ||||
case AlertWindow::WarningIcon: flags |= MB_ICONWARNING; break; | case AlertWindow::WarningIcon: flags |= MB_ICONWARNING; break; | ||||
case AlertWindow::InfoIcon: flags |= MB_ICONINFORMATION; break; | case AlertWindow::InfoIcon: flags |= MB_ICONINFORMATION; break; | ||||
case AlertWindow::NoIcon: JUCE_FALLTHROUGH | |||||
default: break; | default: break; | ||||
} | } | ||||
@@ -4236,7 +4238,7 @@ private: | |||||
static HWND getWindowForMessageBox (Component* associatedComponent) | static HWND getWindowForMessageBox (Component* associatedComponent) | ||||
{ | { | ||||
return associatedComponent != nullptr ? (HWND) associatedComponent->getWindowHandle() : 0; | |||||
return associatedComponent != nullptr ? (HWND) associatedComponent->getWindowHandle() : nullptr; | |||||
} | } | ||||
}; | }; | ||||
@@ -4245,7 +4247,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBox (AlertWindow::AlertIconType | |||||
const String& title, const String& message, | const String& title, const String& message, | ||||
Component* associatedComponent) | Component* associatedComponent) | ||||
{ | { | ||||
WindowsMessageBox box (iconType, title, message, associatedComponent, MB_OK, 0, false); | |||||
WindowsMessageBox box (iconType, title, message, associatedComponent, MB_OK, nullptr, false); | |||||
(void) box.getResult(); | (void) box.getResult(); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -4395,7 +4397,7 @@ void LookAndFeel::playAlertSound() | |||||
//============================================================================== | //============================================================================== | ||||
void SystemClipboard::copyTextToClipboard (const String& text) | void SystemClipboard::copyTextToClipboard (const String& text) | ||||
{ | { | ||||
if (OpenClipboard (0) != 0) | |||||
if (OpenClipboard (nullptr) != 0) | |||||
{ | { | ||||
if (EmptyClipboard() != 0) | if (EmptyClipboard() != 0) | ||||
{ | { | ||||
@@ -4424,7 +4426,7 @@ String SystemClipboard::getTextFromClipboard() | |||||
{ | { | ||||
String result; | String result; | ||||
if (OpenClipboard (0) != 0) | |||||
if (OpenClipboard (nullptr) != 0) | |||||
{ | { | ||||
if (auto bufH = GetClipboardData (CF_UNICODETEXT)) | if (auto bufH = GetClipboardData (CF_UNICODETEXT)) | ||||
{ | { | ||||
@@ -4541,7 +4543,7 @@ void Displays::findDisplays (float masterScale) | |||||
setDPIAwareness(); | setDPIAwareness(); | ||||
Array<MonitorInfo> monitors; | Array<MonitorInfo> monitors; | ||||
EnumDisplayMonitors (0, 0, &enumMonitorsProc, (LPARAM) &monitors); | |||||
EnumDisplayMonitors (nullptr, nullptr, &enumMonitorsProc, (LPARAM) &monitors); | |||||
auto globalDPI = getGlobalDPI(); | auto globalDPI = getGlobalDPI(); | ||||
@@ -4719,14 +4721,15 @@ void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorT | |||||
return copyCursor; | return copyCursor; | ||||
} | } | ||||
case NumStandardCursorTypes: JUCE_FALLTHROUGH | |||||
default: | default: | ||||
jassertfalse; break; | jassertfalse; break; | ||||
} | } | ||||
if (auto cursorH = LoadCursor (0, cursorName)) | |||||
if (auto cursorH = LoadCursor (nullptr, cursorName)) | |||||
return cursorH; | return cursorH; | ||||
return LoadCursor (0, IDC_ARROW); | |||||
return LoadCursor (nullptr, IDC_ARROW); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -4734,12 +4737,14 @@ void MouseCursor::showInWindow (ComponentPeer*) const | |||||
{ | { | ||||
auto c = (HCURSOR) getHandle(); | auto c = (HCURSOR) getHandle(); | ||||
if (c == 0) | |||||
c = LoadCursor (0, IDC_ARROW); | |||||
if (c == nullptr) | |||||
c = LoadCursor (nullptr, IDC_ARROW); | |||||
else if (c == (HCURSOR) hiddenMouseCursorHandle) | else if (c == (HCURSOR) hiddenMouseCursorHandle) | ||||
c = 0; | |||||
c = nullptr; | |||||
SetCursor (c); | SetCursor (c); | ||||
} | } | ||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE | |||||
} // namespace juce | } // namespace juce |
@@ -107,7 +107,7 @@ namespace ActiveXHelpers | |||||
if (lplpDoc != nullptr) *lplpDoc = nullptr; | if (lplpDoc != nullptr) *lplpDoc = nullptr; | ||||
lpFrameInfo->fMDIApp = FALSE; | lpFrameInfo->fMDIApp = FALSE; | ||||
lpFrameInfo->hwndFrame = window; | lpFrameInfo->hwndFrame = window; | ||||
lpFrameInfo->haccel = 0; | |||||
lpFrameInfo->haccel = nullptr; | |||||
lpFrameInfo->cAccelEntries = 0; | lpFrameInfo->cAccelEntries = 0; | ||||
return S_OK; | return S_OK; | ||||
} | } | ||||
@@ -256,7 +256,7 @@ public: | |||||
void setControlBounds (Rectangle<int> newBounds) const | void setControlBounds (Rectangle<int> newBounds) const | ||||
{ | { | ||||
if (controlHWND != 0) | |||||
if (controlHWND != nullptr) | |||||
{ | { | ||||
#if JUCE_WIN_PER_MONITOR_DPI_AWARE | #if JUCE_WIN_PER_MONITOR_DPI_AWARE | ||||
if (auto* peer = owner.getTopLevelComponent()->getPeer()) | if (auto* peer = owner.getTopLevelComponent()->getPeer()) | ||||
@@ -270,11 +270,13 @@ public: | |||||
void setControlVisible (bool shouldBeVisible) const | void setControlVisible (bool shouldBeVisible) const | ||||
{ | { | ||||
if (controlHWND != 0) | |||||
if (controlHWND != nullptr) | |||||
ShowWindow (controlHWND, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ShowWindow (controlHWND, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
using ComponentMovementWatcher::componentMovedOrResized; | |||||
void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/) override | void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/) override | ||||
{ | { | ||||
if (auto* peer = owner.getTopLevelComponent()->getPeer()) | if (auto* peer = owner.getTopLevelComponent()->getPeer()) | ||||
@@ -291,6 +293,8 @@ public: | |||||
#endif | #endif | ||||
} | } | ||||
using ComponentMovementWatcher::componentVisibilityChanged; | |||||
void componentVisibilityChanged() override | void componentVisibilityChanged() override | ||||
{ | { | ||||
setControlVisible (owner.isShowing()); | setControlVisible (owner.isShowing()); | ||||
@@ -351,7 +355,7 @@ public: | |||||
IStorage* storage = nullptr; | IStorage* storage = nullptr; | ||||
ActiveXHelpers::JuceIOleClientSite* clientSite = nullptr; | ActiveXHelpers::JuceIOleClientSite* clientSite = nullptr; | ||||
IOleObject* control = nullptr; | IOleObject* control = nullptr; | ||||
WNDPROC originalWndProc = 0; | |||||
WNDPROC originalWndProc = nullptr; | |||||
}; | }; | ||||
//============================================================================== | //============================================================================== | ||||
@@ -383,13 +387,13 @@ bool ActiveXControlComponent::createControl (const void* controlIID) | |||||
std::unique_ptr<Pimpl> newControl (new Pimpl (hwnd, *this)); | std::unique_ptr<Pimpl> newControl (new Pimpl (hwnd, *this)); | ||||
HRESULT hr = OleCreate (*(const IID*) controlIID, __uuidof (IOleObject), 1 /*OLERENDER_DRAW*/, 0, | |||||
HRESULT hr = OleCreate (*(const IID*) controlIID, __uuidof (IOleObject), 1 /*OLERENDER_DRAW*/, nullptr, | |||||
newControl->clientSite, newControl->storage, | newControl->clientSite, newControl->storage, | ||||
(void**) &(newControl->control)); | (void**) &(newControl->control)); | ||||
if (hr == S_OK) | if (hr == S_OK) | ||||
{ | { | ||||
newControl->control->SetHostNames (L"JUCE", 0); | |||||
newControl->control->SetHostNames (L"JUCE", nullptr); | |||||
if (OleSetContainedObject (newControl->control, TRUE) == S_OK) | if (OleSetContainedObject (newControl->control, TRUE) == S_OK) | ||||
{ | { | ||||
@@ -399,12 +403,12 @@ bool ActiveXControlComponent::createControl (const void* controlIID) | |||||
rect.right = controlBounds.getRight(); | rect.right = controlBounds.getRight(); | ||||
rect.bottom = controlBounds.getBottom(); | rect.bottom = controlBounds.getBottom(); | ||||
if (newControl->control->DoVerb (OLEIVERB_SHOW, 0, newControl->clientSite, 0, hwnd, &rect) == S_OK) | |||||
if (newControl->control->DoVerb (OLEIVERB_SHOW, nullptr, newControl->clientSite, 0, hwnd, &rect) == S_OK) | |||||
{ | { | ||||
control.reset (newControl.release()); | control.reset (newControl.release()); | ||||
control->controlHWND = ActiveXHelpers::getHWND (this); | control->controlHWND = ActiveXHelpers::getHWND (this); | ||||
if (control->controlHWND != 0) | |||||
if (control->controlHWND != nullptr) | |||||
{ | { | ||||
control->setControlBounds (controlBounds); | control->setControlBounds (controlBounds); | ||||
@@ -37,6 +37,8 @@ public: | |||||
DestroyWindow (hwnd); | DestroyWindow (hwnd); | ||||
} | } | ||||
using ComponentMovementWatcher::componentMovedOrResized; | |||||
void componentMovedOrResized (bool wasMoved, bool wasResized) override | void componentMovedOrResized (bool wasMoved, bool wasResized) override | ||||
{ | { | ||||
auto* topComponent = owner.getTopLevelComponent(); | auto* topComponent = owner.getTopLevelComponent(); | ||||
@@ -52,7 +54,7 @@ public: | |||||
if (! wasMoved) windowFlags |= SWP_NOMOVE; | if (! wasMoved) windowFlags |= SWP_NOMOVE; | ||||
if (! wasResized) windowFlags |= SWP_NOSIZE; | if (! wasResized) windowFlags |= SWP_NOSIZE; | ||||
SetWindowPos (hwnd, 0, scaled.getX(), scaled.getY(), scaled.getWidth(), scaled.getHeight(), windowFlags); | |||||
SetWindowPos (hwnd, nullptr, scaled.getX(), scaled.getY(), scaled.getWidth(), scaled.getHeight(), windowFlags); | |||||
} | } | ||||
} | } | ||||
@@ -73,9 +75,11 @@ public: | |||||
ShowWindow (hwnd, isShowing ? SW_SHOWNA : SW_HIDE); | ShowWindow (hwnd, isShowing ? SW_SHOWNA : SW_HIDE); | ||||
if (isShowing) | if (isShowing) | ||||
InvalidateRect (hwnd, 0, 0); | |||||
InvalidateRect (hwnd, nullptr, 0); | |||||
} | } | ||||
using ComponentMovementWatcher::componentVisibilityChanged; | |||||
void componentVisibilityChanged() override | void componentVisibilityChanged() override | ||||
{ | { | ||||
componentPeerChanged(); | componentPeerChanged(); | ||||
@@ -51,7 +51,7 @@ public: | |||||
renderContext = wglCreateContext (dc); | renderContext = wglCreateContext (dc); | ||||
if (renderContext != 0) | |||||
if (renderContext != nullptr) | |||||
{ | { | ||||
makeActive(); | makeActive(); | ||||
initialiseGLExtensions(); | initialiseGLExtensions(); | ||||
@@ -100,7 +100,7 @@ public: | |||||
void shutdownOnRenderThread() { deactivateCurrentContext(); context = nullptr; } | void shutdownOnRenderThread() { deactivateCurrentContext(); context = nullptr; } | ||||
static void deactivateCurrentContext() { wglMakeCurrent (0, 0); } | |||||
static void deactivateCurrentContext() { wglMakeCurrent (nullptr, nullptr); } | |||||
bool makeActive() const noexcept { return isActive() || wglMakeCurrent (dc, renderContext) != FALSE; } | bool makeActive() const noexcept { return isActive() || wglMakeCurrent (dc, renderContext) != FALSE; } | ||||
bool isActive() const noexcept { return wglGetCurrentContext() == renderContext; } | bool isActive() const noexcept { return wglGetCurrentContext() == renderContext; } | ||||
void swapBuffers() const noexcept { SwapBuffers (dc); } | void swapBuffers() const noexcept { SwapBuffers (dc); } | ||||
@@ -124,7 +124,7 @@ public: | |||||
if (! approximatelyEqual (nativeScaleFactor, 1.0)) | if (! approximatelyEqual (nativeScaleFactor, 1.0)) | ||||
bounds = (bounds.toDouble() * nativeScaleFactor).toNearestInt(); | bounds = (bounds.toDouble() * nativeScaleFactor).toNearestInt(); | ||||
SetWindowPos ((HWND) nativeWindow->getNativeHandle(), 0, | |||||
SetWindowPos ((HWND) nativeWindow->getNativeHandle(), nullptr, | |||||
bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), | bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), | ||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); | ||||
} | } | ||||
@@ -232,10 +232,10 @@ private: | |||||
void deleteRenderContext() | void deleteRenderContext() | ||||
{ | { | ||||
if (renderContext != 0) | |||||
if (renderContext != nullptr) | |||||
{ | { | ||||
wglDeleteContext (renderContext); | wglDeleteContext (renderContext); | ||||
renderContext = 0; | |||||
renderContext = nullptr; | |||||
} | } | ||||
} | } | ||||
@@ -322,7 +322,7 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
bool OpenGLHelpers::isContextActive() | bool OpenGLHelpers::isContextActive() | ||||
{ | { | ||||
return wglGetCurrentContext() != 0; | |||||
return wglGetCurrentContext() != nullptr; | |||||
} | } | ||||
} // namespace juce | } // namespace juce |