diff --git a/src/audio/dsp/juce_AudioDataConverters.cpp b/src/audio/dsp/juce_AudioDataConverters.cpp index 7d8d8f36dc..9f7d348302 100644 --- a/src/audio/dsp/juce_AudioDataConverters.cpp +++ b/src/audio/dsp/juce_AudioDataConverters.cpp @@ -584,7 +584,7 @@ public: conv = new AudioData::ConverterInstance , AudioData::Pointer >(); if (! inPlace) - zerostruct (reversed); + zeromem (reversed, sizeof (reversed)); conv->convertSamples (reversed, inPlace ? reversed : converted, numSamples); diff --git a/src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm b/src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm index da89dfdd57..3071a919d0 100644 --- a/src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm +++ b/src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm @@ -570,8 +570,7 @@ void AudioUnitPluginInstance::setPluginCallbacks() if (audioUnit != 0) { { - AURenderCallbackStruct info; - zerostruct (info); + AURenderCallbackStruct info = { 0 }; info.inputProcRefCon = this; info.inputProc = renderGetInputCallback; @@ -580,8 +579,7 @@ void AudioUnitPluginInstance::setPluginCallbacks() } { - HostCallbackInfo info; - zerostruct (info); + HostCallbackInfo info = { 0 }; info.hostUserData = this; info.beatAndTempoProc = getBeatAndTempoCallback; info.musicalTimeLocationProc = getMusicalTimeLocationCallback; @@ -630,8 +628,7 @@ void AudioUnitPluginInstance::prepareToPlay (double sampleRate_, AudioUnitReset (audioUnit, kAudioUnitScope_Global, 0); { - AudioStreamBasicDescription stream; - zerostruct (stream); + AudioStreamBasicDescription stream = { 0 }; stream.mSampleRate = sampleRate_; stream.mFormatID = kAudioFormatLinearPCM; stream.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved; @@ -1230,8 +1227,7 @@ void AudioUnitPluginInstance::setParameter (int index, float newValue) const String AudioUnitPluginInstance::getParameterName (int index) { - AudioUnitParameterInfo info; - zerostruct (info); + AudioUnitParameterInfo info = { 0 }; UInt32 sz = sizeof (info); String name; @@ -1503,12 +1499,10 @@ const StringArray AudioUnitPluginFormat::searchPathsForPlugins (const FileSearch { StringArray result; ComponentRecord* comp = 0; - ComponentDescription desc; - zerostruct (desc); for (;;) { - zerostruct (desc); + ComponentDescription desc = { 0 }; comp = FindNextComponent (comp, &desc); if (comp == 0) diff --git a/src/audio/plugins/formats/juce_VSTPluginFormat.cpp b/src/audio/plugins/formats/juce_VSTPluginFormat.cpp index bdfddfa374..3570487aa9 100644 --- a/src/audio/plugins/formats/juce_VSTPluginFormat.cpp +++ b/src/audio/plugins/formats/juce_VSTPluginFormat.cpp @@ -1267,8 +1267,7 @@ public: { const Rectangle clip (g.getClipBounds()); - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xexpose.type = Expose; ev.xexpose.display = display; ev.xexpose.window = pluginWindow; @@ -1325,8 +1324,7 @@ public: toFront (true); - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xbutton.display = display; ev.xbutton.type = ButtonPress; ev.xbutton.window = pluginWindow; @@ -1646,8 +1644,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xcrossing.display = display; ev.xcrossing.type = EnterNotify; ev.xcrossing.window = pluginWindow; @@ -1670,8 +1667,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xcrossing.display = display; ev.xcrossing.type = LeaveNotify; ev.xcrossing.window = pluginWindow; @@ -1695,8 +1691,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xmotion.display = display; ev.xmotion.type = MotionNotify; ev.xmotion.window = pluginWindow; @@ -1716,8 +1711,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xmotion.display = display; ev.xmotion.type = MotionNotify; ev.xmotion.window = pluginWindow; @@ -1738,8 +1732,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xbutton.display = display; ev.xbutton.type = ButtonRelease; ev.xbutton.window = pluginWindow; @@ -1761,8 +1754,7 @@ private: { if (pluginWindow != 0) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xbutton.display = display; ev.xbutton.type = ButtonPress; ev.xbutton.window = pluginWindow; diff --git a/src/core/juce_Time.cpp b/src/core/juce_Time.cpp index 1c700dd112..5e5adccdc9 100644 --- a/src/core/juce_Time.cpp +++ b/src/core/juce_Time.cpp @@ -97,7 +97,7 @@ namespace TimeHelpers if (now >= 0 && now <= 0x793406fff) localtime_s (&result, &now); else - zeromem (&result, sizeof (result)); + zerostruct (result); #else result = *localtime (&now); #endif diff --git a/src/io/network/juce_Socket.cpp b/src/io/network/juce_Socket.cpp index d0968660e2..3d8fa447aa 100644 --- a/src/io/network/juce_Socket.cpp +++ b/src/io/network/juce_Socket.cpp @@ -104,8 +104,7 @@ namespace SocketHelpers if (handle <= 0 || port <= 0) return false; - struct sockaddr_in servTmpAddr; - zerostruct (servTmpAddr); + struct sockaddr_in servTmpAddr = { 0 }; servTmpAddr.sin_family = PF_INET; servTmpAddr.sin_addr.s_addr = htonl (INADDR_ANY); servTmpAddr.sin_port = htons ((uint16) port); @@ -231,8 +230,7 @@ namespace SocketHelpers const int portNumber, const int timeOutMillisecs) throw() { - struct addrinfo hints; - zerostruct (hints); + struct addrinfo hints = { 0 }; hints.ai_family = AF_UNSPEC; hints.ai_socktype = isDatagram ? SOCK_DGRAM : SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV; @@ -424,8 +422,7 @@ bool StreamingSocket::createListener (const int newPortNumber, const String& loc portNumber = newPortNumber; isListener = true; - struct sockaddr_in servTmpAddr; - zerostruct (servTmpAddr); + struct sockaddr_in servTmpAddr = { 0 }; servTmpAddr.sin_family = PF_INET; servTmpAddr.sin_addr.s_addr = htonl (INADDR_ANY); diff --git a/src/native/common/juce_posix_SharedCode.h b/src/native/common/juce_posix_SharedCode.h index 9cadaa0bc9..05dbb8e312 100644 --- a/src/native/common/juce_posix_SharedCode.h +++ b/src/native/common/juce_posix_SharedCode.h @@ -523,8 +523,7 @@ const String File::getVolumeLabel() const char mountPointSpace [MAXPATHLEN]; } attrBuf; - struct attrlist attrList; - zerostruct (attrList); + struct attrlist attrList = { 0 }; attrList.bitmapcount = ATTR_BIT_MAP_COUNT; attrList.volattr = ATTR_VOL_INFO | ATTR_VOL_NAME; @@ -608,8 +607,7 @@ public: if (handle != 0) { - struct flock fl; - zerostruct (fl); + struct flock fl = { 0 }; fl.l_whence = SEEK_SET; fl.l_type = F_WRLCK; @@ -645,8 +643,7 @@ public: { if (handle != 0) { - struct flock fl; - zerostruct (fl); + struct flock fl = { 0 }; fl.l_whence = SEEK_SET; fl.l_type = F_UNLCK; diff --git a/src/native/linux/juce_linux_Network.cpp b/src/native/linux/juce_linux_Network.cpp index 2b0272fe4c..e6bbe5bd2a 100644 --- a/src/native/linux/juce_linux_Network.cpp +++ b/src/native/linux/juce_linux_Network.cpp @@ -214,8 +214,7 @@ private: port = hostPort; } - struct addrinfo hints; - zerostruct (hints); + struct addrinfo hints = { 0 }; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV; diff --git a/src/native/linux/juce_linux_Windowing.cpp b/src/native/linux/juce_linux_Windowing.cpp index 9039a89791..cf46c06399 100644 --- a/src/native/linux/juce_linux_Windowing.cpp +++ b/src/native/linux/juce_linux_Windowing.cpp @@ -178,8 +178,7 @@ namespace XSHMHelpers trappedErrorCode = 0; XErrorHandler oldHandler = XSetErrorHandler (errorTrapHandler); - XShmSegmentInfo segmentInfo; - zerostruct (segmentInfo); + XShmSegmentInfo segmentInfo = { 0 }; XImage* xImage = XShmCreateImage (display, DefaultVisual (display, DefaultScreen (display)), 24, ZPixmap, 0, &segmentInfo, 50, 50); @@ -1684,8 +1683,7 @@ public: if (managerWin != None) { - XEvent ev; - zerostruct (ev); + XEvent ev = { 0 }; ev.xclient.type = ClientMessage; ev.xclient.window = managerWin; ev.xclient.message_type = XInternAtom (display, "_NET_SYSTEM_TRAY_OPCODE", False); @@ -2000,8 +1998,7 @@ private: if (hints != None) { - MotifWmHints motifHints; - zerostruct (motifHints); + MotifWmHints motifHints = { 0 }; motifHints.flags = 2; /* MWM_HINTS_DECORATIONS */ motifHints.decorations = 0; @@ -2040,9 +2037,7 @@ private: if (hints != None) { - MotifWmHints motifHints; - zerostruct (motifHints); - + MotifWmHints motifHints = { 0 }; motifHints.flags = 1 | 2; /* MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS */ motifHints.decorations = 2 /* MWM_DECOR_BORDER */ | 8 /* MWM_DECOR_TITLE */ | 16; /* MWM_DECOR_MENU */ @@ -2368,8 +2363,7 @@ private: void sendDragAndDropStatus (const bool acceptDrop, Atom dropAction) { - XClientMessageEvent msg; - zerostruct (msg); + XClientMessageEvent msg = { 0 }; msg.message_type = Atoms::XdndStatus; msg.data.l[1] = (acceptDrop ? 1 : 0) | 2; // 2 indicates that we want to receive position messages msg.data.l[4] = dropAction; @@ -2379,16 +2373,14 @@ private: void sendDragAndDropLeave() { - XClientMessageEvent msg; - zerostruct (msg); + XClientMessageEvent msg = { 0 }; msg.message_type = Atoms::XdndLeave; sendDragAndDropMessage (msg); } void sendDragAndDropFinish() { - XClientMessageEvent msg; - zerostruct (msg); + XClientMessageEvent msg = { 0 }; msg.message_type = Atoms::XdndFinished; sendDragAndDropMessage (msg); } diff --git a/src/native/mac/juce_mac_NativeCode.mm b/src/native/mac/juce_mac_NativeCode.mm index f065dba06d..d2ebc37077 100644 --- a/src/native/mac/juce_mac_NativeCode.mm +++ b/src/native/mac/juce_mac_NativeCode.mm @@ -130,8 +130,7 @@ public: runLoop = CFRunLoopGetCurrent(); #endif - CFRunLoopSourceContext sourceContext; - zerostruct (sourceContext); + CFRunLoopSourceContext sourceContext = { 0 }; sourceContext.info = this; sourceContext.perform = runLoopSourceCallback; runLoopSource = CFRunLoopSourceCreate (kCFAllocatorDefault, 1, &sourceContext); diff --git a/src/native/windows/juce_win32_ASIO.cpp b/src/native/windows/juce_win32_ASIO.cpp index 719e03d431..a734794a25 100644 --- a/src/native/windows/juce_win32_ASIO.cpp +++ b/src/native/windows/juce_win32_ASIO.cpp @@ -439,9 +439,7 @@ public: { inBuffers[n] = tempBuffer + (currentBlockSizeSamples * n); - ASIOChannelInfo channelInfo; - zerostruct (channelInfo); - + ASIOChannelInfo channelInfo = { 0 }; channelInfo.channel = i; channelInfo.isInput = 1; asioObject->getChannelInfo (&channelInfo); @@ -468,9 +466,7 @@ public: { outBuffers[n] = tempBuffer + (currentBlockSizeSamples * (numActiveInputChans + n)); - ASIOChannelInfo channelInfo; - zerostruct (channelInfo); - + ASIOChannelInfo channelInfo = { 0 }; channelInfo.channel = i; channelInfo.isInput = 0; asioObject->getChannelInfo (&channelInfo); @@ -1040,12 +1036,9 @@ private: updateSampleRates(); - ASIOChannelInfo channelInfo; - channelInfo.type = 0; - for (i = 0; i < totalNumInputChans; ++i) { - zerostruct (channelInfo); + ASIOChannelInfo channelInfo = { 0 }; channelInfo.channel = i; channelInfo.isInput = 1; asioObject->getChannelInfo (&channelInfo); @@ -1055,7 +1048,7 @@ private: for (i = 0; i < totalNumOutputChans; ++i) { - zerostruct (channelInfo); + ASIOChannelInfo channelInfo = { 0 }; channelInfo.channel = i; channelInfo.isInput = 0; asioObject->getChannelInfo (&channelInfo); diff --git a/src/native/windows/juce_win32_AudioCDReader.cpp b/src/native/windows/juce_win32_AudioCDReader.cpp index 6b80f60f84..d44b5f04ad 100644 --- a/src/native/windows/juce_win32_AudioCDReader.cpp +++ b/src/native/windows/juce_win32_AudioCDReader.cpp @@ -329,8 +329,7 @@ void findCDDevices (Array& list) { char buffer[100] = { 0 }; - SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER p; - zerostruct (p); + SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER p = { 0 }; p.spt.Length = sizeof (SCSI_PASS_THROUGH); p.spt.CdbLength = 6; p.spt.SenseInfoLength = 24; @@ -352,8 +351,7 @@ void findCDDevices (Array& list) dev.scsiDriveLetter = driveLetter; dev.createDescription (buffer); - SCSI_ADDRESS scsiAddr; - zerostruct (scsiAddr); + SCSI_ADDRESS scsiAddr = { 0 }; scsiAddr.Length = sizeof (scsiAddr); if (DeviceIoControl (h, IOCTL_SCSI_GET_ADDRESS, @@ -376,9 +374,7 @@ void findCDDevices (Array& list) DWORD performScsiPassThroughCommand (SRB_ExecSCSICmd* const srb, const char driveLetter, HANDLE& deviceHandle, const bool retryOnFailure) { - SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER s; - zerostruct (s); - + SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER s = { 0 }; s.spt.Length = sizeof (SCSI_PASS_THROUGH); s.spt.CdbLength = srb->SRB_CDBLen; @@ -805,8 +801,7 @@ int CDController::getLastIndex() //============================================================================== bool CDDeviceHandle::readTOC (TOC* lpToc) { - SRB_ExecSCSICmd s; - zerostruct (s); + SRB_ExecSCSICmd s = { 0 }; s.SRB_Cmd = SC_EXEC_SCSI_CMD; s.SRB_HaID = info.ha; s.SRB_Target = info.tgt; @@ -880,8 +875,7 @@ void CDDeviceHandle::openDrawer (bool shouldBeOpen) } } - SRB_ExecSCSICmd s; - zerostruct (s); + SRB_ExecSCSICmd s = { 0 }; s.SRB_Cmd = SC_EXEC_SCSI_CMD; s.SRB_HaID = info.ha; s.SRB_Target = info.tgt; @@ -1138,9 +1132,7 @@ bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int sta bool AudioCDReader::isCDStillPresent() const { using namespace CDReaderHelpers; - TOC toc; - zerostruct (toc); - + TOC toc = { 0 }; return static_cast (handle)->deviceHandle.readTOC (&toc); } @@ -1150,8 +1142,7 @@ void AudioCDReader::refreshTrackLengths() trackStartSamples.clear(); zeromem (audioTracks, sizeof (audioTracks)); - TOC toc; - zerostruct (toc); + TOC toc = { 0 }; if (static_cast (handle)->deviceHandle.readTOC (&toc)) { diff --git a/src/native/windows/juce_win32_CameraDevice.cpp b/src/native/windows/juce_win32_CameraDevice.cpp index 1e50e56a87..b4b97b9626 100644 --- a/src/native/windows/juce_win32_CameraDevice.cpp +++ b/src/native/windows/juce_win32_CameraDevice.cpp @@ -99,12 +99,13 @@ public: if (FAILED (hr)) return; - AM_MEDIA_TYPE mt; - zerostruct (mt); - mt.majortype = MEDIATYPE_Video; - mt.subtype = MEDIASUBTYPE_RGB24; - mt.formattype = FORMAT_VideoInfo; - sampleGrabber->SetMediaType (&mt); + { + AM_MEDIA_TYPE mt = { 0 }; + mt.majortype = MEDIATYPE_Video; + mt.subtype = MEDIASUBTYPE_RGB24; + mt.formattype = FORMAT_VideoInfo; + sampleGrabber->SetMediaType (&mt); + } callback = new GrabberCallback (*this); hr = sampleGrabber->SetCallback (callback, 1); @@ -123,7 +124,7 @@ public: if (FAILED (hr)) return; - zerostruct (mt); + AM_MEDIA_TYPE mt = { 0 }; hr = sampleGrabber->GetConnectedMediaType (&mt); VIDEOINFOHEADER* pVih = (VIDEOINFOHEADER*) (mt.pbFormat); width = pVih->bmiHeader.biWidth; @@ -601,8 +602,7 @@ private: if (wantedDirection == dir) { - PIN_INFO info; - zerostruct (info); + PIN_INFO info = { 0 }; pin->QueryPinInfo (&info); if (pinName == 0 || String (pinName).equalsIgnoreCase (String (info.achName))) diff --git a/src/native/windows/juce_win32_DirectSound.cpp b/src/native/windows/juce_win32_DirectSound.cpp index 90aa2a3446..c34044eb00 100644 --- a/src/native/windows/juce_win32_DirectSound.cpp +++ b/src/native/windows/juce_win32_DirectSound.cpp @@ -292,9 +292,7 @@ public: { IDirectSoundBuffer* pPrimaryBuffer; - DSBUFFERDESC primaryDesc; - zerostruct (primaryDesc); - + DSBUFFERDESC primaryDesc = { 0 }; primaryDesc.dwSize = sizeof (DSBUFFERDESC); primaryDesc.dwFlags = 1 /* DSBCAPS_PRIMARYBUFFER */; primaryDesc.dwBufferBytes = 0; @@ -320,9 +318,7 @@ public: if (hr == S_OK) { - DSBUFFERDESC secondaryDesc; - zerostruct (secondaryDesc); - + DSBUFFERDESC secondaryDesc = { 0 }; secondaryDesc.dwSize = sizeof (DSBUFFERDESC); secondaryDesc.dwFlags = 0x8000 /* DSBCAPS_GLOBALFOCUS */ | 0x10000 /* DSBCAPS_GETCURRENTPOSITION2 */; @@ -620,9 +616,7 @@ public: wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign; wfFormat.cbSize = 0; - DSCBUFFERDESC captureDesc; - zerostruct (captureDesc); - + DSCBUFFERDESC captureDesc = { 0 }; captureDesc.dwSize = sizeof (DSCBUFFERDESC); captureDesc.dwFlags = 0; captureDesc.dwBufferBytes = totalBytesPerBuffer; diff --git a/src/native/windows/juce_win32_FileChooser.cpp b/src/native/windows/juce_win32_FileChooser.cpp index f35fbc4d99..070759fab5 100644 --- a/src/native/windows/juce_win32_FileChooser.cpp +++ b/src/native/windows/juce_win32_FileChooser.cpp @@ -181,9 +181,7 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ if (selectsDirectory) { - BROWSEINFO bi; - zerostruct (bi); - + BROWSEINFO bi = { 0 }; bi.hwndOwner = (HWND) parentWindow.getWindowHandle(); bi.pszDisplayName = files; bi.lpszTitle = title.toWideCharPointer(); @@ -238,16 +236,14 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ filter.copyToUTF16 (filters + (bytesWritten / sizeof (WCHAR)) + 1, (filterSpaceNumChars - 1) * sizeof (WCHAR) - bytesWritten); - OPENFILENAMEW of; - zerostruct (of); - + OPENFILENAMEW of = { 0 }; String localPath (info.initialPath); - #ifdef OPENFILENAME_SIZE_VERSION_400W + #ifdef OPENFILENAME_SIZE_VERSION_400W of.lStructSize = OPENFILENAME_SIZE_VERSION_400W; - #else + #else of.lStructSize = sizeof (of); - #endif + #endif of.hwndOwner = (HWND) parentWindow.getWindowHandle(); of.lpstrFilter = filters.getData(); of.nFilterIndex = 1; diff --git a/src/native/windows/juce_win32_Files.cpp b/src/native/windows/juce_win32_Files.cpp index 1374ff229d..d43e3d3780 100644 --- a/src/native/windows/juce_win32_Files.cpp +++ b/src/native/windows/juce_win32_Files.cpp @@ -167,8 +167,7 @@ bool File::moveToTrash() const if (! exists()) return true; - SHFILEOPSTRUCT fos; - zerostruct (fos); + SHFILEOPSTRUCT fos = { 0 }; // The string we pass in must be double null terminated.. String doubleNullTermPath (getFullPathName() + " "); @@ -677,8 +676,7 @@ public: if (! connected) { - OVERLAPPED over; - zerostruct (over); + OVERLAPPED over = { 0 }; over.hEvent = CreateEvent (0, TRUE, FALSE, 0); @@ -765,8 +763,7 @@ int NamedPipe::read (void* destBuffer, int maxBytesToRead, int timeOutMillisecon if (maxBytesToRead <= 0) return 0; - OVERLAPPED over; - zerostruct (over); + OVERLAPPED over = { 0 }; over.hEvent = CreateEvent (0, TRUE, FALSE, 0); unsigned long numRead; @@ -820,9 +817,7 @@ int NamedPipe::write (const void* sourceBuffer, int numBytesToWrite, int timeOut if (numBytesToWrite <= 0) return 0; - OVERLAPPED over; - zerostruct (over); - + OVERLAPPED over = { 0 }; over.hEvent = CreateEvent (0, TRUE, FALSE, 0); unsigned long numWritten; diff --git a/src/native/windows/juce_win32_Fonts.cpp b/src/native/windows/juce_win32_Fonts.cpp index d64ef35da8..bbcad25b5b 100644 --- a/src/native/windows/juce_win32_Fonts.cpp +++ b/src/native/windows/juce_win32_Fonts.cpp @@ -51,9 +51,7 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe, { if (lpelfe != 0 && (type & RASTER_FONTTYPE) == 0) { - LOGFONTW lf; - zerostruct (lf); - + LOGFONTW lf = { 0 }; lf.lfWeight = FW_DONTCARE; lf.lfOutPrecision = OUT_OUTLINE_PRECIS; lf.lfQuality = DEFAULT_QUALITY; @@ -80,9 +78,7 @@ const StringArray Font::findAllTypefaceNames() HDC dc = CreateCompatibleDC (0); { - LOGFONTW lf; - zerostruct (lf); - + LOGFONTW lf = { 0 }; lf.lfWeight = FW_DONTCARE; lf.lfOutPrecision = OUT_OUTLINE_PRECIS; lf.lfQuality = DEFAULT_QUALITY; @@ -158,9 +154,7 @@ public: SetMapperFlags (dc, 0); SetMapMode (dc, MM_TEXT); - LOGFONTW lfw; - zerostruct (lfw); - + LOGFONTW lfw = { 0 }; lfw.lfCharSet = DEFAULT_CHARSET; lfw.lfClipPrecision = CLIP_DEFAULT_PRECIS; lfw.lfOutPrecision = OUT_OUTLINE_PRECIS; diff --git a/src/native/windows/juce_win32_Messaging.cpp b/src/native/windows/juce_win32_Messaging.cpp index b1fd798de9..d9fcd308cf 100644 --- a/src/native/windows/juce_win32_Messaging.cpp +++ b/src/native/windows/juce_win32_Messaging.cpp @@ -272,8 +272,7 @@ void MessageManager::doPlatformSpecificInitialisation() HMODULE moduleHandle = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle(); - WNDCLASSEX wc; - zerostruct (wc); + WNDCLASSEX wc = { 0 }; wc.cbSize = sizeof (wc); wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; wc.cbWndExtra = 4; diff --git a/src/native/windows/juce_win32_Midi.cpp b/src/native/windows/juce_win32_Midi.cpp index 148f789981..3abc4c73a6 100644 --- a/src/native/windows/juce_win32_Midi.cpp +++ b/src/native/windows/juce_win32_Midi.cpp @@ -233,8 +233,7 @@ const StringArray MidiInput::getDevices() for (int i = 0; i < num; ++i) { - MIDIINCAPS mc; - zerostruct (mc); + MIDIINCAPS mc = { 0 }; if (midiInGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) s.add (String (mc.szPname, sizeof (mc.szPname))); @@ -261,8 +260,7 @@ MidiInput* MidiInput::openDevice (const int index, MidiInputCallback* const call for (int i = 0; i < num; ++i) { - MIDIINCAPS mc; - zerostruct (mc); + MIDIINCAPS mc = { 0 }; if (midiInGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) { @@ -341,8 +339,7 @@ const StringArray MidiOutput::getDevices() for (int i = 0; i < num; ++i) { - MIDIOUTCAPS mc; - zerostruct (mc); + MIDIOUTCAPS mc = { 0 }; if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) s.add (String (mc.szPname, sizeof (mc.szPname))); @@ -358,8 +355,7 @@ int MidiOutput::getDefaultDeviceIndex() for (int i = 0; i < num; ++i) { - MIDIOUTCAPS mc; - zerostruct (mc); + MIDIOUTCAPS mc = { 0 }; if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) { @@ -381,8 +377,7 @@ MidiOutput* MidiOutput::openDevice (int index) for (i = 0; i < num; ++i) { - MIDIOUTCAPS mc; - zerostruct (mc); + MIDIOUTCAPS mc = { 0 }; if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) { @@ -502,8 +497,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message) if (message.getRawDataSize() > 3 || message.isSysEx()) { - MIDIHDR h; - zerostruct (h); + MIDIHDR h = { 0 }; h.lpData = (char*) message.getRawData(); h.dwBufferLength = message.getRawDataSize(); diff --git a/src/native/windows/juce_win32_Network.cpp b/src/native/windows/juce_win32_Network.cpp index fd140b5c19..283384f9ab 100644 --- a/src/native/windows/juce_win32_Network.cpp +++ b/src/native/windows/juce_win32_Network.cpp @@ -227,8 +227,7 @@ private: // break up the url.. TCHAR file[1024], server[1024]; - URL_COMPONENTS uc; - zerostruct (uc); + URL_COMPONENTS uc = { 0 }; uc.dwStructSize = sizeof (uc); uc.dwUrlPathLength = sizeof (file); uc.dwHostNameLength = sizeof (server); @@ -292,8 +291,7 @@ private: if (request != 0) { - INTERNET_BUFFERS buffers; - zerostruct (buffers); + INTERNET_BUFFERS buffers = { 0 }; buffers.dwStructSize = sizeof (INTERNET_BUFFERS); buffers.lpcszHeader = headers.toWideCharPointer(); buffers.dwHeadersLength = headers.length(); @@ -392,39 +390,36 @@ namespace MACAddressHelpers if (NetbiosCall != 0) { - NCB ncb; - zerostruct (ncb); + LANA_ENUM enums = { 0 }; - struct ASTAT { - ADAPTER_STATUS adapt; - NAME_BUFFER NameBuff [30]; - }; - - ASTAT astat; - zeromem (&astat, sizeof (astat)); // (can't use zerostruct here in VC6) - - LANA_ENUM enums; - zerostruct (enums); - - ncb.ncb_command = NCBENUM; - ncb.ncb_buffer = (unsigned char*) &enums; - ncb.ncb_length = sizeof (LANA_ENUM); - NetbiosCall (&ncb); + NCB ncb = { 0 }; + ncb.ncb_command = NCBENUM; + ncb.ncb_buffer = (unsigned char*) &enums; + ncb.ncb_length = sizeof (LANA_ENUM); + NetbiosCall (&ncb); + } for (int i = 0; i < enums.length; ++i) { - zerostruct (ncb); - ncb.ncb_command = NCBRESET; - ncb.ncb_lana_num = enums.lana[i]; + NCB ncb2 = { 0 }; + ncb2.ncb_command = NCBRESET; + ncb2.ncb_lana_num = enums.lana[i]; - if (NetbiosCall (&ncb) == 0) + if (NetbiosCall (&ncb2) == 0) { - zerostruct (ncb); + NCB ncb = { 0 }; memcpy (ncb.ncb_callname, "* ", NCBNAMSZ); ncb.ncb_command = NCBASTAT; ncb.ncb_lana_num = enums.lana[i]; + struct ASTAT + { + ADAPTER_STATUS adapt; + NAME_BUFFER NameBuff [30]; + }; + + ASTAT astat = { 0 }; ncb.ncb_buffer = (unsigned char*) &astat; ncb.ncb_length = sizeof (ASTAT); @@ -457,13 +452,11 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd if (mapiSendMail != 0) { - MapiMessage message; - zerostruct (message); + MapiMessage message = { 0 }; message.lpszSubject = (LPSTR) emailSubject.toUTF8().getAddress(); message.lpszNoteText = (LPSTR) bodyText.toUTF8().getAddress(); - MapiRecipDesc recip; - zerostruct (recip); + MapiRecipDesc recip = { 0 }; recip.ulRecipClass = MAPI_TO; String targetEmailAddress_ (targetEmailAddress); if (targetEmailAddress_.isEmpty()) diff --git a/src/native/windows/juce_win32_OpenGLComponent.cpp b/src/native/windows/juce_win32_OpenGLComponent.cpp index 6999a675d6..1af0bc386f 100644 --- a/src/native/windows/juce_win32_OpenGLComponent.cpp +++ b/src/native/windows/juce_win32_OpenGLComponent.cpp @@ -89,8 +89,7 @@ public: createNativeWindow(); // Use a default pixel format that should be supported everywhere - PIXELFORMATDESCRIPTOR pfd; - zerostruct (pfd); + PIXELFORMATDESCRIPTOR pfd = { 0 }; pfd.nSize = sizeof (pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; @@ -167,8 +166,7 @@ public: { makeActive(); - PIXELFORMATDESCRIPTOR pfd; - zerostruct (pfd); + PIXELFORMATDESCRIPTOR pfd = { 0 }; pfd.nSize = sizeof (pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER; diff --git a/src/native/windows/juce_win32_QuickTimeMovieComponent.cpp b/src/native/windows/juce_win32_QuickTimeMovieComponent.cpp index e3408f15bf..cd127ce854 100644 --- a/src/native/windows/juce_win32_QuickTimeMovieComponent.cpp +++ b/src/native/windows/juce_win32_QuickTimeMovieComponent.cpp @@ -375,8 +375,7 @@ bool juce_OpenQuickTimeMovieFromStream (InputStream* input, Movie& movie, Handle dataHandle = 0; bool ok = false; - QTNewMoviePropertyElement props[5]; - zeromem (props, sizeof (props)); + QTNewMoviePropertyElement props[5] = { 0 }; int prop = 0; DataReferenceRecord dr; diff --git a/src/native/windows/juce_win32_WASAPI.cpp b/src/native/windows/juce_win32_WASAPI.cpp index d38626fc41..ae1b03ea72 100644 --- a/src/native/windows/juce_win32_WASAPI.cpp +++ b/src/native/windows/juce_win32_WASAPI.cpp @@ -330,8 +330,7 @@ private: bool tryInitialisingWithFormat (const bool useFloat, const int bytesPerSampleToTry) { - WAVEFORMATEXTENSIBLE format; - zerostruct (format); + WAVEFORMATEXTENSIBLE format = { 0 }; if (numChannels <= 2 && bytesPerSampleToTry <= 2) { diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index 728afc739c..7936401239 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -1041,8 +1041,7 @@ private: GetModuleFileName (moduleHandle, moduleFile, 1024); WORD iconNum = 0; - WNDCLASSEX wcex; - zerostruct (wcex); + WNDCLASSEX wcex = { 0 }; wcex.cbSize = sizeof (wcex); wcex.style = CS_OWNDC; wcex.lpfnWndProc = (WNDPROC) windowProc;