Browse Source

ClangCl: Silence code which warns when building on Windows with Clang

tags/2021-05-28
reuk 5 years ago
parent
commit
e13901d912
20 changed files with 66 additions and 52 deletions
  1. +3
    -3
      modules/juce_audio_devices/native/juce_win32_DirectSound.cpp
  2. +3
    -3
      modules/juce_audio_devices/native/juce_win32_Midi.cpp
  3. +1
    -0
      modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
  4. +6
    -2
      modules/juce_audio_processors/juce_audio_processors.cpp
  5. +3
    -3
      modules/juce_core/native/juce_win32_Files.cpp
  6. +8
    -8
      modules/juce_core/native/juce_win32_Network.cpp
  7. +2
    -2
      modules/juce_core/native/juce_win32_SystemStats.cpp
  8. +2
    -2
      modules/juce_core/native/juce_win32_Threads.cpp
  9. +9
    -9
      modules/juce_core/network/juce_Socket.cpp
  10. +5
    -0
      modules/juce_core/text/juce_String.cpp
  11. +1
    -1
      modules/juce_core/threads/juce_Thread.cpp
  12. +1
    -1
      modules/juce_events/native/juce_win32_HiddenMessageWindow.h
  13. +1
    -0
      modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
  14. +1
    -0
      modules/juce_graphics/image_formats/juce_PNGLoader.cpp
  15. +6
    -6
      modules/juce_graphics/native/juce_win32_Fonts.cpp
  16. +2
    -2
      modules/juce_gui_basics/native/juce_win32_FileChooser.cpp
  17. +5
    -5
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  18. +2
    -0
      modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp
  19. +3
    -3
      modules/juce_video/native/juce_win32_CameraDevice.h
  20. +2
    -2
      modules/juce_video/native/juce_win32_Video.h

+ 3
- 3
modules/juce_audio_devices/native/juce_win32_DirectSound.cpp View File

@@ -291,7 +291,7 @@ public:
{
IDirectSoundBuffer* pPrimaryBuffer;
DSBUFFERDESC primaryDesc = { 0 };
DSBUFFERDESC primaryDesc = {};
primaryDesc.dwSize = sizeof (DSBUFFERDESC);
primaryDesc.dwFlags = 1 /* DSBCAPS_PRIMARYBUFFER */;
primaryDesc.dwBufferBytes = 0;
@@ -317,7 +317,7 @@ public:
if (SUCCEEDED (hr))
{
DSBUFFERDESC secondaryDesc = { 0 };
DSBUFFERDESC secondaryDesc = {};
secondaryDesc.dwSize = sizeof (DSBUFFERDESC);
secondaryDesc.dwFlags = 0x8000 /* DSBCAPS_GLOBALFOCUS */
| 0x10000 /* DSBCAPS_GETCURRENTPOSITION2 */;
@@ -598,7 +598,7 @@ public:
wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign;
wfFormat.cbSize = 0;
DSCBUFFERDESC captureDesc = { 0 };
DSCBUFFERDESC captureDesc = {};
captureDesc.dwSize = sizeof (DSCBUFFERDESC);
captureDesc.dwFlags = 0;
captureDesc.dwBufferBytes = (DWORD) totalBytesPerBuffer;


+ 3
- 3
modules/juce_audio_devices/native/juce_win32_Midi.cpp View File

@@ -450,7 +450,7 @@ private:
for (UINT i = 0; i < midiInGetNumDevs(); ++i)
{
MIDIINCAPS mc = { 0 };
MIDIINCAPS mc = {};
if (midiInGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
devices.add (mc);
@@ -574,7 +574,7 @@ private:
{
if (message.getRawDataSize() > 3 || message.isSysEx())
{
MIDIHDR h = { 0 };
MIDIHDR h = {};
h.lpData = (char*) message.getRawData();
h.dwBytesRecorded = h.dwBufferLength = (DWORD) message.getRawDataSize();
@@ -625,7 +625,7 @@ private:
for (UINT i = 0; i < midiOutGetNumDevs(); ++i)
{
MIDIOUTCAPS mc = { 0 };
MIDIOUTCAPS mc = {};
if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
devices.add (mc);


+ 1
- 0
modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp View File

@@ -34,6 +34,7 @@ namespace OggVorbisNamespace
"-Wshadow",
"-Wfloat-conversion",
"-Wdeprecated-register",
"-Wdeprecated-declarations",
"-Wswitch-enum",
"-Wzero-as-null-pointer-constant",
"-Wsign-conversion",


+ 6
- 2
modules/juce_audio_processors/juce_audio_processors.cpp View File

@@ -60,8 +60,10 @@
namespace juce
{
static inline bool arrayContainsPlugin (const OwnedArray<PluginDescription>& list,
const PluginDescription& desc)
#if JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_LADSPA
static bool arrayContainsPlugin (const OwnedArray<PluginDescription>& list,
const PluginDescription& desc)
{
for (auto* p : list)
if (p->isDuplicateOf (desc))
@@ -70,6 +72,8 @@ static inline bool arrayContainsPlugin (const OwnedArray<PluginDescription>& lis
return false;
}
#endif
#if JUCE_MAC || JUCE_IOS
#if JUCE_IOS


+ 3
- 3
modules/juce_core/native/juce_win32_Files.cpp View File

@@ -147,7 +147,7 @@ namespace WindowsFileHelpers
Result getResultForLastError()
{
TCHAR messageBuffer[256] = { 0 };
TCHAR messageBuffer[256] = {};
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, GetLastError(), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
@@ -239,7 +239,7 @@ bool File::moveToTrash() const
doubleNullTermPath.calloc (numBytes, 1);
fullPath.copyToUTF16 (doubleNullTermPath, numBytes);
SHFILEOPSTRUCT fos = { 0 };
SHFILEOPSTRUCT fos = {};
fos.wFunc = FO_DELETE;
fos.pFrom = doubleNullTermPath;
fos.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION
@@ -486,7 +486,7 @@ bool File::setFileTimesInternal (int64 modificationTime, int64 accessTime, int64
//==============================================================================
void File::findFileSystemRoots (Array<File>& destArray)
{
TCHAR buffer[2048] = { 0 };
TCHAR buffer[2048] = {};
GetLogicalDriveStrings (2048, buffer);
const TCHAR* n = buffer;


+ 8
- 8
modules/juce_core/native/juce_win32_Network.cpp View File

@@ -277,7 +277,7 @@ private:
HeapBlock<TCHAR> file (fileNumChars), server (serverNumChars),
username (usernameNumChars), password (passwordNumChars);
URL_COMPONENTS uc = { 0 };
URL_COMPONENTS uc = {};
uc.dwStructSize = sizeof (uc);
uc.lpszUrlPath = file;
uc.dwUrlPathLength = fileNumChars;
@@ -393,7 +393,7 @@ private:
if (request != 0)
{
INTERNET_BUFFERS buffers = { 0 };
INTERNET_BUFFERS buffers = {};
buffers.dwStructSize = sizeof (INTERNET_BUFFERS);
buffers.lpcszHeader = headers.toWideCharPointer();
buffers.dwHeadersLength = (DWORD) headers.length();
@@ -478,10 +478,10 @@ namespace MACAddressHelpers
if (NetbiosCall != 0)
{
LANA_ENUM enums = { 0 };
LANA_ENUM enums = {};
{
NCB ncb = { 0 };
NCB ncb = {};
ncb.ncb_command = NCBENUM;
ncb.ncb_buffer = (unsigned char*) &enums;
ncb.ncb_length = sizeof (LANA_ENUM);
@@ -490,13 +490,13 @@ namespace MACAddressHelpers
for (int i = 0; i < enums.length; ++i)
{
NCB ncb2 = { 0 };
NCB ncb2 = {};
ncb2.ncb_command = NCBRESET;
ncb2.ncb_lana_num = enums.lana[i];
if (NetbiosCall (&ncb2) == 0)
{
NCB ncb = { 0 };
NCB ncb = {};
memcpy (ncb.ncb_callname, "* ", NCBNAMSZ);
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = enums.lana[i];
@@ -608,11 +608,11 @@ bool JUCE_CALLTYPE Process::openEmailWithAttachments (const String& targetEmailA
if (mapiSendMail == nullptr)
return false;
MapiMessage message = { 0 };
MapiMessage message = {};
message.lpszSubject = (LPSTR) emailSubject.toRawUTF8();
message.lpszNoteText = (LPSTR) bodyText.toRawUTF8();
MapiRecipDesc recip = { 0 };
MapiRecipDesc recip = {};
recip.ulRecipClass = MAPI_TO;
String targetEmailAddress_ (targetEmailAddress);
if (targetEmailAddress_.isEmpty())


+ 2
- 2
modules/juce_core/native/juce_win32_SystemStats.cpp View File

@@ -215,7 +215,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
#else
RTL_OSVERSIONINFOW getWindowsVersionInfo()
{
RTL_OSVERSIONINFOW versionInfo = { 0 };
RTL_OSVERSIONINFOW versionInfo = {};
if (auto* moduleHandle = ::GetModuleHandleW (L"ntdll.dll"))
{
@@ -227,7 +227,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
LONG STATUS_SUCCESS = 0;
if (rtlGetVersion (&versionInfo) != STATUS_SUCCESS)
versionInfo = { 0 };
versionInfo = {};
}
}


+ 2
- 2
modules/juce_core/native/juce_win32_Threads.cpp View File

@@ -390,14 +390,14 @@ public:
ActiveProcess (const String& command, int streamFlags)
: ok (false), readPipe (0), writePipe (0)
{
SECURITY_ATTRIBUTES securityAtts = { 0 };
SECURITY_ATTRIBUTES securityAtts = {};
securityAtts.nLength = sizeof (securityAtts);
securityAtts.bInheritHandle = TRUE;
if (CreatePipe (&readPipe, &writePipe, &securityAtts, 0)
&& SetHandleInformation (readPipe, HANDLE_FLAG_INHERIT, 0))
{
STARTUPINFOW startupInfo = { 0 };
STARTUPINFOW startupInfo = {};
startupInfo.cb = sizeof (startupInfo);
startupInfo.hStdOutput = (streamFlags & wantStdOut) != 0 ? writePipe : 0;


+ 9
- 9
modules/juce_core/network/juce_Socket.cpp View File

@@ -284,7 +284,7 @@ namespace SocketHelpers
{
auto h = handle.load();
if (h == invalidSocket)
if (static_cast<SocketHandle> (h) == invalidSocket)
return true;
int opt;
@@ -315,9 +315,9 @@ namespace SocketHelpers
fd_set rset, wset;
FD_ZERO (&rset);
FD_SET (h, &rset);
FD_SET (static_cast<SocketHandle> (h), &rset);
FD_ZERO (&wset);
FD_SET (h, &wset);
FD_SET (static_cast<SocketHandle> (h), &wset);
fd_set* prset = forReading ? &rset : nullptr;
fd_set* pwset = forReading ? nullptr : &wset;
@@ -813,7 +813,7 @@ struct SocketTests : public UnitTest
expect (socketServer.isConnected() == false);
expect (socketServer.getHostName().isEmpty());
expect (socketServer.getBoundPort() == -1);
expect (socketServer.getRawSocketHandle() == invalidSocket);
expect (static_cast<SocketHandle> (socketServer.getRawSocketHandle()) == invalidSocket);
expect (socketServer.createListener (portNum, localHost.toString()));
@@ -824,14 +824,14 @@ struct SocketTests : public UnitTest
expect (socket.isConnected() == true);
expect (socket.getHostName() == localHost.toString());
expect (socket.getBoundPort() != -1);
expect (socket.getRawSocketHandle() != invalidSocket);
expect (static_cast<SocketHandle> (socket.getRawSocketHandle()) != invalidSocket);
socket.close();
expect (socket.isConnected() == false);
expect (socket.getHostName().isEmpty());
expect (socket.getBoundPort() == -1);
expect (socket.getRawSocketHandle() == invalidSocket);
expect (static_cast<SocketHandle> (socket.getRawSocketHandle()) == invalidSocket);
}
beginTest ("DatagramSocket");
@@ -839,17 +839,17 @@ struct SocketTests : public UnitTest
DatagramSocket socket;
expect (socket.getBoundPort() == -1);
expect (socket.getRawSocketHandle() != invalidSocket);
expect (static_cast<SocketHandle> (socket.getRawSocketHandle()) != invalidSocket);
expect (socket.bindToPort (portNum, localHost.toString()));
expect (socket.getBoundPort() == portNum);
expect (socket.getRawSocketHandle() != invalidSocket);
expect (static_cast<SocketHandle> (socket.getRawSocketHandle()) != invalidSocket);
socket.shutdown();
expect (socket.getBoundPort() == -1);
expect (socket.getRawSocketHandle() == invalidSocket);
expect (static_cast<SocketHandle> (socket.getRawSocketHandle()) == invalidSocket);
}
}
};


+ 5
- 0
modules/juce_core/text/juce_String.cpp View File

@@ -1847,11 +1847,16 @@ String String::formattedRaw (const char* pf, ...)
HeapBlock<wchar_t> temp (bufferSize);
const int num = (int)
#if JUCE_WINDOWS
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
_vsnwprintf
#else
vswprintf
#endif
(temp.get(), bufferSize - 1, wideCharVersion.toWideCharPointer(), args);
#if JUCE_WINDOWS
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif
#endif
va_end (args);


+ 1
- 1
modules/juce_core/threads/juce_Thread.cpp View File

@@ -373,7 +373,7 @@ public:
expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211);
expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211);
expect (ByteOrder::swap ((uint64) 0x1122334455667788ULL) == 0x8877665544332211LL);
expect (ByteOrder::swap ((uint64) 0x1122334455667788ULL) == (uint64) 0x8877665544332211LL);
beginTest ("Atomic int");
AtomicTester <int>::testInteger (*this);


+ 1
- 1
modules/juce_events/native/juce_win32_HiddenMessageWindow.h View File

@@ -34,7 +34,7 @@ public:
HMODULE moduleHandle = (HMODULE) Process::getCurrentModuleInstanceHandle();
WNDCLASSEX wc = { 0 };
WNDCLASSEX wc = {};
wc.cbSize = sizeof (wc);
wc.lpfnWndProc = wndProc;
wc.cbWndExtra = 4;


+ 1
- 0
modules/juce_graphics/image_formats/juce_JPEGLoader.cpp View File

@@ -30,6 +30,7 @@ namespace jpeglibNamespace
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wconversion",
"-Wdeprecated-register",
"-Wdeprecated-declarations",
"-Wsign-conversion",
"-Wcast-align",
"-Wswitch-enum",


+ 1
- 0
modules/juce_graphics/image_formats/juce_PNGLoader.cpp View File

@@ -51,6 +51,7 @@ namespace pnglibNamespace
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wsign-conversion",
"-Wimplicit-fallthrough",
"-Wtautological-constant-out-of-range-compare",
"-Wzero-as-null-pointer-constant",
"-Wcomma")


+ 6
- 6
modules/juce_graphics/native/juce_win32_Fonts.cpp View File

@@ -89,12 +89,12 @@ namespace TTFNameExtractor
{
input.setPosition (directoryOffset);
NamingTable namingTable = { 0 };
NamingTable namingTable = {};
input.read (&namingTable, sizeof (namingTable));
for (int i = 0; i < (int) ByteOrder::swapIfLittleEndian (namingTable.numberOfNameRecords); ++i)
{
NameRecord nameRecord = { 0 };
NameRecord nameRecord = {};
input.read (&nameRecord, sizeof (nameRecord));
if (ByteOrder::swapIfLittleEndian (nameRecord.nameID) == 4)
@@ -112,7 +112,7 @@ namespace TTFNameExtractor
static String getTypefaceNameFromFile (MemoryInputStream& input)
{
OffsetTable offsetTable = { 0 };
OffsetTable offsetTable = {};
input.read (&offsetTable, sizeof (offsetTable));
for (int i = 0; i < (int) ByteOrder::swapIfLittleEndian (offsetTable.numTables); ++i)
@@ -146,7 +146,7 @@ namespace FontEnumerators
{
if (lpelfe != nullptr && (type & RASTER_FONTTYPE) == 0)
{
LOGFONTW lf = { 0 };
LOGFONTW lf = {};
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
@@ -193,7 +193,7 @@ StringArray Font::findAllTypefaceNames()
auto dc = CreateCompatibleDC (0);
{
LOGFONTW lf = { 0 };
LOGFONTW lf = {};
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
@@ -473,7 +473,7 @@ private:
SetMapperFlags (dc, 0);
SetMapMode (dc, MM_TEXT);
LOGFONTW lf = { 0 };
LOGFONTW lf = {};
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;


+ 2
- 2
modules/juce_gui_basics/native/juce_win32_FileChooser.cpp View File

@@ -168,7 +168,7 @@ private:
if (selectsDirectories)
{
BROWSEINFO bi = { 0 };
BROWSEINFO bi = {};
bi.hwndOwner = (HWND) (async ? nullptr : owner->getWindowHandle());
bi.pszDisplayName = files;
bi.lpszTitle = title.toWideCharPointer();
@@ -205,7 +205,7 @@ private:
}
else
{
OPENFILENAMEW of = { 0 };
OPENFILENAMEW of = {};
#ifdef OPENFILENAME_SIZE_VERSION_400W
of.lStructSize = OPENFILENAME_SIZE_VERSION_400W;


+ 5
- 5
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -940,7 +940,7 @@ namespace IconConverters
{
if (auto* dc = ::CreateCompatibleDC (tempDC))
{
BITMAPV5HEADER header = { 0 };
BITMAPV5HEADER header = {};
header.bV5Size = sizeof (BITMAPV5HEADER);
header.bV5Width = bm.bmWidth;
header.bV5Height = -bm.bmHeight;
@@ -1970,11 +1970,11 @@ private:
auto moduleHandle = (HINSTANCE) Process::getCurrentModuleInstanceHandle();
TCHAR moduleFile[1024] = { 0 };
TCHAR moduleFile[1024] = {};
GetModuleFileName (moduleHandle, moduleFile, 1024);
WORD iconNum = 0;
WNDCLASSEX wcex = { 0 };
WNDCLASSEX wcex = {};
wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) windowProc;
@@ -4361,7 +4361,7 @@ public:
{
if (Process::isForegroundProcess())
{
INPUT input = { 0 };
INPUT input = {};
input.type = INPUT_MOUSE;
input.mi.mouseData = MOUSEEVENTF_MOVE;
@@ -4516,7 +4516,7 @@ struct MonitorInfo
static BOOL CALLBACK enumMonitorsProc (HMONITOR hm, HDC, LPRECT r, LPARAM userInfo)
{
MONITORINFO info = { 0 };
MONITORINFO info = {};
info.cbSize = sizeof (info);
GetMonitorInfo (hm, &info);


+ 2
- 0
modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp View File

@@ -211,6 +211,8 @@ public:
}
}
using ActiveXControlComponent::focusGained;
void setWebViewSize (int width, int height) override
{
setSize (width, height);


+ 3
- 3
modules/juce_video/native/juce_win32_CameraDevice.h View File

@@ -106,7 +106,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
return;
{
AM_MEDIA_TYPE mt = { 0 };
AM_MEDIA_TYPE mt = {};
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB24;
mt.formattype = FORMAT_VideoInfo;
@@ -130,7 +130,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (FAILED (hr))
return;
AM_MEDIA_TYPE mt = { 0 };
AM_MEDIA_TYPE mt = {};
hr = sampleGrabber->GetConnectedMediaType (&mt);
VIDEOINFOHEADER* pVih = (VIDEOINFOHEADER*) (mt.pbFormat);
width = pVih->bmiHeader.biWidth;
@@ -687,7 +687,7 @@ private:
if (wantedDirection == dir)
{
PIN_INFO info = { 0 };
PIN_INFO info = {};
pin->QueryPinInfo (&info);
if (pinName == nullptr || String (pinName).equalsIgnoreCase (String (info.achName)))


+ 2
- 2
modules/juce_video/native/juce_win32_Video.h View File

@@ -847,10 +847,10 @@ private:
HINSTANCE moduleHandle = (HINSTANCE) Process::getCurrentModuleInstanceHandle();
TCHAR moduleFile [1024] = { 0 };
TCHAR moduleFile [1024] = {};
GetModuleFileName (moduleHandle, moduleFile, 1024);
WNDCLASSEX wcex = { 0 };
WNDCLASSEX wcex = {};
wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) wndProc;


Loading…
Cancel
Save