1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows: Fix clang/gnu compiler warnings

This commit is contained in:
reuk 2021-06-02 15:58:43 +01:00
parent db2a809832
commit 7ac6911ccc
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
45 changed files with 955 additions and 844 deletions

View file

@ -994,7 +994,7 @@ private:
#if JUCE_WINDOWS && ! JUCE_MINGW #if JUCE_WINDOWS && ! JUCE_MINGW
#define JUCE_CHECKED_ITERATOR(msg, size) \ #define JUCE_CHECKED_ITERATOR(msg, size) \
stdext::checked_array_iterator<typename std::remove_reference<decltype (msg)>::type> ((msg), (size)) stdext::checked_array_iterator<typename std::remove_reference<decltype (msg)>::type> ((msg), (size_t) (size))
#else #else
#define JUCE_CHECKED_ITERATOR(msg, size) (msg) #define JUCE_CHECKED_ITERATOR(msg, size) (msg)
#endif #endif

View file

@ -764,7 +764,7 @@ public:
} }
} }
~DSoundAudioIODevice() ~DSoundAudioIODevice() override
{ {
close(); close();
} }

View file

@ -396,7 +396,7 @@ private:
collector->addClient (this); collector->addClient (this);
} }
~Win32InputWrapper() ~Win32InputWrapper() override
{ {
collector->removeClient (this); collector->removeClient (this);
} }
@ -608,7 +608,7 @@ private:
{ {
for (int i = 0; i < 50; ++i) for (int i = 0; i < 50; ++i)
{ {
if (midiOutShortMsg (han->handle, *(unsigned int*) message.getRawData()) != MIDIERR_NOTREADY) if (midiOutShortMsg (han->handle, *unalignedPointerCast<const unsigned int*> (message.getRawData())) != MIDIERR_NOTREADY)
break; break;
Sleep (1); Sleep (1);

View file

@ -23,6 +23,8 @@
namespace juce namespace juce
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
#ifndef JUCE_WASAPI_LOGGING #ifndef JUCE_WASAPI_LOGGING
#define JUCE_WASAPI_LOGGING 0 #define JUCE_WASAPI_LOGGING 0
#endif #endif
@ -865,7 +867,7 @@ public:
{ {
} }
~WASAPIInputDevice() ~WASAPIInputDevice() override
{ {
close(); close();
} }
@ -1028,7 +1030,7 @@ public:
{ {
} }
~WASAPIOutputDevice() ~WASAPIOutputDevice() override
{ {
close(); close();
} }
@ -1150,11 +1152,11 @@ class WASAPIAudioIODevice : public AudioIODevice,
{ {
public: public:
WASAPIAudioIODevice (const String& deviceName, WASAPIAudioIODevice (const String& deviceName,
const String& typeName, const String& typeNameIn,
const String& outputDeviceID, const String& outputDeviceID,
const String& inputDeviceID, const String& inputDeviceID,
WASAPIDeviceMode mode) WASAPIDeviceMode mode)
: AudioIODevice (deviceName, typeName), : AudioIODevice (deviceName, typeNameIn),
Thread ("JUCE WASAPI"), Thread ("JUCE WASAPI"),
outputDeviceId (outputDeviceID), outputDeviceId (outputDeviceID),
inputDeviceId (inputDeviceID), inputDeviceId (inputDeviceID),
@ -1162,7 +1164,7 @@ public:
{ {
} }
~WASAPIAudioIODevice() ~WASAPIAudioIODevice() override
{ {
cancelPendingUpdate(); cancelPendingUpdate();
close(); close();
@ -1659,7 +1661,7 @@ public:
{ {
} }
~WASAPIAudioIODeviceType() ~WASAPIAudioIODeviceType() override
{ {
if (notifyClient != nullptr) if (notifyClient != nullptr)
enumerator->UnregisterEndpointNotificationCallback (notifyClient); enumerator->UnregisterEndpointNotificationCallback (notifyClient);
@ -1968,4 +1970,6 @@ bool JUCE_CALLTYPE SystemAudioVolume::setGain (float gain) { return WasapiCla
bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { return WasapiClasses::MMDeviceMasterVolume().isMuted(); } bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { return WasapiClasses::MMDeviceMasterVolume().isMuted(); }
bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool mute) { return WasapiClasses::MMDeviceMasterVolume().setMuted (mute); } bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool mute) { return WasapiClasses::MMDeviceMasterVolume().setMuted (mute); }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} // namespace juce } // namespace juce

View file

@ -118,7 +118,8 @@ namespace FlacNamespace
"-Wimplicit-fallthrough", "-Wimplicit-fallthrough",
"-Wzero-as-null-pointer-constant", "-Wzero-as-null-pointer-constant",
"-Wsign-conversion", "-Wsign-conversion",
"-Wredundant-decls") "-Wredundant-decls",
"-Wlanguage-extension-token")
#if JUCE_INTEL #if JUCE_INTEL
#if JUCE_32BIT #if JUCE_32BIT

View file

@ -74,7 +74,7 @@ public:
} }
if (resultPosition != nullptr) if (resultPosition != nullptr)
resultPosition->QuadPart = newPos; resultPosition->QuadPart = (ULONGLONG) newPos;
return source.setPosition (newPos) ? S_OK : E_NOTIMPL; return source.setPosition (newPos) ? S_OK : E_NOTIMPL;
} }
@ -83,7 +83,7 @@ public:
ULARGE_INTEGER* bytesRead, ULARGE_INTEGER* bytesWritten) ULARGE_INTEGER* bytesRead, ULARGE_INTEGER* bytesWritten)
{ {
uint64 totalCopied = 0; uint64 totalCopied = 0;
int64 numBytes = numBytesToDo.QuadPart; auto numBytes = (int64) numBytesToDo.QuadPart;
while (numBytes > 0 && ! source.isExhausted()) while (numBytes > 0 && ! source.isExhausted())
{ {
@ -95,8 +95,8 @@ public:
if (numRead <= 0) if (numRead <= 0)
break; break;
destStream->Write (buffer, numRead, nullptr); destStream->Write (buffer, (ULONG) numRead, nullptr);
totalCopied += numRead; totalCopied += (ULONG) numRead;
} }
if (bytesRead != nullptr) bytesRead->QuadPart = totalCopied; if (bytesRead != nullptr) bytesRead->QuadPart = totalCopied;
@ -112,7 +112,7 @@ public:
zerostruct (*stat); zerostruct (*stat);
stat->type = STGTY_STREAM; stat->type = STGTY_STREAM;
stat->cbSize.QuadPart = jmax ((int64) 0, source.getTotalLength()); stat->cbSize.QuadPart = (ULONGLONG) jmax ((int64) 0, source.getTotalLength());
return S_OK; return S_OK;
} }
@ -124,7 +124,7 @@ private:
//============================================================================== //==============================================================================
static const char* wmFormatName = "Windows Media"; static const char* wmFormatName = "Windows Media";
static const char* const extensions[] = { ".mp3", ".wmv", ".asf", ".wm", ".wma", 0 }; static const char* const extensions[] = { ".mp3", ".wmv", ".asf", ".wm", ".wma", nullptr };
//============================================================================== //==============================================================================
class WMAudioReader : public AudioFormatReader class WMAudioReader : public AudioFormatReader
@ -157,7 +157,7 @@ public:
} }
} }
~WMAudioReader() ~WMAudioReader() override
{ {
if (wmSyncReader != nullptr) if (wmSyncReader != nullptr)
wmSyncReader->Close(); wmSyncReader->Close();
@ -174,7 +174,7 @@ public:
clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer,
startSampleInFile, numSamples, lengthInSamples); startSampleInFile, numSamples, lengthInSamples);
const int stride = numChannels * sizeof (int16); const auto stride = (int) (numChannels * sizeof (int16));
while (numSamples > 0) while (numSamples > 0)
{ {
@ -203,20 +203,20 @@ public:
return false; return false;
if (hasJumped) if (hasJumped)
bufferedRange.setStart ((int64) ((sampleTime * (int64) sampleRate) / 10000000)); bufferedRange.setStart ((int64) ((sampleTime * (QWORD) sampleRate) / 10000000));
else else
bufferedRange.setStart (bufferedRange.getEnd()); // (because the positions returned often aren't contiguous) bufferedRange.setStart (bufferedRange.getEnd()); // (because the positions returned often aren't contiguous)
bufferedRange.setLength ((int64) (dataLength / stride)); bufferedRange.setLength ((int64) dataLength / (int64) stride);
buffer.ensureSize ((int) dataLength); buffer.ensureSize ((size_t) dataLength);
memcpy (buffer.getData(), rawData, (size_t) dataLength); memcpy (buffer.getData(), rawData, (size_t) dataLength);
} }
else if (hr == NS_E_NO_MORE_SAMPLES) else if (hr == NS_E_NO_MORE_SAMPLES)
{ {
bufferedRange.setStart (startSampleInFile); bufferedRange.setStart (startSampleInFile);
bufferedRange.setLength (256); bufferedRange.setLength (256);
buffer.ensureSize (256 * stride); buffer.ensureSize (256 * (size_t) stride);
buffer.fillWith (0); buffer.fillWith (0);
} }
else else
@ -240,7 +240,7 @@ public:
for (int j = 0; j < numToDo; ++j) for (int j = 0; j < numToDo; ++j)
{ {
dst[j] = ((uint32) *src) << 16; dst[j] = (int) (((uint32) *src) << 16);
src += numChannels; src += numChannels;
} }
JUCE_END_IGNORE_WARNINGS_MSVC JUCE_END_IGNORE_WARNINGS_MSVC
@ -262,7 +262,7 @@ private:
void checkCoInitialiseCalled() void checkCoInitialiseCalled()
{ {
ignoreUnused (CoInitialize (0)); ignoreUnused (CoInitialize (nullptr));
} }
void scanFileForDetails() void scanFileForDetails()
@ -286,7 +286,7 @@ private:
if (auto wmMediaProperties = wmStreamConfig.getInterface<IWMMediaProps>()) if (auto wmMediaProperties = wmStreamConfig.getInterface<IWMMediaProps>())
{ {
DWORD sizeMediaType; DWORD sizeMediaType;
hr = wmMediaProperties->GetMediaType (0, &sizeMediaType); hr = wmMediaProperties->GetMediaType (nullptr, &sizeMediaType);
HeapBlock<WM_MEDIA_TYPE> mediaType; HeapBlock<WM_MEDIA_TYPE> mediaType;
mediaType.malloc (sizeMediaType, 1); mediaType.malloc (sizeMediaType, 1);
@ -299,7 +299,7 @@ private:
sampleRate = inputFormat->nSamplesPerSec; sampleRate = inputFormat->nSamplesPerSec;
numChannels = inputFormat->nChannels; numChannels = inputFormat->nChannels;
bitsPerSample = inputFormat->wBitsPerSample != 0 ? inputFormat->wBitsPerSample : 16; bitsPerSample = inputFormat->wBitsPerSample != 0 ? inputFormat->wBitsPerSample : 16;
lengthInSamples = (lengthInNanoseconds * (int) sampleRate) / 10000000; lengthInSamples = (lengthInNanoseconds * (QWORD) sampleRate) / 10000000;
} }
} }
} }

View file

@ -39,7 +39,7 @@ class WindowsMediaAudioFormat : public AudioFormat
public: public:
//============================================================================== //==============================================================================
WindowsMediaAudioFormat(); WindowsMediaAudioFormat();
~WindowsMediaAudioFormat(); ~WindowsMediaAudioFormat() override;
//============================================================================== //==============================================================================
Array<int> getPossibleSampleRates() override; Array<int> getPossibleSampleRates() override;

View file

@ -1615,7 +1615,7 @@ private:
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHandle }; ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHandle };
SetWindowPos (pluginHandle, 0, SetWindowPos (pluginHandle, nullptr,
pos.x, pos.y, pos.x, pos.y,
rect.getWidth(), rect.getHeight(), rect.getWidth(), rect.getHeight(),
isVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW); isVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW);

View file

@ -54,6 +54,8 @@ namespace juce
#define JUCE_COMRESULT HRESULT STDMETHODCALLTYPE #define JUCE_COMRESULT HRESULT STDMETHODCALLTYPE
#define JUCE_COMCALL virtual HRESULT STDMETHODCALLTYPE #define JUCE_COMCALL virtual HRESULT STDMETHODCALLTYPE
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
inline GUID uuidFromString (const char* s) noexcept inline GUID uuidFromString (const char* s) noexcept
{ {
uint32 ints[4] = {}; uint32 ints[4] = {};
@ -223,4 +225,6 @@ private:
} }
}; };
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} // namespace juce } // namespace juce

View file

@ -32,6 +32,8 @@ namespace WindowsFileHelpers
{ {
//============================================================================== //==============================================================================
#if JUCE_WINDOWS #if JUCE_WINDOWS
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnested-anon-types")
typedef struct _REPARSE_DATA_BUFFER { typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag; ULONG ReparseTag;
USHORT ReparseDataLength; USHORT ReparseDataLength;
@ -57,6 +59,8 @@ namespace WindowsFileHelpers
} GenericReparseBuffer; } GenericReparseBuffer;
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} *PREPARSE_DATA_BUFFER, REPARSE_DATA_BUFFER; } *PREPARSE_DATA_BUFFER, REPARSE_DATA_BUFFER;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif #endif
//============================================================================== //==============================================================================
@ -874,8 +878,8 @@ bool File::createShortcut (const String& description, const File& linkFileToCrea
class DirectoryIterator::NativeIterator::Pimpl class DirectoryIterator::NativeIterator::Pimpl
{ {
public: public:
Pimpl (const File& directory, const String& wildCard) Pimpl (const File& directory, const String& wildCardIn)
: directoryWithWildCard (directory.getFullPathName().isNotEmpty() ? File::addTrailingSeparator (directory.getFullPathName()) + wildCard : String()), : directoryWithWildCard (directory.getFullPathName().isNotEmpty() ? File::addTrailingSeparator (directory.getFullPathName()) + wildCardIn : String()),
handle (INVALID_HANDLE_VALUE) handle (INVALID_HANDLE_VALUE)
{ {
} }
@ -925,8 +929,8 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl)
}; };
DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard) DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCardIn)
: pimpl (new DirectoryIterator::NativeIterator::Pimpl (directory, wildCard)) : pimpl (new DirectoryIterator::NativeIterator::Pimpl (directory, wildCardIn))
{ {
} }

View file

@ -569,9 +569,9 @@ namespace MACAddressHelpers
for (auto addr = start; addr != nullptr; addr = addr->Next) for (auto addr = start; addr != nullptr; addr = addr->Next)
{ {
if (addr->Address.lpSockaddr->sa_family == AF_INET) if (addr->Address.lpSockaddr->sa_family == AF_INET)
result.addIfNotAlreadyThere (createAddress ((sockaddr_in*) addr->Address.lpSockaddr)); result.addIfNotAlreadyThere (createAddress (unalignedPointerCast<sockaddr_in*> (addr->Address.lpSockaddr)));
else if (addr->Address.lpSockaddr->sa_family == AF_INET6 && includeIPv6) else if (addr->Address.lpSockaddr->sa_family == AF_INET6 && includeIPv6)
result.addIfNotAlreadyThere (createAddress ((sockaddr_in6*) addr->Address.lpSockaddr)); result.addIfNotAlreadyThere (createAddress (unalignedPointerCast<sockaddr_in6*> (addr->Address.lpSockaddr)));
} }
} }
} }

View file

@ -146,7 +146,10 @@ void CPUInformation::initialise() noexcept
hasSSSE3 = (info[2] & (1 << 9)) != 0; hasSSSE3 = (info[2] & (1 << 9)) != 0;
hasSSE41 = (info[2] & (1 << 19)) != 0; hasSSE41 = (info[2] & (1 << 19)) != 0;
hasSSE42 = (info[2] & (1 << 20)) != 0; hasSSE42 = (info[2] & (1 << 20)) != 0;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wshift-sign-overflow")
has3DNow = (info[1] & (1 << 31)) != 0; has3DNow = (info[1] & (1 << 31)) != 0;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
callCPUID (info, 0x80000001); callCPUID (info, 0x80000001);
hasFMA4 = (info[2] & (1 << 16)) != 0; hasFMA4 = (info[2] & (1 << 16)) != 0;
@ -396,7 +399,7 @@ public:
LARGE_INTEGER f; LARGE_INTEGER f;
QueryPerformanceFrequency (&f); QueryPerformanceFrequency (&f);
hiResTicksPerSecond = f.QuadPart; hiResTicksPerSecond = f.QuadPart;
hiResTicksScaleFactor = 1000.0 / hiResTicksPerSecond; hiResTicksScaleFactor = 1000.0 / (double) hiResTicksPerSecond;
} }
inline int64 getHighResolutionTicks() noexcept inline int64 getHighResolutionTicks() noexcept
@ -408,7 +411,7 @@ public:
inline double getMillisecondCounterHiRes() noexcept inline double getMillisecondCounterHiRes() noexcept
{ {
return getHighResolutionTicks() * hiResTicksScaleFactor; return (double) getHighResolutionTicks() * hiResTicksScaleFactor;
} }
int64 hiResTicksPerSecond, hiResTicksOffset; int64 hiResTicksPerSecond, hiResTicksOffset;

View file

@ -43,13 +43,13 @@ CriticalSection::CriticalSection() noexcept
static_assert (sizeof (CRITICAL_SECTION) <= sizeof (lock), static_assert (sizeof (CRITICAL_SECTION) <= sizeof (lock),
"win32 lock array too small to hold CRITICAL_SECTION: please report this JUCE bug!"); "win32 lock array too small to hold CRITICAL_SECTION: please report this JUCE bug!");
InitializeCriticalSection ((CRITICAL_SECTION*) lock); InitializeCriticalSection ((CRITICAL_SECTION*) &lock);
} }
CriticalSection::~CriticalSection() noexcept { DeleteCriticalSection ((CRITICAL_SECTION*) lock); } CriticalSection::~CriticalSection() noexcept { DeleteCriticalSection ((CRITICAL_SECTION*) &lock); }
void CriticalSection::enter() const noexcept { EnterCriticalSection ((CRITICAL_SECTION*) lock); } void CriticalSection::enter() const noexcept { EnterCriticalSection ((CRITICAL_SECTION*) &lock); }
bool CriticalSection::tryEnter() const noexcept { return TryEnterCriticalSection ((CRITICAL_SECTION*) lock) != FALSE; } bool CriticalSection::tryEnter() const noexcept { return TryEnterCriticalSection ((CRITICAL_SECTION*) &lock) != FALSE; }
void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRITICAL_SECTION*) lock); } void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRITICAL_SECTION*) &lock); }
//============================================================================== //==============================================================================
@ -301,17 +301,17 @@ void* DynamicLibrary::getFunction (const String& functionName) noexcept
class InterProcessLock::Pimpl class InterProcessLock::Pimpl
{ {
public: public:
Pimpl (String name, const int timeOutMillisecs) Pimpl (String nameIn, const int timeOutMillisecs)
: handle (nullptr), refCount (1) : handle (nullptr), refCount (1)
{ {
name = name.replaceCharacter ('\\', '/'); nameIn = nameIn.replaceCharacter ('\\', '/');
handle = CreateMutexW (nullptr, TRUE, ("Global\\" + name).toWideCharPointer()); handle = CreateMutexW (nullptr, TRUE, ("Global\\" + nameIn).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 == nullptr) if (handle == nullptr)
handle = CreateMutexW (nullptr, TRUE, ("Local\\" + name).toWideCharPointer()); handle = CreateMutexW (nullptr, TRUE, ("Local\\" + nameIn).toWideCharPointer());
if (handle != nullptr && GetLastError() == ERROR_ALREADY_EXISTS) if (handle != nullptr && GetLastError() == ERROR_ALREADY_EXISTS)
{ {

View file

@ -106,9 +106,9 @@ private:
// a block of memory here that's big enough to be used internally as a windows // a block of memory here that's big enough to be used internally as a windows
// CRITICAL_SECTION structure. // CRITICAL_SECTION structure.
#if JUCE_64BIT #if JUCE_64BIT
uint8 lock[44]; std::aligned_storage<44, 4>::type lock;
#else #else
uint8 lock[24]; std::aligned_storage<24, 4>::type lock;
#endif #endif
#else #else
mutable pthread_mutex_t lock; mutable pthread_mutex_t lock;

View file

@ -97,8 +97,6 @@ public:
SetWindowLongPtr (messageWindow.getHWND(), GWLP_USERDATA, (LONG_PTR) this); SetWindowLongPtr (messageWindow.getHWND(), GWLP_USERDATA, (LONG_PTR) this);
} }
virtual ~DeviceChangeDetector() {}
virtual void systemDeviceChanged() = 0; virtual void systemDeviceChanged() = 0;
void triggerAsyncDeviceChangeCallback() void triggerAsyncDeviceChangeCallback()

View file

@ -41,10 +41,14 @@ namespace DirectWriteTypeLayout
JUCE_COMRESULT QueryInterface (REFIID refId, void** result) override JUCE_COMRESULT QueryInterface (REFIID refId, void** result) override
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (refId == __uuidof (IDWritePixelSnapping)) if (refId == __uuidof (IDWritePixelSnapping))
return castToType<IDWritePixelSnapping> (result); return castToType<IDWritePixelSnapping> (result);
return ComBaseClassHelper<IDWriteTextRenderer>::QueryInterface (refId, result); return ComBaseClassHelper<IDWriteTextRenderer>::QueryInterface (refId, result);
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
JUCE_COMRESULT IsPixelSnappingDisabled (void* /*clientDrawingContext*/, BOOL* isDisabled) noexcept override JUCE_COMRESULT IsPixelSnappingDisabled (void* /*clientDrawingContext*/, BOOL* isDisabled) noexcept override
@ -114,9 +118,9 @@ namespace DirectWriteTypeLayout
glyphLine.ascent = jmax (glyphLine.ascent, scaledFontSize (dwFontMetrics.ascent, dwFontMetrics, *glyphRun)); glyphLine.ascent = jmax (glyphLine.ascent, scaledFontSize (dwFontMetrics.ascent, dwFontMetrics, *glyphRun));
glyphLine.descent = jmax (glyphLine.descent, scaledFontSize (dwFontMetrics.descent, dwFontMetrics, *glyphRun)); glyphLine.descent = jmax (glyphLine.descent, scaledFontSize (dwFontMetrics.descent, dwFontMetrics, *glyphRun));
auto glyphRunLayout = new TextLayout::Run (Range<int> (runDescription->textPosition, auto glyphRunLayout = new TextLayout::Run (Range<int> ((int) runDescription->textPosition,
runDescription->textPosition + runDescription->stringLength), (int) (runDescription->textPosition + runDescription->stringLength)),
glyphRun->glyphCount); (int) glyphRun->glyphCount);
glyphLine.runs.add (glyphRunLayout); glyphLine.runs.add (glyphRunLayout);
glyphRun->fontFace->GetMetrics (&dwFontMetrics); glyphRun->fontFace->GetMetrics (&dwFontMetrics);
@ -256,8 +260,8 @@ namespace DirectWriteTypeLayout
const int textLen, ID2D1RenderTarget& renderTarget, IDWriteFontCollection& fontCollection) const int textLen, ID2D1RenderTarget& renderTarget, IDWriteFontCollection& fontCollection)
{ {
DWRITE_TEXT_RANGE range; DWRITE_TEXT_RANGE range;
range.startPosition = attr.range.getStart(); range.startPosition = (UINT32) attr.range.getStart();
range.length = jmin (attr.range.getLength(), textLen - attr.range.getStart()); range.length = (UINT32) jmin (attr.range.getLength(), textLen - attr.range.getStart());
{ {
auto familyName = FontStyleHelpers::getConcreteFamilyName (attr.font); auto familyName = FontStyleHelpers::getConcreteFamilyName (attr.font);
@ -276,9 +280,9 @@ namespace DirectWriteTypeLayout
uint32 fontFacesCount = 0; uint32 fontFacesCount = 0;
fontFacesCount = fontFamily->GetFontCount(); fontFacesCount = fontFamily->GetFontCount();
for (int i = fontFacesCount; --i >= 0;) for (int i = (int) fontFacesCount; --i >= 0;)
{ {
hr = fontFamily->GetFont (i, dwFont.resetAndGetPointerAddress()); hr = fontFamily->GetFont ((UINT32) i, dwFont.resetAndGetPointerAddress());
if (attr.font.getTypefaceStyle() == getFontFaceName (dwFont)) if (attr.font.getTypefaceStyle() == getFontFaceName (dwFont))
break; break;
@ -349,7 +353,7 @@ namespace DirectWriteTypeLayout
auto textLen = text.getText().length(); auto textLen = text.getText().length();
hr = directWriteFactory.CreateTextLayout (text.getText().toWideCharPointer(), textLen, dwTextFormat, hr = directWriteFactory.CreateTextLayout (text.getText().toWideCharPointer(), (UINT32) textLen, dwTextFormat,
maxWidth, maxHeight, textLayout.resetAndGetPointerAddress()); maxWidth, maxHeight, textLayout.resetAndGetPointerAddress());
if (FAILED (hr) || textLayout == nullptr) if (FAILED (hr) || textLayout == nullptr)
@ -377,7 +381,7 @@ namespace DirectWriteTypeLayout
UINT32 actualLineCount = 0; UINT32 actualLineCount = 0;
auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount); auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount);
layout.ensureStorageAllocated (actualLineCount); layout.ensureStorageAllocated ((int) actualLineCount);
{ {
ComSmartPtr<CustomDirectWriteTextRenderer> textRenderer (new CustomDirectWriteTextRenderer (fontCollection, text)); ComSmartPtr<CustomDirectWriteTextRenderer> textRenderer (new CustomDirectWriteTextRenderer (fontCollection, text));
@ -394,7 +398,7 @@ namespace DirectWriteTypeLayout
for (int i = 0; i < numLines; ++i) for (int i = 0; i < numLines; ++i)
{ {
auto& line = layout.getLine (i); auto& line = layout.getLine (i);
line.stringRange = Range<int> (lastLocation, (int) lastLocation + dwLineMetrics[i].length); line.stringRange = Range<int> (lastLocation, lastLocation + (int) dwLineMetrics[i].length);
line.lineOrigin.y += yAdjustment; line.lineOrigin.y += yAdjustment;
yAdjustment += extraLineSpacing; yAdjustment += extraLineSpacing;
lastLocation += dwLineMetrics[i].length; lastLocation += dwLineMetrics[i].length;

View file

@ -75,6 +75,8 @@ class Direct2DFactories
public: public:
Direct2DFactories() Direct2DFactories()
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (direct2dDll.open ("d2d1.dll")) if (direct2dDll.open ("d2d1.dll"))
{ {
JUCE_LOAD_WINAPI_FUNCTION (direct2dDll, D2D1CreateFactory, d2d1CreateFactory, JUCE_LOAD_WINAPI_FUNCTION (direct2dDll, D2D1CreateFactory, d2d1CreateFactory,
@ -116,6 +118,8 @@ public:
d2dFactory->CreateDCRenderTarget (&d2dRTProp, directWriteRenderTarget.resetAndGetPointerAddress()); d2dFactory->CreateDCRenderTarget (&d2dRTProp, directWriteRenderTarget.resetAndGetPointerAddress());
} }
} }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
~Direct2DFactories() ~Direct2DFactories()
@ -163,7 +167,7 @@ public:
for (int i = (int) dwFontFamily->GetFontCount(); --i >= 0;) for (int i = (int) dwFontFamily->GetFontCount(); --i >= 0;)
{ {
hr = dwFontFamily->GetFont (i, dwFont.resetAndGetPointerAddress()); hr = dwFontFamily->GetFont ((UINT32) i, dwFont.resetAndGetPointerAddress());
if (i == 0) if (i == 0)
break; break;
@ -191,15 +195,15 @@ public:
ascent = std::abs ((float) dwFontMetrics.ascent); ascent = std::abs ((float) dwFontMetrics.ascent);
auto totalSize = ascent + std::abs ((float) dwFontMetrics.descent); auto totalSize = ascent + std::abs ((float) dwFontMetrics.descent);
ascent /= totalSize; ascent /= totalSize;
unitsToHeightScaleFactor = designUnitsPerEm / totalSize; unitsToHeightScaleFactor = (float) designUnitsPerEm / totalSize;
auto tempDC = GetDC (0); auto tempDC = GetDC (nullptr);
auto dpi = (GetDeviceCaps (tempDC, LOGPIXELSX) + GetDeviceCaps (tempDC, LOGPIXELSY)) / 2.0f; auto dpi = (float) (GetDeviceCaps (tempDC, LOGPIXELSX) + GetDeviceCaps (tempDC, LOGPIXELSY)) / 2.0f;
heightToPointsFactor = (dpi / GetDeviceCaps (tempDC, LOGPIXELSY)) * unitsToHeightScaleFactor; heightToPointsFactor = (dpi / (float) GetDeviceCaps (tempDC, LOGPIXELSY)) * unitsToHeightScaleFactor;
ReleaseDC (0, tempDC); ReleaseDC (nullptr, tempDC);
auto pathAscent = (1024.0f * dwFontMetrics.ascent) / designUnitsPerEm; auto pathAscent = (1024.0f * dwFontMetrics.ascent) / (float) designUnitsPerEm;
auto pathDescent = (1024.0f * dwFontMetrics.descent) / designUnitsPerEm; auto pathDescent = (1024.0f * dwFontMetrics.descent) / (float) designUnitsPerEm;
auto pathScale = 1.0f / (std::abs (pathAscent) + std::abs (pathDescent)); auto pathScale = 1.0f / (std::abs (pathAscent) + std::abs (pathDescent));
pathTransform = AffineTransform::scale (pathScale); pathTransform = AffineTransform::scale (pathScale);
} }
@ -226,7 +230,7 @@ public:
float x = 0; float x = 0;
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
x += (float) dwGlyphMetrics[i].advanceWidth / designUnitsPerEm; x += (float) dwGlyphMetrics[i].advanceWidth / (float) designUnitsPerEm;
return x * unitsToHeightScaleFactor; return x * unitsToHeightScaleFactor;
} }
@ -247,7 +251,7 @@ public:
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
x += (float) dwGlyphMetrics[i].advanceWidth / designUnitsPerEm; x += (float) dwGlyphMetrics[i].advanceWidth / (float) designUnitsPerEm;
xOffsets.add (x * unitsToHeightScaleFactor); xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (glyphIndices[i]); resultGlyphs.add (glyphIndices[i]);
} }

View file

@ -409,7 +409,7 @@ public:
auto pheader = reinterpret_cast<const TTPOLYGONHEADER*> (data.getData()); auto pheader = reinterpret_cast<const TTPOLYGONHEADER*> (data.getData());
auto scaleX = 1.0f / tm.tmHeight; auto scaleX = 1.0f / (float) tm.tmHeight;
auto scaleY = -scaleX; auto scaleY = -scaleX;
while ((char*) pheader < data + bufSize) while ((char*) pheader < data + bufSize)
@ -417,7 +417,7 @@ public:
glyphPath.startNewSubPath (scaleX * pheader->pfxStart.x.value, glyphPath.startNewSubPath (scaleX * pheader->pfxStart.x.value,
scaleY * pheader->pfxStart.y.value); scaleY * pheader->pfxStart.y.value);
auto curve = (const TTPOLYCURVE*) ((const char*) pheader + sizeof (TTPOLYGONHEADER)); auto curve = unalignedPointerCast<const TTPOLYCURVE*> ((const char*) pheader + sizeof (TTPOLYGONHEADER));
auto curveEnd = ((const char*) pheader) + pheader->cb; auto curveEnd = ((const char*) pheader) + pheader->cb;
while ((const char*) curve < curveEnd) while ((const char*) curve < curveEnd)
@ -450,7 +450,7 @@ public:
curve = (const TTPOLYCURVE*) &(curve->apfx [curve->cpfx]); curve = (const TTPOLYCURVE*) &(curve->apfx [curve->cpfx]);
} }
pheader = (const TTPOLYGONHEADER*) curve; pheader = unalignedPointerCast<const TTPOLYGONHEADER*> (curve);
glyphPath.closeSubPath(); glyphPath.closeSubPath();
} }
@ -514,9 +514,9 @@ private:
if (GetTextMetrics (dc, &tm)) if (GetTextMetrics (dc, &tm))
{ {
auto dpi = (GetDeviceCaps (dc, LOGPIXELSX) + GetDeviceCaps (dc, LOGPIXELSY)) / 2.0f; auto dpi = (float) (GetDeviceCaps (dc, LOGPIXELSX) + GetDeviceCaps (dc, LOGPIXELSY)) / 2.0f;
heightToPointsFactor = (dpi / GetDeviceCaps (dc, LOGPIXELSY)) * heightInPoints / (float) tm.tmHeight; heightToPointsFactor = (dpi / (float) GetDeviceCaps (dc, LOGPIXELSY)) * (float) heightInPoints / (float) tm.tmHeight;
ascent = tm.tmAscent / (float) tm.tmHeight; ascent = (float) tm.tmAscent / (float) tm.tmHeight;
std::unordered_map<int, int> glyphsForChars; std::unordered_map<int, int> glyphsForChars;
defaultGlyph = getGlyphForChar (dc, glyphsForChars, tm.tmDefaultChar); defaultGlyph = getGlyphForChar (dc, glyphsForChars, tm.tmDefaultChar);
createKerningPairs (dc, glyphsForChars, (float) tm.tmHeight); createKerningPairs (dc, glyphsForChars, (float) tm.tmHeight);
@ -538,8 +538,8 @@ private:
auto glyph2 = getGlyphForChar (hdc, glyphsForChars, rawKerning[i].wSecond); auto glyph2 = getGlyphForChar (hdc, glyphsForChars, rawKerning[i].wSecond);
auto standardWidth = getGlyphWidth (hdc, widthsForGlyphs, glyph1); auto standardWidth = getGlyphWidth (hdc, widthsForGlyphs, glyph1);
kerningPairs[kerningPairIndex (glyph1, glyph2)] = (standardWidth + rawKerning[i].iKernAmount) / height; kerningPairs[kerningPairIndex (glyph1, glyph2)] = (float) (standardWidth + rawKerning[i].iKernAmount) / height;
kerningPairs[kerningPairIndex (glyph1, -1)] = standardWidth / height; kerningPairs[kerningPairIndex (glyph1, -1)] = (float) standardWidth / height;
} }
} }
@ -593,7 +593,7 @@ private:
if (single != kerningPairs.end()) if (single != kerningPairs.end())
return single->second; return single->second;
auto width = getGlyphWidth (hdc, glyph1) / (float) tm.tmHeight; auto width = (float) getGlyphWidth (hdc, glyph1) / (float) tm.tmHeight;
kerningPairs[kerningPairIndex (glyph1, -1)] = width; kerningPairs[kerningPairIndex (glyph1, -1)] = width;
return width; return width;
} }

View file

@ -26,6 +26,8 @@
namespace juce namespace juce
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
static bool isStartingUpOrShuttingDown() static bool isStartingUpOrShuttingDown()
{ {
if (auto* app = JUCEApplicationBase::getInstance()) if (auto* app = JUCEApplicationBase::getInstance())
@ -272,4 +274,6 @@ namespace WindowsAccessibility
JUCE_IMPLEMENT_SINGLETON (WindowsUIAWrapper) JUCE_IMPLEMENT_SINGLETON (WindowsUIAWrapper)
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} // namespace juce } // namespace juce

View file

@ -26,6 +26,8 @@
namespace juce namespace juce
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
int AccessibilityNativeHandle::idCounter = 0; int AccessibilityNativeHandle::idCounter = 0;
//============================================================================== //==============================================================================
@ -100,7 +102,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::QueryInterface (REFIID refId, void** r
*result = nullptr; *result = nullptr;
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if ((refId == __uuidof (IRawElementProviderFragmentRoot) && ! isFragmentRoot())) if ((refId == __uuidof (IRawElementProviderFragmentRoot) && ! isFragmentRoot()))
return E_NOINTERFACE; return E_NOINTERFACE;
@ -403,7 +405,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetRuntimeId (SAFEARRAY** pRetVal)
for (LONG i = 0; i < 2; ++i) for (LONG i = 0; i < 2; ++i)
{ {
auto hr = SafeArrayPutElement (*pRetVal, &i, &rtid[i]); auto hr = SafeArrayPutElement (*pRetVal, &i, &rtid[(size_t) i]);
if (FAILED (hr)) if (FAILED (hr))
return E_FAIL; return E_FAIL;
@ -441,7 +443,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetEmbeddedFragmentRoots (SAFEARRAY**
JUCE_COMRESULT AccessibilityNativeHandle::SetFocus() JUCE_COMRESULT AccessibilityNativeHandle::SetFocus()
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const WeakReference<Component> safeComponent (&accessibilityHandler.getComponent()); const WeakReference<Component> safeComponent (&accessibilityHandler.getComponent());
@ -463,8 +465,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::get_FragmentRoot (IRawElementProviderF
return &accessibilityHandler; return &accessibilityHandler;
if (auto* peer = accessibilityHandler.getComponent().getPeer()) if (auto* peer = accessibilityHandler.getComponent().getPeer())
if (auto* handler = peer->getComponent().getAccessibilityHandler()) return peer->getComponent().getAccessibilityHandler();
return handler;
return nullptr; return nullptr;
}(); }();
@ -475,7 +476,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::get_FragmentRoot (IRawElementProviderF
return S_OK; return S_OK;
} }
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
}); });
} }
@ -552,4 +553,6 @@ String AccessibilityNativeHandle::getElementName() const
return name; return name;
} }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} // namespace juce } // namespace juce

View file

@ -63,7 +63,7 @@ private:
JUCE_COMRESULT invokeShowMenu() JUCE_COMRESULT invokeShowMenu()
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -76,7 +76,7 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
//============================================================================== //==============================================================================

View file

@ -73,8 +73,12 @@ public:
{ {
return withCellInterface (pRetVal, [&] (const AccessibilityCellInterface& cellInterface) return withCellInterface (pRetVal, [&] (const AccessibilityCellInterface& cellInterface)
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (auto* handler = cellInterface.getTableHandler()) if (auto* handler = cellInterface.getTableHandler())
handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal)); handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal));
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}); });
} }
@ -90,7 +94,7 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }

View file

@ -45,9 +45,13 @@ public:
|| ! isPositiveAndBelow (column, tableInterface.getNumColumns())) || ! isPositiveAndBelow (column, tableInterface.getNumColumns()))
return E_INVALIDARG; return E_INVALIDARG;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (auto* handler = tableInterface.getCellHandler (row, column)) if (auto* handler = tableInterface.getCellHandler (row, column))
handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal)); handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal));
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return S_OK; return S_OK;
}); });
} }
@ -79,7 +83,7 @@ private:
if (auto* tableInterface = getHandler().getTableInterface()) if (auto* tableInterface = getHandler().getTableInterface())
return callback (*tableInterface); return callback (*tableInterface);
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }

View file

@ -68,13 +68,15 @@ inline JUCE_COMRESULT addHandlersToArray (const std::vector<const AccessibilityH
{ {
for (LONG i = 0; i < (LONG) numHandlers; ++i) for (LONG i = 0; i < (LONG) numHandlers; ++i)
{ {
auto* handler = handlers[i]; auto* handler = handlers[(size_t) i];
if (handler == nullptr) if (handler == nullptr)
continue; continue;
ComSmartPtr<IRawElementProviderSimple> provider; ComSmartPtr<IRawElementProviderSimple> provider;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (provider.resetAndGetPointerAddress())); handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (provider.resetAndGetPointerAddress()));
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
auto hr = SafeArrayPutElement (*pRetVal, &i, provider); auto hr = SafeArrayPutElement (*pRetVal, &i, provider);
@ -95,7 +97,7 @@ inline JUCE_COMRESULT withCheckedComArgs (Value* pRetVal, Object& handle, Callba
*pRetVal = Value{}; *pRetVal = Value{};
if (! handle.isElementValid()) if (! handle.isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
return callback(); return callback();
} }

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT Invoke() override JUCE_COMRESULT Invoke() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -52,7 +52,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
//============================================================================== //==============================================================================

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT SetValue (double val) override JUCE_COMRESULT SetValue (double val) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -66,7 +66,7 @@ public:
} }
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT get_Value (double* pRetVal) override JUCE_COMRESULT get_Value (double* pRetVal) override
@ -129,7 +129,7 @@ private:
} }
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }

View file

@ -26,6 +26,8 @@
namespace juce namespace juce
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
JUCE_COMCLASS (ISelectionProvider2, "14f68475-ee1c-44f6-a869-d239381f0fe7") : public ISelectionProvider JUCE_COMCLASS (ISelectionProvider2, "14f68475-ee1c-44f6-a869-d239381f0fe7") : public ISelectionProvider
{ {
JUCE_COMCALL get_FirstSelectedItem (IRawElementProviderSimple** retVal) = 0; JUCE_COMCALL get_FirstSelectedItem (IRawElementProviderSimple** retVal) = 0;
@ -49,7 +51,7 @@ public:
JUCE_COMRESULT AddToSelection() override JUCE_COMRESULT AddToSelection() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -92,7 +94,7 @@ public:
JUCE_COMRESULT RemoveFromSelection() override JUCE_COMRESULT RemoveFromSelection() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (! isRadioButton) if (! isRadioButton)
{ {
@ -108,7 +110,7 @@ public:
JUCE_COMRESULT Select() override JUCE_COMRESULT Select() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
AddToSelection(); AddToSelection();
@ -249,4 +251,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UIASelectionProvider) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UIASelectionProvider)
}; };
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} // namespace juce } // namespace juce

View file

@ -43,6 +43,8 @@ public:
//============================================================================== //==============================================================================
JUCE_COMRESULT QueryInterface (REFIID iid, void** result) override JUCE_COMRESULT QueryInterface (REFIID iid, void** result) override
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (iid == _uuidof (IUnknown) || iid == _uuidof (ITextProvider)) if (iid == _uuidof (IUnknown) || iid == _uuidof (ITextProvider))
return castToType<ITextProvider> (result); return castToType<ITextProvider> (result);
@ -51,6 +53,8 @@ public:
*result = nullptr; *result = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
//============================================================================= //=============================================================================
@ -188,7 +192,7 @@ private:
if (auto* textInterface = getTextInterface()) if (auto* textInterface = getTextInterface())
return callback (*textInterface); return callback (*textInterface);
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -256,7 +260,7 @@ private:
JUCE_COMRESULT ExpandToEnclosingUnit (TextUnit unit) override JUCE_COMRESULT ExpandToEnclosingUnit (TextUnit unit) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* textInterface = owner->getTextInterface()) if (auto* textInterface = owner->getTextInterface())
{ {
@ -301,7 +305,7 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT FindAttribute (TEXTATTRIBUTEID, VARIANT, BOOL, ITextRangeProvider** pRetVal) override JUCE_COMRESULT FindAttribute (TEXTATTRIBUTEID, VARIANT, BOOL, ITextRangeProvider** pRetVal) override
@ -386,7 +390,7 @@ private:
auto rectangleList = textInterface.getTextBounds (selectionRange); auto rectangleList = textInterface.getTextBounds (selectionRange);
auto numRectangles = rectangleList.getNumRectangles(); auto numRectangles = rectangleList.getNumRectangles();
*pRetVal = SafeArrayCreateVector (VT_R8, 0, 4 * numRectangles); *pRetVal = SafeArrayCreateVector (VT_R8, 0, 4 * (ULONG) numRectangles);
if (*pRetVal == nullptr) if (*pRetVal == nullptr)
return E_FAIL; return E_FAIL;
@ -433,11 +437,15 @@ private:
JUCE_COMRESULT GetEnclosingElement (IRawElementProviderSimple** pRetVal) override JUCE_COMRESULT GetEnclosingElement (IRawElementProviderSimple** pRetVal) override
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
return withCheckedComArgs (pRetVal, *this, [&] return withCheckedComArgs (pRetVal, *this, [&]
{ {
getHandler().getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal)); getHandler().getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal));
return S_OK; return S_OK;
}); });
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
JUCE_COMRESULT GetText (int maxLength, BSTR* pRetVal) override JUCE_COMRESULT GetText (int maxLength, BSTR* pRetVal) override
@ -481,7 +489,7 @@ private:
return E_INVALIDARG; return E_INVALIDARG;
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* textInterface = owner->getTextInterface()) if (auto* textInterface = owner->getTextInterface())
{ {
@ -493,7 +501,7 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT MoveEndpointByUnit (TextPatternRangeEndpoint endpoint, JUCE_COMRESULT MoveEndpointByUnit (TextPatternRangeEndpoint endpoint,
@ -565,7 +573,7 @@ private:
JUCE_COMRESULT RemoveFromSelection() override JUCE_COMRESULT RemoveFromSelection() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* textInterface = owner->getTextInterface()) if (auto* textInterface = owner->getTextInterface())
{ {
@ -573,21 +581,21 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT ScrollIntoView (BOOL) override JUCE_COMRESULT ScrollIntoView (BOOL) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT Select() override JUCE_COMRESULT Select() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* textInterface = owner->getTextInterface()) if (auto* textInterface = owner->getTextInterface())
{ {
@ -597,7 +605,7 @@ private:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
private: private:
@ -660,7 +668,7 @@ private:
} }
bool isDisplayingProtectedText() const override { return false; } bool isDisplayingProtectedText() const override { return false; }
int getTotalNumCharacters() const { return text.length(); } int getTotalNumCharacters() const override { return text.length(); }
Range<int> getSelection() const override { return selection; } Range<int> getSelection() const override { return selection; }
void setSelection (Range<int> s) override { selection = s; } void setSelection (Range<int> s) override { selection = s; }
int getTextInsertionOffset() const override { return 0; } int getTextInsertionOffset() const override { return 0; }

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT Toggle() override JUCE_COMRESULT Toggle() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -54,7 +54,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT get_ToggleState (ToggleState* pRetVal) override JUCE_COMRESULT get_ToggleState (ToggleState* pRetVal) override

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT Move (double x, double y) override JUCE_COMRESULT Move (double x, double y) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* peer = getPeer()) if (auto* peer = getPeer())
{ {
@ -62,7 +62,7 @@ public:
JUCE_COMRESULT Resize (double width, double height) override JUCE_COMRESULT Resize (double width, double height) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* peer = getPeer()) if (auto* peer = getPeer())
{ {
@ -78,9 +78,9 @@ public:
JUCE_COMRESULT Rotate (double) override JUCE_COMRESULT Rotate (double) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT get_CanMove (BOOL* pRetVal) override JUCE_COMRESULT get_CanMove (BOOL* pRetVal) override

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT SetValue (LPCWSTR val) override JUCE_COMRESULT SetValue (LPCWSTR val) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
const auto& handler = getHandler(); const auto& handler = getHandler();
@ -71,7 +71,7 @@ public:
} }
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT get_Value (BSTR* pRetVal) override JUCE_COMRESULT get_Value (BSTR* pRetVal) override

View file

@ -40,7 +40,7 @@ public:
JUCE_COMRESULT SetVisualState (WindowVisualState state) override JUCE_COMRESULT SetVisualState (WindowVisualState state) override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* peer = getPeer()) if (auto* peer = getPeer())
{ {
@ -66,13 +66,13 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT Close() override JUCE_COMRESULT Close() override
{ {
if (! isElementValid()) if (! isElementValid())
return UIA_E_ELEMENTNOTAVAILABLE; return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* peer = getPeer()) if (auto* peer = getPeer())
{ {
@ -80,14 +80,14 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT WaitForInputIdle (int, BOOL* pRetVal) override JUCE_COMRESULT WaitForInputIdle (int, BOOL* pRetVal) override
{ {
return withCheckedComArgs (pRetVal, *this, [] return withCheckedComArgs (pRetVal, *this, []
{ {
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -101,7 +101,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -115,7 +115,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -129,7 +129,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -149,7 +149,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -166,7 +166,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }
@ -180,7 +180,7 @@ public:
return S_OK; return S_OK;
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
}); });
} }

View file

@ -50,19 +50,19 @@ public:
JUCE_COMRESULT hostProviderFromHwnd (HWND hwnd, IRawElementProviderSimple** provider) JUCE_COMRESULT hostProviderFromHwnd (HWND hwnd, IRawElementProviderSimple** provider)
{ {
return uiaHostProviderFromHwnd != nullptr ? uiaHostProviderFromHwnd (hwnd, provider) return uiaHostProviderFromHwnd != nullptr ? uiaHostProviderFromHwnd (hwnd, provider)
: UIA_E_NOTSUPPORTED; : (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT raiseAutomationPropertyChangedEvent (IRawElementProviderSimple* provider, PROPERTYID propID, VARIANT oldValue, VARIANT newValue) JUCE_COMRESULT raiseAutomationPropertyChangedEvent (IRawElementProviderSimple* provider, PROPERTYID propID, VARIANT oldValue, VARIANT newValue)
{ {
return uiaRaiseAutomationPropertyChangedEvent != nullptr ? uiaRaiseAutomationPropertyChangedEvent (provider, propID, oldValue, newValue) return uiaRaiseAutomationPropertyChangedEvent != nullptr ? uiaRaiseAutomationPropertyChangedEvent (provider, propID, oldValue, newValue)
: UIA_E_NOTSUPPORTED; : (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT raiseAutomationEvent (IRawElementProviderSimple* provider, EVENTID eventID) JUCE_COMRESULT raiseAutomationEvent (IRawElementProviderSimple* provider, EVENTID eventID)
{ {
return uiaRaiseAutomationEvent != nullptr ? uiaRaiseAutomationEvent (provider, eventID) return uiaRaiseAutomationEvent != nullptr ? uiaRaiseAutomationEvent (provider, eventID)
: UIA_E_NOTSUPPORTED; : (HRESULT) UIA_E_NOTSUPPORTED;
} }
BOOL clientsAreListening() BOOL clientsAreListening()
@ -79,7 +79,7 @@ public:
return uiaDisconnectProvider (provider); return uiaDisconnectProvider (provider);
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
JUCE_COMRESULT disconnectAllProviders() JUCE_COMRESULT disconnectAllProviders()
@ -90,7 +90,7 @@ public:
return uiaDisconnectAllProviders(); return uiaDisconnectAllProviders();
} }
return UIA_E_NOTSUPPORTED; return (HRESULT) UIA_E_NOTSUPPORTED;
} }
//============================================================================== //==============================================================================

View file

@ -883,7 +883,7 @@ public:
imageData = bitmapData - (lineStride * (h - 1)); imageData = bitmapData - (lineStride * (h - 1));
} }
~WindowsBitmapImage() ~WindowsBitmapImage() override
{ {
SelectObject (hdc, previousBitmap); // Selecting the previous bitmap before deleting the DC avoids a warning in BoundsChecker SelectObject (hdc, previousBitmap); // Selecting the previous bitmap before deleting the DC avoids a warning in BoundsChecker
DeleteDC (hdc); DeleteDC (hdc);
@ -987,7 +987,7 @@ Image createSnapshotOfNativeWindow (void* nativeWindowHandle)
{ {
auto scale = getScaleFactorForWindow (hwnd); auto scale = getScaleFactorForWindow (hwnd);
auto prevStretchMode = SetStretchBltMode (nativeBitmap->hdc, HALFTONE); auto prevStretchMode = SetStretchBltMode (nativeBitmap->hdc, HALFTONE);
SetBrushOrgEx (nativeBitmap->hdc, 0, 0, NULL); SetBrushOrgEx (nativeBitmap->hdc, 0, 0, nullptr);
StretchBlt (nativeBitmap->hdc, 0, 0, w, h, StretchBlt (nativeBitmap->hdc, 0, 0, w, h,
deviceContext.dc, 0, 0, roundToInt (w * scale), roundToInt (h * scale), deviceContext.dc, 0, 0, roundToInt (w * scale), roundToInt (h * scale),
@ -1044,6 +1044,7 @@ namespace IconConverters
if (auto* dc = ::CreateCompatibleDC (deviceContext.dc)) if (auto* dc = ::CreateCompatibleDC (deviceContext.dc))
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wfour-char-constants")
BITMAPV5HEADER header = {}; BITMAPV5HEADER header = {};
header.bV5Size = sizeof (BITMAPV5HEADER); header.bV5Size = sizeof (BITMAPV5HEADER);
header.bV5Width = bm.bmWidth; header.bV5Width = bm.bmWidth;
@ -1057,6 +1058,7 @@ namespace IconConverters
header.bV5AlphaMask = 0xFF000000; header.bV5AlphaMask = 0xFF000000;
header.bV5CSType = LCS_WINDOWS_COLOR_SPACE; header.bV5CSType = LCS_WINDOWS_COLOR_SPACE;
header.bV5Intent = LCS_GM_IMAGES; header.bV5Intent = LCS_GM_IMAGES;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
uint32* bitmapImageData = nullptr; uint32* bitmapImageData = nullptr;
@ -1170,7 +1172,7 @@ private:
tipInvocation.CoCreateInstance (ITipInvocation::getCLSID(), CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER); tipInvocation.CoCreateInstance (ITipInvocation::getCLSID(), CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER);
} }
~OnScreenKeyboard() ~OnScreenKeyboard() override
{ {
clearSingletonInstance(); clearSingletonInstance();
} }
@ -1194,7 +1196,7 @@ private:
} }
else else
{ {
if (auto hwnd = FindWindow (L"IPTip_Main_Window", NULL)) if (auto hwnd = FindWindow (L"IPTip_Main_Window", nullptr))
PostMessage (hwnd, WM_SYSCOMMAND, (int) SC_CLOSE, 0); PostMessage (hwnd, WM_SYSCOMMAND, (int) SC_CLOSE, 0);
} }
} }
@ -1202,15 +1204,15 @@ private:
bool isVisible() bool isVisible()
{ {
if (auto hwnd = FindWindowEx (NULL, NULL, L"ApplicationFrameWindow", NULL)) if (auto hwnd = FindWindowEx (nullptr, nullptr, L"ApplicationFrameWindow", nullptr))
return FindWindowEx (hwnd, NULL, L"Windows.UI.Core.CoreWindow", L"Microsoft Text Input Application") != NULL; return FindWindowEx (hwnd, nullptr, L"Windows.UI.Core.CoreWindow", L"Microsoft Text Input Application") != nullptr;
return false; return false;
} }
bool isVisibleLegacy() bool isVisibleLegacy()
{ {
if (auto hwnd = FindWindow (L"IPTip_Main_Window", NULL)) if (auto hwnd = FindWindow (L"IPTip_Main_Window", nullptr))
{ {
auto style = GetWindowLong (hwnd, GWL_STYLE); auto style = GetWindowLong (hwnd, GWL_STYLE);
return (style & WS_DISABLED) == 0 && (style & WS_VISIBLE) != 0; return (style & WS_DISABLED) == 0 && (style & WS_VISIBLE) != 0;
@ -1291,8 +1293,10 @@ struct UWPUIViewSettings
|| uwpClassId == nullptr) || uwpClassId == nullptr)
return; return;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
status = roGetActivationFactory (uwpClassId, __uuidof (IUIViewSettingsInterop), status = roGetActivationFactory (uwpClassId, __uuidof (IUIViewSettingsInterop),
(void**) viewSettingsInterop.resetAndGetPointerAddress()); (void**) viewSettingsInterop.resetAndGetPointerAddress());
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
deleteHString (uwpClassId); deleteHString (uwpClassId);
if (status != S_OK || viewSettingsInterop == nullptr) if (status != S_OK || viewSettingsInterop == nullptr)
@ -1310,6 +1314,8 @@ struct UWPUIViewSettings
ComSmartPtr<IUIViewSettings> viewSettings; ComSmartPtr<IUIViewSettings> viewSettings;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (viewSettingsInterop->GetForWindow (hWnd, __uuidof (IUIViewSettings), if (viewSettingsInterop->GetForWindow (hWnd, __uuidof (IUIViewSettings),
(void**) viewSettings.resetAndGetPointerAddress()) == S_OK (void**) viewSettings.resetAndGetPointerAddress()) == S_OK
&& viewSettings != nullptr) && viewSettings != nullptr)
@ -1320,6 +1326,8 @@ struct UWPUIViewSettings
return mode == IUIViewSettings::Touch; return mode == IUIViewSettings::Touch;
} }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return false; return false;
} }
@ -1395,7 +1403,7 @@ public:
}; };
} }
~HWNDComponentPeer() ~HWNDComponentPeer() override
{ {
// do this first to avoid messages arriving for this window before it's destroyed // do this first to avoid messages arriving for this window before it's destroyed
JuceWindowIdentifier::setAsJUCEWindow (hwnd, false); JuceWindowIdentifier::setAsJUCEWindow (hwnd, false);
@ -2484,12 +2492,12 @@ private:
CombineRgn (rgn, rgn, clipRgn, RGN_AND); CombineRgn (rgn, rgn, clipRgn, RGN_AND);
DeleteObject (clipRgn); DeleteObject (clipRgn);
char rgnData[8192]; std::aligned_storage<8192, alignof (RGNDATA)>::type rgnData;
const DWORD res = GetRegionData (rgn, sizeof (rgnData), (RGNDATA*) rgnData); const DWORD res = GetRegionData (rgn, sizeof (rgnData), (RGNDATA*) &rgnData);
if (res > 0 && res <= sizeof (rgnData)) if (res > 0 && res <= sizeof (rgnData))
{ {
const RGNDATAHEADER* const hdr = &(((const RGNDATA*) rgnData)->rdh); const RGNDATAHEADER* const hdr = &(((const RGNDATA*) &rgnData)->rdh);
if (hdr->iType == RDH_RECTANGLES if (hdr->iType == RDH_RECTANGLES
&& hdr->rcBound.right - hdr->rcBound.left >= w && hdr->rcBound.right - hdr->rcBound.left >= w
@ -2497,9 +2505,9 @@ private:
{ {
needToPaintAll = false; needToPaintAll = false;
auto rects = (const RECT*) (rgnData + sizeof (RGNDATAHEADER)); auto rects = unalignedPointerCast<const RECT*> ((char*) &rgnData + sizeof (RGNDATAHEADER));
for (int i = (int) ((RGNDATA*) rgnData)->rdh.nCount; --i >= 0;) for (int i = (int) ((RGNDATA*) &rgnData)->rdh.nCount; --i >= 0;)
{ {
if (rects->right <= x + w && rects->bottom <= y + h) if (rects->right <= x + w && rects->bottom <= y + h)
{ {
@ -2613,7 +2621,7 @@ private:
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx // https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx
// http://www.petertissen.de/?p=4 // http://www.petertissen.de/?p=4
return (GetMessageExtraInfo() & 0xFFFFFF80 /*SIGNATURE_MASK*/) == 0xFF515780 /*MI_WP_SIGNATURE*/; return ((uint32_t) GetMessageExtraInfo() & 0xFFFFFF80 /*SIGNATURE_MASK*/) == 0xFF515780 /*MI_WP_SIGNATURE*/;
} }
static bool areOtherTouchSourcesActive() static bool areOtherTouchSourcesActive()
@ -2759,7 +2767,7 @@ private:
ComponentPeer* findPeerUnderMouse (Point<float>& localPos) ComponentPeer* findPeerUnderMouse (Point<float>& localPos)
{ {
auto currentMousePos = getPOINTFromLParam (GetMessagePos()); auto currentMousePos = getPOINTFromLParam ((LPARAM) GetMessagePos());
// Because Windows stupidly sends all wheel events to the window with the keyboard // Because Windows stupidly sends all wheel events to the window with the keyboard
// focus, we have to redirect them here according to the mouse pos.. // focus, we have to redirect them here according to the mouse pos..
@ -2827,7 +2835,7 @@ private:
case 3: /*GID_ZOOM*/ case 3: /*GID_ZOOM*/
if (gi.dwFlags != 1 /*GF_BEGIN*/ && lastMagnifySize > 0) if (gi.dwFlags != 1 /*GF_BEGIN*/ && lastMagnifySize > 0)
peer->handleMagnifyGesture (MouseInputSource::InputSourceType::touch, localPos, getMouseEventTime(), peer->handleMagnifyGesture (MouseInputSource::InputSourceType::touch, localPos, getMouseEventTime(),
(float) (gi.ullArguments / (double) lastMagnifySize)); (float) ((double) gi.ullArguments / (double) lastMagnifySize));
lastMagnifySize = gi.ullArguments; lastMagnifySize = gi.ullArguments;
return true; return true;
@ -2947,7 +2955,7 @@ private:
if (! getPointerTouchInfo (GET_POINTERID_WPARAM (wParam), &touchInfo)) if (! getPointerTouchInfo (GET_POINTERID_WPARAM (wParam), &touchInfo))
return false; return false;
const auto pressure = touchInfo.touchMask & TOUCH_MASK_PRESSURE ? touchInfo.pressure const auto pressure = touchInfo.touchMask & TOUCH_MASK_PRESSURE ? static_cast<float> (touchInfo.pressure)
: MouseInputSource::invalidPressure; : MouseInputSource::invalidPressure;
const auto orientation = touchInfo.touchMask & TOUCH_MASK_ORIENTATION ? degreesToRadians (static_cast<float> (touchInfo.orientation)) const auto orientation = touchInfo.touchMask & TOUCH_MASK_ORIENTATION ? degreesToRadians (static_cast<float> (touchInfo.orientation))
: MouseInputSource::invalidOrientation; : MouseInputSource::invalidOrientation;
@ -2963,7 +2971,7 @@ private:
if (! getPointerPenInfo (GET_POINTERID_WPARAM (wParam), &penInfo)) if (! getPointerPenInfo (GET_POINTERID_WPARAM (wParam), &penInfo))
return false; return false;
const auto pressure = (penInfo.penMask & PEN_MASK_PRESSURE) ? penInfo.pressure / 1024.0f : MouseInputSource::invalidPressure; const auto pressure = (penInfo.penMask & PEN_MASK_PRESSURE) ? (float) penInfo.pressure / 1024.0f : MouseInputSource::invalidPressure;
if (! handlePenInput (penInfo, globalToLocal (convertPhysicalScreenPointToLogical (pointFromPOINT (getPOINTFromLParam (lParam)), hwnd).toFloat()), if (! handlePenInput (penInfo, globalToLocal (convertPhysicalScreenPointToLogical (pointFromPOINT (getPOINTFromLParam (lParam)), hwnd).toFloat()),
pressure, isDown, isUp)) pressure, isDown, isUp))
@ -2995,8 +3003,8 @@ private:
PenDetails penDetails; PenDetails penDetails;
penDetails.rotation = (penInfo.penMask & PEN_MASK_ROTATION) ? degreesToRadians (static_cast<float> (penInfo.rotation)) : MouseInputSource::invalidRotation; penDetails.rotation = (penInfo.penMask & PEN_MASK_ROTATION) ? degreesToRadians (static_cast<float> (penInfo.rotation)) : MouseInputSource::invalidRotation;
penDetails.tiltX = (penInfo.penMask & PEN_MASK_TILT_X) ? penInfo.tiltX / 90.0f : MouseInputSource::invalidTiltX; penDetails.tiltX = (penInfo.penMask & PEN_MASK_TILT_X) ? (float) penInfo.tiltX / 90.0f : MouseInputSource::invalidTiltX;
penDetails.tiltY = (penInfo.penMask & PEN_MASK_TILT_Y) ? penInfo.tiltY / 90.0f : MouseInputSource::invalidTiltY; penDetails.tiltY = (penInfo.penMask & PEN_MASK_TILT_Y) ? (float) penInfo.tiltY / 90.0f : MouseInputSource::invalidTiltY;
auto pInfoFlags = penInfo.pointerInfo.pointerFlags; auto pInfoFlags = penInfo.pointerInfo.pointerFlags;
@ -3302,9 +3310,9 @@ private:
auto physicalBounds = convertLogicalScreenRectangleToPhysical (ScalingHelpers::scaledScreenPosToUnscaled (component, pos.toFloat()), hwnd); auto physicalBounds = convertLogicalScreenRectangleToPhysical (ScalingHelpers::scaledScreenPosToUnscaled (component, pos.toFloat()), hwnd);
auto getNewPositionIfNotRoundingError = [] (int pos, float newPos) auto getNewPositionIfNotRoundingError = [] (int posIn, float newPos)
{ {
return (std::abs ((float) pos - newPos) >= 1.0f) ? roundToInt (newPos) : pos; return (std::abs ((float) posIn - newPos) >= 1.0f) ? roundToInt (newPos) : posIn;
}; };
wp.x = getNewPositionIfNotRoundingError (wp.x, physicalBounds.getX()); wp.x = getNewPositionIfNotRoundingError (wp.x, physicalBounds.getX());
@ -3586,7 +3594,7 @@ private:
Point<float> getCurrentMousePos() noexcept Point<float> getCurrentMousePos() noexcept
{ {
return globalToLocal (convertPhysicalScreenPointToLogical (pointFromPOINT (getPOINTFromLParam (GetMessagePos())), hwnd).toFloat()); return globalToLocal (convertPhysicalScreenPointToLogical (pointFromPOINT (getPOINTFromLParam ((LPARAM) GetMessagePos())), hwnd).toFloat());
} }
LRESULT peerWindowProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) LRESULT peerWindowProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)

View file

@ -50,7 +50,7 @@ public:
ActiveXControlComponent(); ActiveXControlComponent();
/** Destructor. */ /** Destructor. */
~ActiveXControlComponent(); ~ActiveXControlComponent() override;
/** Tries to create an ActiveX control and embed it in this peer. /** Tries to create an ActiveX control and embed it in this peer.

View file

@ -151,6 +151,8 @@ namespace ActiveXHelpers
JUCE_COMRESULT QueryInterface (REFIID type, void** result) JUCE_COMRESULT QueryInterface (REFIID type, void** result)
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (type == __uuidof (IOleInPlaceSite)) if (type == __uuidof (IOleInPlaceSite))
{ {
inplaceSite->AddRef(); inplaceSite->AddRef();
@ -159,6 +161,8 @@ namespace ActiveXHelpers
} }
return ComBaseClassHelper <IOleClientSite>::QueryInterface (type, result); return ComBaseClassHelper <IOleClientSite>::QueryInterface (type, result);
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
JUCE_COMRESULT SaveObject() { return E_NOTIMPL; } JUCE_COMRESULT SaveObject() { return E_NOTIMPL; }
@ -184,6 +188,8 @@ namespace ActiveXHelpers
static HWND getHWND (const ActiveXControlComponent* const component) static HWND getHWND (const ActiveXControlComponent* const component)
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
HWND hwnd = {}; HWND hwnd = {};
const IID iid = __uuidof (IOleWindow); const IID iid = __uuidof (IOleWindow);
@ -194,6 +200,8 @@ namespace ActiveXHelpers
} }
return hwnd; return hwnd;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
static void offerActiveXMouseEventToPeer (ComponentPeer* peer, HWND hwnd, UINT message, LPARAM lParam) static void offerActiveXMouseEventToPeer (ComponentPeer* peer, HWND hwnd, UINT message, LPARAM lParam)
@ -243,7 +251,7 @@ public:
{ {
} }
~Pimpl() ~Pimpl() override
{ {
if (control != nullptr) if (control != nullptr)
{ {
@ -394,10 +402,14 @@ bool ActiveXControlComponent::createControl (const void* controlIID)
std::unique_ptr<Pimpl> newControl (new Pimpl (hwnd, *this)); std::unique_ptr<Pimpl> newControl (new Pimpl (hwnd, *this));
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
HRESULT hr = OleCreate (*(const IID*) controlIID, __uuidof (IOleObject), 1 /*OLERENDER_DRAW*/, nullptr, 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));
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (hr == S_OK) if (hr == S_OK)
{ {
newControl->control->SetHostNames (L"JUCE", nullptr); newControl->control->SetHostNames (L"JUCE", nullptr);

View file

@ -133,7 +133,7 @@ private:
void removeFromParent() void removeFromParent()
{ {
ShowWindow (hwnd, SW_HIDE); ShowWindow (hwnd, SW_HIDE);
SetParent (hwnd, NULL); SetParent (hwnd, nullptr);
} }
Component& owner; Component& owner;

View file

@ -82,6 +82,8 @@ public:
void createBrowser() override void createBrowser() override
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
auto webCLSID = __uuidof (WebBrowser); auto webCLSID = __uuidof (WebBrowser);
createControl (&webCLSID); createControl (&webCLSID);
@ -104,6 +106,8 @@ public:
} }
} }
} }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
bool hasBrowserBeenCreated() override bool hasBrowserBeenCreated() override
@ -194,6 +198,8 @@ public:
void focusGained() override void focusGained() override
{ {
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
auto iidOleObject = __uuidof (IOleObject); auto iidOleObject = __uuidof (IOleObject);
auto iidOleWindow = __uuidof (IOleWindow); auto iidOleWindow = __uuidof (IOleWindow);
@ -216,6 +222,8 @@ public:
oleObject->Release(); oleObject->Release();
} }
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
} }
using ActiveXControlComponent::focusGained; using ActiveXControlComponent::focusGained;

View file

@ -37,7 +37,7 @@ class OpenGLContext::NativeContext
public: public:
NativeContext (Component& component, NativeContext (Component& component,
const OpenGLPixelFormat& pixelFormat, const OpenGLPixelFormat& pixelFormat,
void* contextToShareWith, void* contextToShareWithIn,
bool /*useMultisampling*/, bool /*useMultisampling*/,
OpenGLVersion) OpenGLVersion)
{ {
@ -77,15 +77,15 @@ public:
} }
} }
if (contextToShareWith != nullptr) if (contextToShareWithIn != nullptr)
wglShareLists ((HGLRC) contextToShareWith, renderContext); wglShareLists ((HGLRC) contextToShareWithIn, renderContext);
component.getTopLevelComponent()->repaint(); component.getTopLevelComponent()->repaint();
component.repaint(); component.repaint();
} }
} }
~NativeContext() ~NativeContext() override
{ {
deleteRenderContext(); deleteRenderContext();
releaseDC(); releaseDC();

View file

@ -1045,7 +1045,7 @@ struct StateHelpers
if (currentActiveTexture != index) if (currentActiveTexture != index)
{ {
currentActiveTexture = index; currentActiveTexture = index;
context.extensions.glActiveTexture ((GLenum) (GL_TEXTURE0 + index)); context.extensions.glActiveTexture (GL_TEXTURE0 + (GLenum) index);
JUCE_CHECK_OPENGL_ERROR JUCE_CHECK_OPENGL_ERROR
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,8 @@
// https://github.com/KhronosGroup/OpenGL-Registry // https://github.com/KhronosGroup/OpenGL-Registry
#pragma once #pragma once
#include <juce_core/system/juce_CompilerWarnings.h>
namespace juce namespace juce
@ -37,7 +39,7 @@ namespace gl
// WGL_VERSION_1_0 // WGL_VERSION_1_0
#ifndef WGL_FONT_LINES #ifndef WGL_FONT_LINES
enum enum : GLenum
{ {
WGL_FONT_LINES = 0, WGL_FONT_LINES = 0,
WGL_FONT_POLYGONS = 1, WGL_FONT_POLYGONS = 1,
@ -77,7 +79,7 @@ enum
// WGL_3DFX_multisample // WGL_3DFX_multisample
#ifndef WGL_SAMPLE_BUFFERS_3DFX #ifndef WGL_SAMPLE_BUFFERS_3DFX
enum enum : GLenum
{ {
WGL_SAMPLE_BUFFERS_3DFX = 0x2060, WGL_SAMPLE_BUFFERS_3DFX = 0x2060,
WGL_SAMPLES_3DFX = 0x2061, WGL_SAMPLES_3DFX = 0x2061,
@ -86,7 +88,7 @@ enum
// WGL_3DL_stereo_control // WGL_3DL_stereo_control
#ifndef WGL_STEREO_EMITTER_ENABLE_3DL #ifndef WGL_STEREO_EMITTER_ENABLE_3DL
enum enum : GLenum
{ {
WGL_STEREO_EMITTER_ENABLE_3DL = 0x2055, WGL_STEREO_EMITTER_ENABLE_3DL = 0x2055,
WGL_STEREO_EMITTER_DISABLE_3DL = 0x2056, WGL_STEREO_EMITTER_DISABLE_3DL = 0x2056,
@ -97,7 +99,7 @@ enum
// WGL_AMD_gpu_association // WGL_AMD_gpu_association
#ifndef WGL_GPU_VENDOR_AMD #ifndef WGL_GPU_VENDOR_AMD
enum enum : GLenum
{ {
WGL_GPU_VENDOR_AMD = 0x1F00, WGL_GPU_VENDOR_AMD = 0x1F00,
WGL_GPU_RENDERER_STRING_AMD = 0x1F01, WGL_GPU_RENDERER_STRING_AMD = 0x1F01,
@ -114,7 +116,7 @@ enum
// WGL_ARB_buffer_region // WGL_ARB_buffer_region
#ifndef WGL_FRONT_COLOR_BUFFER_BIT_ARB #ifndef WGL_FRONT_COLOR_BUFFER_BIT_ARB
enum enum : GLenum
{ {
WGL_FRONT_COLOR_BUFFER_BIT_ARB = 0x00000001, WGL_FRONT_COLOR_BUFFER_BIT_ARB = 0x00000001,
WGL_BACK_COLOR_BUFFER_BIT_ARB = 0x00000002, WGL_BACK_COLOR_BUFFER_BIT_ARB = 0x00000002,
@ -125,7 +127,7 @@ enum
// WGL_ARB_context_flush_control // WGL_ARB_context_flush_control
#ifndef WGL_CONTEXT_RELEASE_BEHAVIOR_ARB #ifndef WGL_CONTEXT_RELEASE_BEHAVIOR_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_RELEASE_BEHAVIOR_ARB = 0x2097, WGL_CONTEXT_RELEASE_BEHAVIOR_ARB = 0x2097,
WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB = 0, WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB = 0,
@ -135,7 +137,7 @@ enum
// WGL_ARB_create_context // WGL_ARB_create_context
#ifndef WGL_CONTEXT_DEBUG_BIT_ARB #ifndef WGL_CONTEXT_DEBUG_BIT_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_DEBUG_BIT_ARB = 0x00000001, WGL_CONTEXT_DEBUG_BIT_ARB = 0x00000001,
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x00000002, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x00000002,
@ -149,7 +151,7 @@ enum
// WGL_ARB_create_context_no_error // WGL_ARB_create_context_no_error
#ifndef WGL_CONTEXT_OPENGL_NO_ERROR_ARB #ifndef WGL_CONTEXT_OPENGL_NO_ERROR_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_OPENGL_NO_ERROR_ARB = 0x31B3, WGL_CONTEXT_OPENGL_NO_ERROR_ARB = 0x31B3,
}; };
@ -157,7 +159,7 @@ enum
// WGL_ARB_create_context_profile // WGL_ARB_create_context_profile
#ifndef WGL_CONTEXT_PROFILE_MASK_ARB #ifndef WGL_CONTEXT_PROFILE_MASK_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126, WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001, WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001,
@ -168,7 +170,7 @@ enum
// WGL_ARB_create_context_robustness // WGL_ARB_create_context_robustness
#ifndef WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB #ifndef WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004, WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004,
WGL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252, WGL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252,
@ -179,7 +181,7 @@ enum
// WGL_ARB_framebuffer_sRGB // WGL_ARB_framebuffer_sRGB
#ifndef WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB #ifndef WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB
enum enum : GLenum
{ {
WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20A9, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20A9,
}; };
@ -187,7 +189,7 @@ enum
// WGL_ARB_make_current_read // WGL_ARB_make_current_read
#ifndef ERROR_INVALID_PIXEL_TYPE_ARB #ifndef ERROR_INVALID_PIXEL_TYPE_ARB
enum enum : GLenum
{ {
ERROR_INVALID_PIXEL_TYPE_ARB = 0x2043, ERROR_INVALID_PIXEL_TYPE_ARB = 0x2043,
ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 0x2054, ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 0x2054,
@ -196,7 +198,7 @@ enum
// WGL_ARB_multisample // WGL_ARB_multisample
#ifndef WGL_SAMPLE_BUFFERS_ARB #ifndef WGL_SAMPLE_BUFFERS_ARB
enum enum : GLenum
{ {
WGL_SAMPLE_BUFFERS_ARB = 0x2041, WGL_SAMPLE_BUFFERS_ARB = 0x2041,
WGL_SAMPLES_ARB = 0x2042, WGL_SAMPLES_ARB = 0x2042,
@ -205,7 +207,7 @@ enum
// WGL_ARB_pbuffer // WGL_ARB_pbuffer
#ifndef WGL_DRAW_TO_PBUFFER_ARB #ifndef WGL_DRAW_TO_PBUFFER_ARB
enum enum : GLenum
{ {
WGL_DRAW_TO_PBUFFER_ARB = 0x202D, WGL_DRAW_TO_PBUFFER_ARB = 0x202D,
WGL_MAX_PBUFFER_PIXELS_ARB = 0x202E, WGL_MAX_PBUFFER_PIXELS_ARB = 0x202E,
@ -220,7 +222,7 @@ enum
// WGL_ARB_pixel_format // WGL_ARB_pixel_format
#ifndef WGL_NUMBER_PIXEL_FORMATS_ARB #ifndef WGL_NUMBER_PIXEL_FORMATS_ARB
enum enum : GLenum
{ {
WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000, WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000,
WGL_DRAW_TO_WINDOW_ARB = 0x2001, WGL_DRAW_TO_WINDOW_ARB = 0x2001,
@ -276,7 +278,7 @@ enum
// WGL_ARB_pixel_format_float // WGL_ARB_pixel_format_float
#ifndef WGL_TYPE_RGBA_FLOAT_ARB #ifndef WGL_TYPE_RGBA_FLOAT_ARB
enum enum : GLenum
{ {
WGL_TYPE_RGBA_FLOAT_ARB = 0x21A0, WGL_TYPE_RGBA_FLOAT_ARB = 0x21A0,
}; };
@ -284,7 +286,7 @@ enum
// WGL_ARB_render_texture // WGL_ARB_render_texture
#ifndef WGL_BIND_TO_TEXTURE_RGB_ARB #ifndef WGL_BIND_TO_TEXTURE_RGB_ARB
enum enum : GLenum
{ {
WGL_BIND_TO_TEXTURE_RGB_ARB = 0x2070, WGL_BIND_TO_TEXTURE_RGB_ARB = 0x2070,
WGL_BIND_TO_TEXTURE_RGBA_ARB = 0x2071, WGL_BIND_TO_TEXTURE_RGBA_ARB = 0x2071,
@ -324,7 +326,7 @@ enum
// WGL_ARB_robustness_application_isolation // WGL_ARB_robustness_application_isolation
#ifndef WGL_CONTEXT_RESET_ISOLATION_BIT_ARB #ifndef WGL_CONTEXT_RESET_ISOLATION_BIT_ARB
enum enum : GLenum
{ {
WGL_CONTEXT_RESET_ISOLATION_BIT_ARB = 0x00000008, WGL_CONTEXT_RESET_ISOLATION_BIT_ARB = 0x00000008,
}; };
@ -332,7 +334,7 @@ enum
// WGL_ATI_pixel_format_float // WGL_ATI_pixel_format_float
#ifndef WGL_TYPE_RGBA_FLOAT_ATI #ifndef WGL_TYPE_RGBA_FLOAT_ATI
enum enum : GLenum
{ {
WGL_TYPE_RGBA_FLOAT_ATI = 0x21A0, WGL_TYPE_RGBA_FLOAT_ATI = 0x21A0,
}; };
@ -340,7 +342,7 @@ enum
// WGL_ATI_render_texture_rectangle // WGL_ATI_render_texture_rectangle
#ifndef WGL_TEXTURE_RECTANGLE_ATI #ifndef WGL_TEXTURE_RECTANGLE_ATI
enum enum : GLenum
{ {
WGL_TEXTURE_RECTANGLE_ATI = 0x21A5, WGL_TEXTURE_RECTANGLE_ATI = 0x21A5,
}; };
@ -348,7 +350,7 @@ enum
// WGL_EXT_colorspace // WGL_EXT_colorspace
#ifndef WGL_COLORSPACE_EXT #ifndef WGL_COLORSPACE_EXT
enum enum : GLenum
{ {
WGL_COLORSPACE_EXT = 0x309D, WGL_COLORSPACE_EXT = 0x309D,
WGL_COLORSPACE_SRGB_EXT = 0x3089, WGL_COLORSPACE_SRGB_EXT = 0x3089,
@ -358,7 +360,7 @@ enum
// WGL_EXT_create_context_es_profile // WGL_EXT_create_context_es_profile
#ifndef WGL_CONTEXT_ES_PROFILE_BIT_EXT #ifndef WGL_CONTEXT_ES_PROFILE_BIT_EXT
enum enum : GLenum
{ {
WGL_CONTEXT_ES_PROFILE_BIT_EXT = 0x00000004, WGL_CONTEXT_ES_PROFILE_BIT_EXT = 0x00000004,
}; };
@ -366,7 +368,7 @@ enum
// WGL_EXT_create_context_es2_profile // WGL_EXT_create_context_es2_profile
#ifndef WGL_CONTEXT_ES2_PROFILE_BIT_EXT #ifndef WGL_CONTEXT_ES2_PROFILE_BIT_EXT
enum enum : GLenum
{ {
WGL_CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004, WGL_CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004,
}; };
@ -374,7 +376,7 @@ enum
// WGL_EXT_depth_float // WGL_EXT_depth_float
#ifndef WGL_DEPTH_FLOAT_EXT #ifndef WGL_DEPTH_FLOAT_EXT
enum enum : GLenum
{ {
WGL_DEPTH_FLOAT_EXT = 0x2040, WGL_DEPTH_FLOAT_EXT = 0x2040,
}; };
@ -382,7 +384,7 @@ enum
// WGL_EXT_framebuffer_sRGB // WGL_EXT_framebuffer_sRGB
#ifndef WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT #ifndef WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT
enum enum : GLenum
{ {
WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20A9, WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20A9,
}; };
@ -390,7 +392,7 @@ enum
// WGL_EXT_make_current_read // WGL_EXT_make_current_read
#ifndef ERROR_INVALID_PIXEL_TYPE_EXT #ifndef ERROR_INVALID_PIXEL_TYPE_EXT
enum enum : GLenum
{ {
ERROR_INVALID_PIXEL_TYPE_EXT = 0x2043, ERROR_INVALID_PIXEL_TYPE_EXT = 0x2043,
}; };
@ -398,7 +400,7 @@ enum
// WGL_EXT_multisample // WGL_EXT_multisample
#ifndef WGL_SAMPLE_BUFFERS_EXT #ifndef WGL_SAMPLE_BUFFERS_EXT
enum enum : GLenum
{ {
WGL_SAMPLE_BUFFERS_EXT = 0x2041, WGL_SAMPLE_BUFFERS_EXT = 0x2041,
WGL_SAMPLES_EXT = 0x2042, WGL_SAMPLES_EXT = 0x2042,
@ -407,7 +409,7 @@ enum
// WGL_EXT_pbuffer // WGL_EXT_pbuffer
#ifndef WGL_DRAW_TO_PBUFFER_EXT #ifndef WGL_DRAW_TO_PBUFFER_EXT
enum enum : GLenum
{ {
WGL_DRAW_TO_PBUFFER_EXT = 0x202D, WGL_DRAW_TO_PBUFFER_EXT = 0x202D,
WGL_MAX_PBUFFER_PIXELS_EXT = 0x202E, WGL_MAX_PBUFFER_PIXELS_EXT = 0x202E,
@ -423,7 +425,7 @@ enum
// WGL_EXT_pixel_format // WGL_EXT_pixel_format
#ifndef WGL_NUMBER_PIXEL_FORMATS_EXT #ifndef WGL_NUMBER_PIXEL_FORMATS_EXT
enum enum : GLenum
{ {
WGL_NUMBER_PIXEL_FORMATS_EXT = 0x2000, WGL_NUMBER_PIXEL_FORMATS_EXT = 0x2000,
WGL_DRAW_TO_WINDOW_EXT = 0x2001, WGL_DRAW_TO_WINDOW_EXT = 0x2001,
@ -475,7 +477,7 @@ enum
// WGL_EXT_pixel_format_packed_float // WGL_EXT_pixel_format_packed_float
#ifndef WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT #ifndef WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT
enum enum : GLenum
{ {
WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT = 0x20A8, WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT = 0x20A8,
}; };
@ -483,7 +485,7 @@ enum
// WGL_I3D_digital_video_control // WGL_I3D_digital_video_control
#ifndef WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D #ifndef WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D
enum enum : GLenum
{ {
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 0x2050, WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 0x2050,
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 0x2051, WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 0x2051,
@ -494,7 +496,7 @@ enum
// WGL_I3D_gamma // WGL_I3D_gamma
#ifndef WGL_GAMMA_TABLE_SIZE_I3D #ifndef WGL_GAMMA_TABLE_SIZE_I3D
enum enum : GLenum
{ {
WGL_GAMMA_TABLE_SIZE_I3D = 0x204E, WGL_GAMMA_TABLE_SIZE_I3D = 0x204E,
WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 0x204F, WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 0x204F,
@ -503,7 +505,7 @@ enum
// WGL_I3D_genlock // WGL_I3D_genlock
#ifndef WGL_GENLOCK_SOURCE_MULTIVIEW_I3D #ifndef WGL_GENLOCK_SOURCE_MULTIVIEW_I3D
enum enum : GLenum
{ {
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 0x2044, WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 0x2044,
WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = 0x2045, WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = 0x2045,
@ -519,7 +521,7 @@ enum
// WGL_I3D_image_buffer // WGL_I3D_image_buffer
#ifndef WGL_IMAGE_BUFFER_MIN_ACCESS_I3D #ifndef WGL_IMAGE_BUFFER_MIN_ACCESS_I3D
enum enum : GLenum
{ {
WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 0x00000001, WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 0x00000001,
WGL_IMAGE_BUFFER_LOCK_I3D = 0x00000002, WGL_IMAGE_BUFFER_LOCK_I3D = 0x00000002,
@ -528,7 +530,7 @@ enum
// WGL_NV_DX_interop // WGL_NV_DX_interop
#ifndef WGL_ACCESS_READ_ONLY_NV #ifndef WGL_ACCESS_READ_ONLY_NV
enum enum : GLenum
{ {
WGL_ACCESS_READ_ONLY_NV = 0x00000000, WGL_ACCESS_READ_ONLY_NV = 0x00000000,
WGL_ACCESS_READ_WRITE_NV = 0x00000001, WGL_ACCESS_READ_WRITE_NV = 0x00000001,
@ -538,7 +540,7 @@ enum
// WGL_NV_float_buffer // WGL_NV_float_buffer
#ifndef WGL_FLOAT_COMPONENTS_NV #ifndef WGL_FLOAT_COMPONENTS_NV
enum enum : GLenum
{ {
WGL_FLOAT_COMPONENTS_NV = 0x20B0, WGL_FLOAT_COMPONENTS_NV = 0x20B0,
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 0x20B1, WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 0x20B1,
@ -554,7 +556,7 @@ enum
// WGL_NV_gpu_affinity // WGL_NV_gpu_affinity
#ifndef ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV #ifndef ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV
enum enum : GLenum
{ {
ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 0x20D0, ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 0x20D0,
ERROR_MISSING_AFFINITY_MASK_NV = 0x20D1, ERROR_MISSING_AFFINITY_MASK_NV = 0x20D1,
@ -563,7 +565,7 @@ enum
// WGL_NV_multisample_coverage // WGL_NV_multisample_coverage
#ifndef WGL_COVERAGE_SAMPLES_NV #ifndef WGL_COVERAGE_SAMPLES_NV
enum enum : GLenum
{ {
WGL_COVERAGE_SAMPLES_NV = 0x2042, WGL_COVERAGE_SAMPLES_NV = 0x2042,
WGL_COLOR_SAMPLES_NV = 0x20B9, WGL_COLOR_SAMPLES_NV = 0x20B9,
@ -572,7 +574,7 @@ enum
// WGL_NV_present_video // WGL_NV_present_video
#ifndef WGL_NUM_VIDEO_SLOTS_NV #ifndef WGL_NUM_VIDEO_SLOTS_NV
enum enum : GLenum
{ {
WGL_NUM_VIDEO_SLOTS_NV = 0x20F0, WGL_NUM_VIDEO_SLOTS_NV = 0x20F0,
}; };
@ -580,7 +582,7 @@ enum
// WGL_NV_render_depth_texture // WGL_NV_render_depth_texture
#ifndef WGL_BIND_TO_TEXTURE_DEPTH_NV #ifndef WGL_BIND_TO_TEXTURE_DEPTH_NV
enum enum : GLenum
{ {
WGL_BIND_TO_TEXTURE_DEPTH_NV = 0x20A3, WGL_BIND_TO_TEXTURE_DEPTH_NV = 0x20A3,
WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4, WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4,
@ -592,7 +594,7 @@ enum
// WGL_NV_render_texture_rectangle // WGL_NV_render_texture_rectangle
#ifndef WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV #ifndef WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV
enum enum : GLenum
{ {
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0, WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0,
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1, WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1,
@ -602,7 +604,7 @@ enum
// WGL_NV_video_capture // WGL_NV_video_capture
#ifndef WGL_UNIQUE_ID_NV #ifndef WGL_UNIQUE_ID_NV
enum enum : GLenum
{ {
WGL_UNIQUE_ID_NV = 0x20CE, WGL_UNIQUE_ID_NV = 0x20CE,
WGL_NUM_VIDEO_CAPTURE_SLOTS_NV = 0x20CF, WGL_NUM_VIDEO_CAPTURE_SLOTS_NV = 0x20CF,
@ -611,7 +613,7 @@ enum
// WGL_NV_video_output // WGL_NV_video_output
#ifndef WGL_BIND_TO_VIDEO_RGB_NV #ifndef WGL_BIND_TO_VIDEO_RGB_NV
enum enum : GLenum
{ {
WGL_BIND_TO_VIDEO_RGB_NV = 0x20C0, WGL_BIND_TO_VIDEO_RGB_NV = 0x20C0,
WGL_BIND_TO_VIDEO_RGBA_NV = 0x20C1, WGL_BIND_TO_VIDEO_RGBA_NV = 0x20C1,
@ -631,7 +633,7 @@ enum
// WGL_NV_multigpu_context // WGL_NV_multigpu_context
#ifndef WGL_CONTEXT_MULTIGPU_ATTRIB_NV #ifndef WGL_CONTEXT_MULTIGPU_ATTRIB_NV
enum enum : GLenum
{ {
WGL_CONTEXT_MULTIGPU_ATTRIB_NV = 0x20AA, WGL_CONTEXT_MULTIGPU_ATTRIB_NV = 0x20AA,
WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV = 0x20AB, WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV = 0x20AB,

View file

@ -76,7 +76,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
{ {
ComSmartPtr<IAMStreamConfig> streamConfig; ComSmartPtr<IAMStreamConfig> streamConfig;
hr = captureGraphBuilder->FindInterface (&PIN_CATEGORY_CAPTURE, 0, filter, hr = captureGraphBuilder->FindInterface (&PIN_CATEGORY_CAPTURE, nullptr, filter,
IID_IAMStreamConfig, (void**) streamConfig.resetAndGetPointerAddress()); IID_IAMStreamConfig, (void**) streamConfig.resetAndGetPointerAddress());
if (streamConfig != nullptr) if (streamConfig != nullptr)
@ -140,7 +140,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
AM_MEDIA_TYPE mt = {}; AM_MEDIA_TYPE mt = {};
hr = sampleGrabber->GetConnectedMediaType (&mt); hr = sampleGrabber->GetConnectedMediaType (&mt);
if (auto* pVih = (VIDEOINFOHEADER*) (mt.pbFormat)) if (auto* pVih = unalignedPointerCast<VIDEOINFOHEADER*> (mt.pbFormat))
{ {
width = pVih->bmiHeader.biWidth; width = pVih->bmiHeader.biWidth;
height = pVih->bmiHeader.biHeight; height = pVih->bmiHeader.biHeight;
@ -316,7 +316,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
for (int i = 0; i < height; ++i) for (int i = 0; i < height; ++i)
memcpy (destData.getLinePointer ((height - 1) - i), memcpy (destData.getLinePointer ((height - 1) - i),
buffer + lineStride * i, buffer + lineStride * i,
lineStride); (size_t) lineStride);
} }
imageNeedsFlipping = true; imageNeedsFlipping = true;
@ -366,7 +366,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
{ {
if (auto fileSink = asfWriter.getInterface<IFileSinkFilter>()) if (auto fileSink = asfWriter.getInterface<IFileSinkFilter>())
{ {
hr = fileSink->SetFileName (file.getFullPathName().toWideCharPointer(), 0); hr = fileSink->SetFileName (file.getFullPathName().toWideCharPointer(), nullptr);
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
{ {
@ -402,7 +402,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
const int fps[] = { 10, 15, 30 }; const int fps[] = { 10, 15, 30 };
int maxFramesPerSecond = fps[jlimit (0, numElementsInArray (fps) - 1, quality & 0xff)]; int maxFramesPerSecond = fps[jlimit (0, numElementsInArray (fps) - 1, quality & 0xff)];
if ((quality & 0xff000000) != 0) // (internal hacky way to pass explicit frame rates for testing) if (((uint32_t) quality & 0xff000000) != 0) // (internal hacky way to pass explicit frame rates for testing)
maxFramesPerSecond = (quality >> 24) & 0xff; maxFramesPerSecond = (quality >> 24) & 0xff;
prof = prof.replace ("$WIDTH", String (width)) prof = prof.replace ("$WIDTH", String (width))
@ -495,19 +495,19 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
}(); }();
ComSmartPtr<IBaseFilter> captureFilter; ComSmartPtr<IBaseFilter> captureFilter;
hr = moniker->BindToObject (context.get(), 0, IID_IBaseFilter, (void**) captureFilter.resetAndGetPointerAddress()); hr = moniker->BindToObject (context.get(), nullptr, IID_IBaseFilter, (void**) captureFilter.resetAndGetPointerAddress());
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
{ {
ComSmartPtr<IPropertyBag> propertyBag; ComSmartPtr<IPropertyBag> propertyBag;
hr = moniker->BindToStorage (context.get(), 0, IID_IPropertyBag, (void**) propertyBag.resetAndGetPointerAddress()); hr = moniker->BindToStorage (context.get(), nullptr, IID_IPropertyBag, (void**) propertyBag.resetAndGetPointerAddress());
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
{ {
VARIANT var; VARIANT var;
var.vt = VT_BSTR; var.vt = VT_BSTR;
hr = propertyBag->Read (_T("FriendlyName"), &var, 0); hr = propertyBag->Read (_T("FriendlyName"), &var, nullptr);
propertyBag = nullptr; propertyBag = nullptr;
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
@ -699,7 +699,7 @@ private:
filter->EnumPins (enumerator.resetAndGetPointerAddress()); filter->EnumPins (enumerator.resetAndGetPointerAddress());
while (enumerator->Next (1, pin.resetAndGetPointerAddress(), 0) == S_OK) while (enumerator->Next (1, pin.resetAndGetPointerAddress(), nullptr) == S_OK)
{ {
PIN_DIRECTION dir; PIN_DIRECTION dir;
pin->QueryDirection (&dir); pin->QueryDirection (&dir);
@ -783,7 +783,7 @@ struct CameraDevice::ViewerComponent : public Component,
setSize (owner->width, owner->height); setSize (owner->width, owner->height);
} }
~ViewerComponent() ~ViewerComponent() override
{ {
if (owner != nullptr) if (owner != nullptr)
{ {

View file

@ -155,7 +155,7 @@ namespace VideoRenderers
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EVR) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EVR)
}; };
}; }
//============================================================================== //==============================================================================
struct VideoComponent::Pimpl : public Component struct VideoComponent::Pimpl : public Component
@ -172,7 +172,7 @@ struct VideoComponent::Pimpl : public Component
componentWatcher.reset (new ComponentWatcher (*this)); componentWatcher.reset (new ComponentWatcher (*this));
} }
~Pimpl() ~Pimpl() override
{ {
close(); close();
context = nullptr; context = nullptr;
@ -394,10 +394,10 @@ private:
{ {
DirectShowContext (Pimpl& c) : component (c) DirectShowContext (Pimpl& c) : component (c)
{ {
ignoreUnused (CoInitialize (0)); ignoreUnused (CoInitialize (nullptr));
} }
~DirectShowContext() ~DirectShowContext() override
{ {
release(); release();
CoUninitialize(); CoUninitialize();
@ -454,7 +454,7 @@ private:
void handleAsyncUpdate() override void handleAsyncUpdate() override
{ {
if (hwnd != 0) if (hwnd != nullptr)
{ {
if (needToRecreateNativeWindow) if (needToRecreateNativeWindow)
{ {
@ -606,7 +606,7 @@ private:
mediaEvent->SetNotifyWindow (0, 0, 0); mediaEvent->SetNotifyWindow (0, 0, 0);
if (videoRenderer != nullptr) if (videoRenderer != nullptr)
videoRenderer->setVideoWindow (0); videoRenderer->setVideoWindow (nullptr);
hasVideo = false; hasVideo = false;
videoRenderer = nullptr; videoRenderer = nullptr;
@ -736,7 +736,7 @@ private:
{ {
long volume; long volume;
basicAudio->get_Volume (&volume); basicAudio->get_Volume (&volume);
return (volume + 10000) / 10000.0f; return (float) (volume + 10000) / 10000.0f;
} }
enum State { uninitializedState, runningState, pausedState, stoppedState }; enum State { uninitializedState, runningState, pausedState, stoppedState };
@ -776,7 +776,7 @@ private:
topLevelPeer->addScaleFactorListener (&component); topLevelPeer->addScaleFactorListener (&component);
#endif #endif
if (hwnd != 0) if (hwnd != nullptr)
{ {
hdc = GetDC (hwnd); hdc = GetDC (hwnd);
component.updateContextPosition(); component.updateContextPosition();
@ -911,22 +911,22 @@ private:
DWORD type = WS_CHILD; DWORD type = WS_CHILD;
hwnd = CreateWindowEx (exstyle, wc->getWindowClassName(), hwnd = CreateWindowEx (exstyle, wc->getWindowClassName(),
L"", type, 0, 0, 0, 0, parentToAddTo, 0, L"", type, 0, 0, 0, 0, parentToAddTo, nullptr,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(), 0); (HINSTANCE) Process::getCurrentModuleInstanceHandle(), nullptr);
if (hwnd != 0) if (hwnd != nullptr)
{ {
hdc = GetDC (hwnd); hdc = GetDC (hwnd);
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) userData); SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) userData);
} }
} }
jassert (hwnd != 0); jassert (hwnd != nullptr);
} }
~NativeWindow() ~NativeWindow()
{ {
if (hwnd != 0) if (hwnd != nullptr)
{ {
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) 0); SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) 0);
DestroyWindow (hwnd); DestroyWindow (hwnd);
@ -935,7 +935,7 @@ private:
void setWindowPosition (Rectangle<int> newBounds) void setWindowPosition (Rectangle<int> newBounds)
{ {
SetWindowPos (hwnd, 0, newBounds.getX(), newBounds.getY(), SetWindowPos (hwnd, nullptr, newBounds.getX(), newBounds.getY(),
newBounds.getWidth(), newBounds.getHeight(), newBounds.getWidth(), newBounds.getHeight(),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER);
} }