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

Replaced some more stray zeros being used as null pointers

This commit is contained in:
jules 2018-10-09 11:27:42 +01:00
parent 04b0d05b31
commit 132017558f
7 changed files with 38 additions and 34 deletions

View file

@ -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<double> sampleRates;
Array<int> bufferSizes;
AudioIODeviceCallback* callback = nullptr;
AudioDeviceIOProcID audioProcID = 0;
AudioDeviceIOProcID audioProcID = {};
private:
CriticalSection callbackLock;

View file

@ -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);

View file

@ -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)

View file

@ -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))

View file

@ -257,10 +257,9 @@ int64 AudioFormatReader::searchForLevel (int64 startSample,
const int bufferSize = 4096;
HeapBlock<int> 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;

View file

@ -86,7 +86,7 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
const int bufferSize = 16384;
AudioBuffer<float> tempBuffer ((int) numChannels, bufferSize);
int* buffers[128] = { 0 };
int* buffers[128] = { nullptr };
for (int i = tempBuffer.getNumChannels(); --i >= 0;)
buffers[i] = reinterpret_cast<int*> (tempBuffer.getWritePointer (i, 0));

View file

@ -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;