diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index af476efa26..9bcd77940f 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -574,7 +574,7 @@ public: OSType typeId = types[index]; - OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (typeId), &typeId)); + OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (typeId), &typeId)); } } } @@ -600,7 +600,7 @@ public: pa.mScope = kAudioObjectPropertyScopeGlobal; pa.mElement = kAudioObjectPropertyElementMaster; Float64 sr = newSampleRate; - return OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (sr), &sr)); + return OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (sr), &sr)); } //============================================================================== @@ -643,7 +643,7 @@ public: pa.mElement = kAudioObjectPropertyElementMaster; UInt32 framesPerBuf = (UInt32) bufferSizeSamples; - if (! OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (framesPerBuf), &framesPerBuf))) + if (! OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (framesPerBuf), &framesPerBuf))) { updateDetailsFromDevice(); error = "Couldn't change buffer size"; @@ -686,7 +686,7 @@ public: else { OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); - audioProcID = 0; + audioProcID = {}; } } } @@ -712,7 +712,7 @@ public: { OK (AudioDeviceStop (deviceID, audioIOProc)); OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); - audioProcID = 0; + audioProcID = {}; started = false; @@ -831,7 +831,7 @@ public: Array sampleRates; Array bufferSizes; AudioIODeviceCallback* callback = nullptr; - AudioDeviceIOProcID audioProcID = 0; + AudioDeviceIOProcID audioProcID = {}; private: CriticalSection callbackLock; diff --git a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp index 175c1d7028..a094132015 100644 --- a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp @@ -42,9 +42,9 @@ namespace CFArrayRef extensions = nullptr; UInt32 sizeOfArray = sizeof (extensions); - if (AudioFileGetGlobalInfo (kAudioFileGlobalInfo_AllExtensions, 0, 0, &sizeOfArray, &extensions) == noErr) + if (AudioFileGetGlobalInfo (kAudioFileGlobalInfo_AllExtensions, 0, nullptr, &sizeOfArray, &extensions) == noErr) { - const CFIndex numValues = CFArrayGetCount (extensions); + auto numValues = CFArrayGetCount (extensions); for (CFIndex i = 0; i < numValues; ++i) extensionsArray.add ("." + String::fromCFString ((CFStringRef) CFArrayGetValueAtIndex (extensions, i))); @@ -122,14 +122,14 @@ struct CoreAudioFormatMetatdata static StringPairArray parseUserDefinedChunk (InputStream& input, int64 size) { StringPairArray infoStrings; - const int64 originalPosition = input.getPosition(); + auto originalPosition = input.getPosition(); uint8 uuid[16]; input.read (uuid, sizeof (uuid)); if (memcmp (uuid, "\x29\x81\x92\x73\xB5\xBF\x4A\xEF\xB7\x8D\x62\xD1\xEF\x90\xBB\x2C", 16) == 0) { - const uint32 numEntries = (uint32) input.readIntBigEndian(); + auto numEntries = (uint32) input.readIntBigEndian(); for (uint32 i = 0; i < numEntries && input.getPosition() < originalPosition + size; ++i) { @@ -350,13 +350,13 @@ public: if (input != nullptr) CoreAudioFormatMetatdata::read (*input, metadataValues); - OSStatus status = AudioFileOpenWithCallbacks (this, - &readCallback, - nullptr, // write needs to be null to avoid permisisions errors - &getSizeCallback, - nullptr, // setSize needs to be null to avoid permisisions errors - 0, // AudioFileTypeID inFileTypeHint - &audioFileID); + auto status = AudioFileOpenWithCallbacks (this, + &readCallback, + nullptr, // write needs to be null to avoid permisisions errors + &getSizeCallback, + nullptr, // setSize needs to be null to avoid permisisions errors + 0, // AudioFileTypeID inFileTypeHint + &audioFileID); if (status == noErr) { status = ExtAudioFileWrapAudioFileID (audioFileID, false, &audioFileRef); diff --git a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp index b83935c8d5..c794b8a9ee 100644 --- a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp @@ -117,6 +117,9 @@ namespace FlacNamespace #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wdeprecated-register" + #if __has_warning("-Wzero-as-null-pointer-constant") + #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" + #endif #endif #if JUCE_INTEL @@ -298,7 +301,7 @@ public: auto* src = buffer[i]; int n = i; - while (src == 0 && n > 0) + while (src == nullptr && n > 0) src = buffer [--n]; if (src != nullptr) diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp index 3937c72b04..44ecd9a4c2 100644 --- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp @@ -44,6 +44,9 @@ namespace OggVorbisNamespace #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wdeprecated-register" + #if __has_warning("-Wzero-as-null-pointer-constant") + #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" + #endif #elif JUCE_GCC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" @@ -121,7 +124,7 @@ public: callbacks.close_func = &oggCloseCallback; callbacks.tell_func = &oggTellCallback; - auto err = ov_open_callbacks (input, &ovFile, 0, 0, callbacks); + auto err = ov_open_callbacks (input, &ovFile, nullptr, 0, callbacks); if (err == 0) { @@ -377,7 +380,7 @@ public: while (vorbis_analysis_blockout (&vd, &vb) == 1) { - vorbis_analysis (&vb, 0); + vorbis_analysis (&vb, nullptr); vorbis_bitrate_addblock (&vb); while (vorbis_bitrate_flushpacket (&vd, &op)) diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp index 2f914d3705..e7cb66ebd8 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp @@ -257,10 +257,9 @@ int64 AudioFormatReader::searchForLevel (int64 startSample, const int bufferSize = 4096; HeapBlock tempSpace (bufferSize * 2 + 64); - int* tempBuffer[3]; - tempBuffer[0] = tempSpace.get(); - tempBuffer[1] = tempSpace.get() + bufferSize; - tempBuffer[2] = 0; + int* tempBuffer[3] = { tempSpace.get(), + tempSpace.get() + bufferSize, + nullptr }; int consecutive = 0; int64 firstMatchPos = -1; diff --git a/modules/juce_audio_formats/format/juce_AudioFormatWriter.cpp b/modules/juce_audio_formats/format/juce_AudioFormatWriter.cpp index 5a64e737e9..4234a4fee1 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatWriter.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormatWriter.cpp @@ -86,7 +86,7 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, const int bufferSize = 16384; AudioBuffer tempBuffer ((int) numChannels, bufferSize); - int* buffers[128] = { 0 }; + int* buffers[128] = { nullptr }; for (int i = tempBuffer.getNumChannels(); --i >= 0;) buffers[i] = reinterpret_cast (tempBuffer.getWritePointer (i, 0)); diff --git a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp index 0fc827297a..94106e2cc4 100644 --- a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp @@ -27,16 +27,15 @@ namespace juce { -AudioSubsectionReader::AudioSubsectionReader (AudioFormatReader* const source_, - const int64 startSample_, - const int64 length_, - const bool deleteSourceWhenDeleted_) - : AudioFormatReader (0, source_->getFormatName()), - source (source_), - startSample (startSample_), - deleteSourceWhenDeleted (deleteSourceWhenDeleted_) +AudioSubsectionReader::AudioSubsectionReader (AudioFormatReader* sourceToUse, + int64 startSampleToUse, int64 lengthToUse, + bool deleteSource) + : AudioFormatReader (nullptr, sourceToUse->getFormatName()), + source (sourceToUse), + startSample (startSampleToUse), + deleteSourceWhenDeleted (deleteSource) { - length = jmin (jmax ((int64) 0, source->lengthInSamples - startSample), length_); + length = jmin (jmax ((int64) 0, source->lengthInSamples - startSample), lengthToUse); sampleRate = source->sampleRate; bitsPerSample = source->bitsPerSample;