Browse Source

Tidied up some method calls involving HeapBlock

tags/2021-05-28
jules 8 years ago
parent
commit
7c6f3d40b6
24 changed files with 76 additions and 79 deletions
  1. +6
    -9
      examples/AUv3Synth/Source/AUv3SynthProcessor.cpp
  2. +4
    -4
      modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h
  3. +3
    -3
      modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp
  4. +2
    -2
      modules/juce_audio_devices/native/juce_android_Midi.cpp
  5. +4
    -4
      modules/juce_audio_devices/native/juce_android_OpenSL.cpp
  6. +2
    -2
      modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp
  7. +2
    -2
      modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp
  8. +2
    -2
      modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp
  9. +2
    -2
      modules/juce_audio_formats/format/juce_AudioFormatReader.cpp
  10. +3
    -3
      modules/juce_audio_processors/format_types/juce_AU_Shared.h
  11. +8
    -8
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  12. +2
    -2
      modules/juce_audio_processors/format_types/juce_VSTCommon.h
  13. +5
    -5
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  14. +6
    -6
      modules/juce_core/containers/juce_Array.h
  15. +6
    -6
      modules/juce_core/containers/juce_OwnedArray.h
  16. +6
    -6
      modules/juce_core/containers/juce_ReferenceCountedArray.h
  17. +1
    -1
      modules/juce_core/native/juce_mac_Files.mm
  18. +3
    -3
      modules/juce_core/native/juce_mac_Strings.mm
  19. +1
    -1
      modules/juce_core/native/juce_mac_SystemStats.mm
  20. +2
    -2
      modules/juce_core/network/juce_URL.cpp
  21. +2
    -2
      modules/juce_core/text/juce_String.cpp
  22. +1
    -1
      modules/juce_graphics/geometry/juce_PathIterator.cpp
  23. +2
    -2
      modules/juce_graphics/native/juce_RenderingHelpers.h
  24. +1
    -1
      modules/juce_opengl/opengl/juce_OpenGLImage.cpp

+ 6
- 9
examples/AUv3Synth/Source/AUv3SynthProcessor.cpp View File

@@ -96,19 +96,16 @@ public:
const String getName() const override { return "AUv3 Synth"; } const String getName() const override { return "AUv3 Synth"; }
int getNumPrograms() override { return 4; } int getNumPrograms() override { return 4; }
int getCurrentProgram() override { return currentProgram; } int getCurrentProgram() override { return currentProgram; }
void setCurrentProgram (int index) override { currentProgram = index; }
void setCurrentProgram (int index) override { currentProgram = index; }
const String getProgramName (int index) override const String getProgramName (int index) override
{ {
switch (index) switch (index)
{ {
case 0:
return "Piano";
case 1:
return "Singing";
case 2:
return "Pinched Balloon";
case 3:
return "Gazeebo";
case 0: return "Piano";
case 1: return "Singing";
case 2: return "Pinched Balloon";
case 3: return "Gazeebo";
} }
return "<Unknown>"; return "<Unknown>";


+ 4
- 4
modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h View File

@@ -332,7 +332,7 @@ public:
auto numSamplesToCopy = (size_t) jmin (newNumSamples, size); auto numSamplesToCopy = (size_t) jmin (newNumSamples, size);
auto newChannels = reinterpret_cast<Type**> (newData.getData());
auto newChannels = reinterpret_cast<Type**> (newData.get());
auto newChan = reinterpret_cast<Type*> (newData + channelListSize); auto newChan = reinterpret_cast<Type*> (newData + channelListSize);
for (int j = 0; j < newNumChannels; ++j) for (int j = 0; j < newNumChannels; ++j)
@@ -364,7 +364,7 @@ public:
{ {
allocatedBytes = newTotalBytes; allocatedBytes = newTotalBytes;
allocatedData.allocate (newTotalBytes, clearExtraSpace || isClear); allocatedData.allocate (newTotalBytes, clearExtraSpace || isClear);
channels = reinterpret_cast<Type**> (allocatedData.getData());
channels = reinterpret_cast<Type**> (allocatedData.get());
} }
auto* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); auto* chan = reinterpret_cast<Type*> (allocatedData + channelListSize);
@@ -1051,7 +1051,7 @@ private:
auto channelListSize = sizeof (Type*) * (size_t) (numChannels + 1); auto channelListSize = sizeof (Type*) * (size_t) (numChannels + 1);
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32;
allocatedData.malloc (allocatedBytes); allocatedData.malloc (allocatedBytes);
channels = reinterpret_cast<Type**> (allocatedData.getData());
channels = reinterpret_cast<Type**> (allocatedData.get());
auto* chan = (Type*) (allocatedData + channelListSize); auto* chan = (Type*) (allocatedData + channelListSize);
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -1076,7 +1076,7 @@ private:
else else
{ {
allocatedData.malloc ((size_t) numChannels + 1, sizeof (Type*)); allocatedData.malloc ((size_t) numChannels + 1, sizeof (Type*));
channels = reinterpret_cast<Type**> (allocatedData.getData());
channels = reinterpret_cast<Type**> (allocatedData.get());
} }
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)


+ 3
- 3
modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp View File

@@ -1068,9 +1068,9 @@ public:
#else #else
// These tests deliberately operate on misaligned memory and will be flagged up by // These tests deliberately operate on misaligned memory and will be flagged up by
// checks for undefined behavior! // checks for undefined behavior!
ValueType* const data1 = addBytesToPointer (buffer1.getData(), random.nextInt (16));
ValueType* const data2 = addBytesToPointer (buffer2.getData(), random.nextInt (16));
int* const int1 = addBytesToPointer (buffer3.getData(), random.nextInt (16));
ValueType* const data1 = addBytesToPointer (buffer1.get(), random.nextInt (16));
ValueType* const data2 = addBytesToPointer (buffer2.get(), random.nextInt (16));
int* const int1 = addBytesToPointer (buffer3.get(), random.nextInt (16));
#endif #endif
fillRandomly (random, data1, num); fillRandomly (random, data1, num);


+ 2
- 2
modules/juce_audio_devices/native/juce_android_Midi.cpp View File

@@ -89,9 +89,9 @@ public:
jbyte* data = getEnv()->GetByteArrayElements (byteArray, nullptr); jbyte* data = getEnv()->GetByteArrayElements (byteArray, nullptr);
HeapBlock<uint8> buffer (static_cast<size_t> (len)); HeapBlock<uint8> buffer (static_cast<size_t> (len));
std::memcpy (buffer.getData(), data + offset, static_cast<size_t> (len));
std::memcpy (buffer.get(), data + offset, static_cast<size_t> (len));
midiConcatenator.pushMidiData (buffer.getData(),
midiConcatenator.pushMidiData (buffer.get(),
len, static_cast<double> (timestamp) * 1.0e-9, len, static_cast<double> (timestamp) * 1.0e-9,
juceMidiInput, *callback); juceMidiInput, *callback);


+ 4
- 4
modules/juce_audio_devices/native/juce_android_OpenSL.cpp View File

@@ -308,7 +308,7 @@ public:
nextBlock.set (0); nextBlock.set (0);
numBlocksOut.set (0); numBlocksOut.set (0);
zeromem (nativeBuffer.getData(), static_cast<size_t> (owner.bufferSize * numChannels * owner.numBuffers) * sizeof (T));
zeromem (nativeBuffer.get(), static_cast<size_t> (owner.bufferSize * numChannels * owner.numBuffers) * sizeof (T));
scratchBuffer.clear(); scratchBuffer.clear();
(*queue)->Clear (queue); (*queue)->Clear (queue);
} }
@@ -321,7 +321,7 @@ public:
bool isBufferAvailable() const { return (numBlocksOut.get() < owner.numBuffers); } bool isBufferAvailable() const { return (numBlocksOut.get() < owner.numBuffers); }
T* getNextBuffer() { nextBlock.set((nextBlock.get() + 1) % owner.numBuffers); return getCurrentBuffer(); } T* getNextBuffer() { nextBlock.set((nextBlock.get() + 1) % owner.numBuffers); return getCurrentBuffer(); }
T* getCurrentBuffer() { return nativeBuffer.getData() + (static_cast<size_t> (nextBlock.get()) * getBufferSizeInSamples()); }
T* getCurrentBuffer() { return nativeBuffer.get() + (static_cast<size_t> (nextBlock.get()) * getBufferSizeInSamples()); }
size_t getBufferSizeInSamples() const { return static_cast<size_t> (owner.bufferSize * numChannels); } size_t getBufferSizeInSamples() const { return static_cast<size_t> (owner.bufferSize * numChannels); }
void finished (SLAndroidSimpleBufferQueueItf) void finished (SLAndroidSimpleBufferQueueItf)
@@ -1203,11 +1203,11 @@ public:
pthread_t startThread (void* (*entry) (void*), void* userPtr) pthread_t startThread (void* (*entry) (void*), void* userPtr)
{ {
memset (buffer.getData(), 0, static_cast<size_t> (sizeof (int16) * static_cast<size_t> (bufferSize * numBuffers)));
memset (buffer.get(), 0, static_cast<size_t> (sizeof (int16) * static_cast<size_t> (bufferSize * numBuffers)));
for (int i = 0; i < numBuffers; ++i) for (int i = 0; i < numBuffers; ++i)
{ {
int16* dst = buffer.getData() + (bufferSize * i);
int16* dst = buffer.get() + (bufferSize * i);
(*queue)->Enqueue (queue, dst, static_cast<SLuint32> (static_cast<size_t> (bufferSize) * sizeof (int16))); (*queue)->Enqueue (queue, dst, static_cast<SLuint32> (static_cast<size_t> (bufferSize) * sizeof (int16)));
} }


+ 2
- 2
modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp View File

@@ -228,7 +228,7 @@ public:
for (int i = 0; i < numStreams; ++i) for (int i = 0; i < numStreams; ++i)
{ {
const ::AudioBuffer& b = bufList->mBuffers[i];
auto& b = bufList->mBuffers[i];
for (unsigned int j = 0; j < b.mNumberChannels; ++j) for (unsigned int j = 0; j < b.mNumberChannels; ++j)
{ {
@@ -733,7 +733,7 @@ public:
} }
} }
callback->audioDeviceIOCallback (const_cast<const float**> (tempInputBuffers.getData()),
callback->audioDeviceIOCallback (const_cast<const float**> (tempInputBuffers.get()),
numInputChans, numInputChans,
tempOutputBuffers, tempOutputBuffers,
numOutputChans, numOutputChans,


+ 2
- 2
modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp View File

@@ -389,11 +389,11 @@ public:
caLayout.malloc (1, static_cast<size_t> (sizeOfLayout)); caLayout.malloc (1, static_cast<size_t> (sizeOfLayout));
status = AudioFileGetProperty (audioFileID, kAudioFilePropertyChannelLayout, status = AudioFileGetProperty (audioFileID, kAudioFilePropertyChannelLayout,
&sizeOfLayout, caLayout.getData());
&sizeOfLayout, caLayout.get());
if (status == noErr) if (status == noErr)
{ {
auto fileLayout = CoreAudioLayouts::fromCoreAudio (*caLayout.getData());
auto fileLayout = CoreAudioLayouts::fromCoreAudio (*caLayout.get());
if (fileLayout.size() == static_cast<int> (numChannels)) if (fileLayout.size() == static_cast<int> (numChannels))
{ {


+ 2
- 2
modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp View File

@@ -449,14 +449,14 @@ public:
if (samplesToWrite[i] == nullptr) if (samplesToWrite[i] == nullptr)
break; break;
int* const destData = temp.getData() + i * (size_t) numSamples;
int* const destData = temp.get() + i * (size_t) numSamples;
channels[i] = destData; channels[i] = destData;
for (int j = 0; j < numSamples; ++j) for (int j = 0; j < numSamples; ++j)
destData[j] = (samplesToWrite[i][j] >> bitsToShift); destData[j] = (samplesToWrite[i][j] >> bitsToShift);
} }
samplesToWrite = const_cast<const int**> (channels.getData());
samplesToWrite = const_cast<const int**> (channels.get());
} }
return FLAC__stream_encoder_process (encoder, (const FLAC__int32**) samplesToWrite, (unsigned) numSamples) != 0; return FLAC__stream_encoder_process (encoder, (const FLAC__int32**) samplesToWrite, (unsigned) numSamples) != 0;


+ 2
- 2
modules/juce_audio_formats/format/juce_AudioFormatReader.cpp View File

@@ -262,8 +262,8 @@ int64 AudioFormatReader::searchForLevel (int64 startSample,
HeapBlock<int> tempSpace (bufferSize * 2 + 64); HeapBlock<int> tempSpace (bufferSize * 2 + 64);
int* tempBuffer[3]; int* tempBuffer[3];
tempBuffer[0] = tempSpace.getData();
tempBuffer[1] = tempSpace.getData() + bufferSize;
tempBuffer[0] = tempSpace.get();
tempBuffer[1] = tempSpace.get() + bufferSize;
tempBuffer[2] = 0; tempBuffer[2] = 0;
int consecutive = 0; int consecutive = 0;


+ 3
- 3
modules/juce_audio_processors/format_types/juce_AU_Shared.h View File

@@ -84,12 +84,12 @@ struct AudioUnitHelpers
layoutMapPtrStorage.calloc (static_cast<size_t> (numBuses)); layoutMapPtrStorage.calloc (static_cast<size_t> (numBuses));
layoutMapStorage.calloc (static_cast<size_t> (isInput ? totalInChannels : totalOutChannels)); layoutMapStorage.calloc (static_cast<size_t> (isInput ? totalInChannels : totalOutChannels));
layoutMap = layoutMapPtrStorage. getData();
layoutMap = layoutMapPtrStorage. get();
int ch = 0; int ch = 0;
for (int busIdx = 0; busIdx < numBuses; ++busIdx) for (int busIdx = 0; busIdx < numBuses; ++busIdx)
{ {
layoutMap[busIdx] = layoutMapStorage.getData() + ch;
layoutMap[busIdx] = layoutMapStorage.get() + ch;
ch += processor.getChannelCountOfBus (isInput, busIdx); ch += processor.getChannelCountOfBus (isInput, busIdx);
} }
} }
@@ -138,7 +138,7 @@ struct AudioUnitHelpers
{ {
pushIdx = 0; pushIdx = 0;
popIdx = 0; popIdx = 0;
zeromem (channels.getData(), sizeof(float*) * static_cast<size_t> (scratch.getNumChannels()));
zeromem (channels.get(), sizeof(float*) * static_cast<size_t> (scratch.getNumChannels()));
} }
//============================================================================== //==============================================================================


+ 8
- 8
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm View File

@@ -581,7 +581,7 @@ public:
dataSize = expectedSize; dataSize = expectedSize;
err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_AudioChannelLayout, scope, err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_AudioChannelLayout, scope,
static_cast<UInt32> (i), layoutBuffer.getData(), &dataSize);
static_cast<UInt32> (i), layoutBuffer.get(), &dataSize);
if (err != noErr || dataSize < expectedSize) if (err != noErr || dataSize < expectedSize)
return false; return false;
@@ -834,7 +834,7 @@ public:
AudioUnitRenderActionFlags flags = 0; AudioUnitRenderActionFlags flags = 0;
if (AUBuffer* buf = outputBufferList[i]) if (AUBuffer* buf = outputBufferList[i])
AudioUnitRender (audioUnit, &flags, &timeStamp, static_cast<UInt32> (i), (UInt32) numSamples, buf->bufferList.getData());
AudioUnitRender (audioUnit, &flags, &timeStamp, static_cast<UInt32> (i), (UInt32) numSamples, buf->bufferList.get());
} }
timeStamp.mSampleTime += numSamples; timeStamp.mSampleTime += numSamples;
@@ -1232,14 +1232,14 @@ private:
AUBuffer (size_t numBuffers) AUBuffer (size_t numBuffers)
{ {
bufferList.calloc (1, (sizeof (AudioBufferList) - sizeof (::AudioBuffer)) + (sizeof (::AudioBuffer) * numBuffers)); bufferList.calloc (1, (sizeof (AudioBufferList) - sizeof (::AudioBuffer)) + (sizeof (::AudioBuffer) * numBuffers));
AudioBufferList& buffer = *bufferList.getData();
AudioBufferList& buffer = *bufferList.get();
buffer.mNumberBuffers = static_cast<UInt32> (numBuffers); buffer.mNumberBuffers = static_cast<UInt32> (numBuffers);
} }
operator AudioBufferList&() operator AudioBufferList&()
{ {
return *bufferList.getData();
return *bufferList.get();
} }
HeapBlock<AudioBufferList> bufferList; HeapBlock<AudioBufferList> bufferList;
@@ -1721,7 +1721,7 @@ private:
propertySize = static_cast<UInt32> (sizeof (AudioChannelLayoutTag) * numElements); propertySize = static_cast<UInt32> (sizeof (AudioChannelLayoutTag) * numElements);
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_SupportedChannelLayoutTags, scope, if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_SupportedChannelLayoutTags, scope,
static_cast<UInt32> (busIdx), layoutTags.getData(), &propertySize) == noErr)
static_cast<UInt32> (busIdx), layoutTags.get(), &propertySize) == noErr)
{ {
for (int j = 0; j < static_cast<int> (numElements); ++j) for (int j = 0; j < static_cast<int> (numElements); ++j)
{ {
@@ -1757,15 +1757,15 @@ private:
channelInfos.malloc (static_cast<size_t> (numChannelInfos)); channelInfos.malloc (static_cast<size_t> (numChannelInfos));
propertySize = static_cast<UInt32> (sizeof (AUChannelInfo) * static_cast<size_t> (numChannelInfos)); propertySize = static_cast<UInt32> (sizeof (AUChannelInfo) * static_cast<size_t> (numChannelInfos));
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_SupportedNumChannels, kAudioUnitScope_Global, 0, channelInfos.getData(), &propertySize) != noErr)
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_SupportedNumChannels, kAudioUnitScope_Global, 0, channelInfos.get(), &propertySize) != noErr)
numChannelInfos = 0; numChannelInfos = 0;
} }
else else
{ {
numChannelInfos = 1; numChannelInfos = 1;
channelInfos.malloc (static_cast<size_t> (numChannelInfos)); channelInfos.malloc (static_cast<size_t> (numChannelInfos));
channelInfos.getData()->inChannels = -1;
channelInfos.getData()->outChannels = -1;
channelInfos.get()->inChannels = -1;
channelInfos.get()->outChannels = -1;
} }
} }
} }


+ 2
- 2
modules/juce_audio_processors/format_types/juce_VSTCommon.h View File

@@ -171,7 +171,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
return *this; return *this;
} }
const VstSpeakerConfiguration& get() const { return *storage.getData(); }
const VstSpeakerConfiguration& get() const { return *storage.get(); }
private: private:
JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder) JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder)
@@ -184,7 +184,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
+ sizeof (VstIndividualSpeakerInfo) * static_cast<size_t> (jmax (8, numChannels) - 8); + sizeof (VstIndividualSpeakerInfo) * static_cast<size_t> (jmax (8, numChannels) - 8);
storage.malloc (1, arrangementSize); storage.malloc (1, arrangementSize);
return storage.getData();
return storage.get();
} }
void clear() void clear()


+ 5
- 5
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -1547,8 +1547,8 @@ private:
HeapBlock<VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true); HeapBlock<VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
auto* inArr = inArrBlock.getData();
auto* outArr = outArrBlock.getData();
auto* inArr = inArrBlock.get();
auto* outArr = outArrBlock.get();
if (! getSpeakerArrangementWrapper (effect, inArr, outArr)) if (! getSpeakerArrangementWrapper (effect, inArr, outArr))
inArr = outArr = nullptr; inArr = outArr = nullptr;
@@ -1611,8 +1611,8 @@ private:
{ {
HeapBlock<VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true); HeapBlock<VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
auto* inArr = inArrBlock.getData();
auto* outArr = outArrBlock.getData();
auto* inArr = inArrBlock.get();
auto* outArr = outArrBlock.get();
if (getSpeakerArrangementWrapper (effect, inArr, outArr)) if (getSpeakerArrangementWrapper (effect, inArr, outArr))
return true; return true;
@@ -1746,7 +1746,7 @@ private:
// always ensure that the buffer is at least as large as the maximum number of channels // always ensure that the buffer is at least as large as the maximum number of channels
auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels); auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels);
auto channels = channelBuffer.getData();
auto channels = channelBuffer.get();
if (numChannels < maxChannels) if (numChannels < maxChannels)
{ {


+ 6
- 6
modules/juce_core/containers/juce_Array.h View File

@@ -358,12 +358,12 @@ public:
int indexOf (ParameterType elementToLookFor) const int indexOf (ParameterType elementToLookFor) const
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const ElementType* e = data.elements.getData();
const ElementType* e = data.elements.get();
const ElementType* const end_ = e + numUsed; const ElementType* const end_ = e + numUsed;
for (; e != end_; ++e) for (; e != end_; ++e)
if (elementToLookFor == *e) if (elementToLookFor == *e)
return static_cast<int> (e - data.elements.getData());
return static_cast<int> (e - data.elements.get());
return -1; return -1;
} }
@@ -376,7 +376,7 @@ public:
bool contains (ParameterType elementToLookFor) const bool contains (ParameterType elementToLookFor) const
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const ElementType* e = data.elements.getData();
const ElementType* e = data.elements.get();
const ElementType* const end_ = e + numUsed; const ElementType* const end_ = e + numUsed;
for (; e != end_; ++e) for (; e != end_; ++e)
@@ -719,8 +719,8 @@ public:
void resize (const int targetNumItems) void resize (const int targetNumItems)
{ {
jassert (targetNumItems >= 0); jassert (targetNumItems >= 0);
auto numToAdd = targetNumItems - numUsed;
const int numToAdd = targetNumItems - numUsed;
if (numToAdd > 0) if (numToAdd > 0)
insertMultiple (numUsed, ElementType(), numToAdd); insertMultiple (numUsed, ElementType(), numToAdd);
else if (numToAdd < 0) else if (numToAdd < 0)
@@ -743,7 +743,7 @@ public:
int addSorted (ElementComparator& comparator, ParameterType newElement) int addSorted (ElementComparator& comparator, ParameterType newElement)
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed);
auto index = findInsertIndexInSortedArray (comparator, data.elements.get(), newElement, 0, numUsed);
insert (index, newElement); insert (index, newElement);
return index; return index;
} }
@@ -1197,7 +1197,7 @@ public:
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
sortArray (comparator, data.elements.get(), 0, size() - 1, retainOrderOfEquivalentItems);
} }
//============================================================================== //==============================================================================


+ 6
- 6
modules/juce_core/containers/juce_OwnedArray.h View File

@@ -233,12 +233,12 @@ public:
int indexOf (const ObjectClass* objectToLookFor) const noexcept int indexOf (const ObjectClass* objectToLookFor) const noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ObjectClass* const* e = data.elements.getData();
ObjectClass* const* e = data.elements.get();
ObjectClass* const* const end_ = e + numUsed; ObjectClass* const* const end_ = e + numUsed;
for (; e != end_; ++e) for (; e != end_; ++e)
if (objectToLookFor == *e) if (objectToLookFor == *e)
return static_cast<int> (e - data.elements.getData());
return static_cast<int> (e - data.elements.get());
return -1; return -1;
} }
@@ -251,7 +251,7 @@ public:
bool contains (const ObjectClass* objectToLookFor) const noexcept bool contains (const ObjectClass* objectToLookFor) const noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ObjectClass* const* e = data.elements.getData();
ObjectClass* const* e = data.elements.get();
ObjectClass* const* const end_ = e + numUsed; ObjectClass* const* const end_ = e + numUsed;
for (; e != end_; ++e) for (; e != end_; ++e)
@@ -526,7 +526,7 @@ public:
ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
const int index = findInsertIndexInSortedArray (comparator, data.elements.get(), newObject, 0, numUsed);
insert (index, newObject); insert (index, newObject);
return index; return index;
} }
@@ -648,7 +648,7 @@ public:
void removeObject (const ObjectClass* objectToRemove, bool deleteObject = true) void removeObject (const ObjectClass* objectToRemove, bool deleteObject = true)
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ObjectClass** const e = data.elements.getData();
ObjectClass** const e = data.elements.get();
for (int i = 0; i < numUsed; ++i) for (int i = 0; i < numUsed; ++i)
{ {
@@ -858,7 +858,7 @@ public:
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
sortArray (comparator, data.elements.get(), 0, size() - 1, retainOrderOfEquivalentItems);
} }
//============================================================================== //==============================================================================


+ 6
- 6
modules/juce_core/containers/juce_ReferenceCountedArray.h View File

@@ -274,13 +274,13 @@ public:
int indexOf (const ObjectClass* const objectToLookFor) const noexcept int indexOf (const ObjectClass* const objectToLookFor) const noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ObjectClass** e = data.elements.getData();
ObjectClass** e = data.elements.get();
ObjectClass** const endPointer = e + numUsed; ObjectClass** const endPointer = e + numUsed;
while (e != endPointer) while (e != endPointer)
{ {
if (objectToLookFor == *e) if (objectToLookFor == *e)
return static_cast<int> (e - data.elements.getData());
return static_cast<int> (e - data.elements.get());
++e; ++e;
} }
@@ -296,7 +296,7 @@ public:
bool contains (const ObjectClass* const objectToLookFor) const noexcept bool contains (const ObjectClass* const objectToLookFor) const noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
ObjectClass** e = data.elements.getData();
ObjectClass** e = data.elements.get();
ObjectClass** const endPointer = e + numUsed; ObjectClass** const endPointer = e + numUsed;
while (e != endPointer) while (e != endPointer)
@@ -483,7 +483,7 @@ public:
int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
const int index = findInsertIndexInSortedArray (comparator, data.elements.get(), newObject, 0, numUsed);
insert (index, newObject); insert (index, newObject);
return index; return index;
} }
@@ -498,7 +498,7 @@ public:
ObjectClass* newObject) noexcept ObjectClass* newObject) noexcept
{ {
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
const int index = findInsertIndexInSortedArray (comparator, data.elements.get(), newObject, 0, numUsed);
if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0) if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
set (index - 1, newObject); // replace an existing object that matches set (index - 1, newObject); // replace an existing object that matches
@@ -843,7 +843,7 @@ public:
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
const ScopedLockType lock (getLock()); const ScopedLockType lock (getLock());
sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
sortArray (comparator, data.elements.get(), 0, size() - 1, retainOrderOfEquivalentItems);
} }
//============================================================================== //==============================================================================


+ 1
- 1
modules/juce_core/native/juce_mac_Files.mm View File

@@ -237,7 +237,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
HeapBlock<char> buffer; HeapBlock<char> buffer;
buffer.calloc (size + 8); buffer.calloc (size + 8);
_NSGetExecutablePath (buffer.getData(), &size);
_NSGetExecutablePath (buffer.get(), &size);
return File (String::fromUTF8 (buffer, (int) size)); return File (String::fromUTF8 (buffer, (int) size));
} }


+ 3
- 3
modules/juce_core/native/juce_mac_Strings.mm View File

@@ -32,8 +32,8 @@ String String::fromCFString (CFStringRef cfString)
HeapBlock<UInt8> utf8 ((size_t) bytesNeeded + 1); HeapBlock<UInt8> utf8 ((size_t) bytesNeeded + 1);
CFStringGetBytes (cfString, range, kCFStringEncodingUTF8, 0, false, utf8, bytesNeeded + 1, nullptr); CFStringGetBytes (cfString, range, kCFStringEncodingUTF8, 0, false, utf8, bytesNeeded + 1, nullptr);
return String (CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.getData()),
CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.getData() + bytesNeeded));
return String (CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.get()),
CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.get() + bytesNeeded));
} }
CFStringRef String::toCFString() const CFStringRef String::toCFString() const
@@ -89,7 +89,7 @@ String String::convertToPrecomposedUnicode() const
bytesNeeded, &bytesRead, bytesNeeded, &bytesRead,
&outputBufferSize, tempOut) == noErr) &outputBufferSize, tempOut) == noErr)
{ {
result = String (CharPointer_UTF16 ((CharPointer_UTF16::CharType*) tempOut.getData()));
result = String (CharPointer_UTF16 ((CharPointer_UTF16::CharType*) tempOut.get()));
} }
DisposeUnicodeToTextInfo (&conversionInfo); DisposeUnicodeToTextInfo (&conversionInfo);


+ 1
- 1
modules/juce_core/native/juce_mac_SystemStats.mm View File

@@ -144,7 +144,7 @@ String SystemStats::getDeviceDescription()
{ {
HeapBlock<char> model (size); HeapBlock<char> model (size);
if (sysctlbyname ("hw.model", model, &size, nullptr, 0) >= 0) if (sysctlbyname ("hw.model", model, &size, nullptr, 0) >= 0)
return model.getData();
return model.get();
} }
return {}; return {};
#endif #endif


+ 2
- 2
modules/juce_core/network/juce_URL.cpp View File

@@ -61,12 +61,12 @@ struct FallbackDownloadTask : public URL::DownloadTask,
const int max = jmin ((int) bufferSize, contentLength < 0 ? std::numeric_limits<int>::max() const int max = jmin ((int) bufferSize, contentLength < 0 ? std::numeric_limits<int>::max()
: static_cast<int> (contentLength - downloaded)); : static_cast<int> (contentLength - downloaded));
const int actual = stream->read (buffer.getData(), max);
const int actual = stream->read (buffer.get(), max);
if (actual < 0 || threadShouldExit() || stream->isError()) if (actual < 0 || threadShouldExit() || stream->isError())
break; break;
if (! fileStream->write (buffer.getData(), static_cast<size_t> (actual)))
if (! fileStream->write (buffer.get(), static_cast<size_t> (actual)))
{ {
error = true; error = true;
break; break;


+ 2
- 2
modules/juce_core/text/juce_String.cpp View File

@@ -1868,7 +1868,7 @@ String String::formattedRaw (const char* pf, ...)
#if JUCE_ANDROID #if JUCE_ANDROID
HeapBlock<char> temp (bufferSize); HeapBlock<char> temp (bufferSize);
int num = (int) vsnprintf (temp.getData(), bufferSize - 1, pf, args);
int num = (int) vsnprintf (temp.get(), bufferSize - 1, pf, args);
if (num >= static_cast<int> (bufferSize)) if (num >= static_cast<int> (bufferSize))
num = -1; num = -1;
#else #else
@@ -1880,7 +1880,7 @@ String String::formattedRaw (const char* pf, ...)
#else #else
vswprintf vswprintf
#endif #endif
(temp.getData(), bufferSize - 1, wideCharVersion.toWideCharPointer(), args);
(temp.get(), bufferSize - 1, wideCharVersion.toWideCharPointer(), args);
#endif #endif
va_end (args); va_end (args);


+ 1
- 1
modules/juce_graphics/geometry/juce_PathIterator.cpp View File

@@ -51,7 +51,7 @@ PathFlatteningIterator::~PathFlatteningIterator()
bool PathFlatteningIterator::isLastInSubpath() const noexcept bool PathFlatteningIterator::isLastInSubpath() const noexcept
{ {
return stackPos == stackBase.getData()
return stackPos == stackBase.get()
&& (index >= path.numElements || isMarker (points[index], Path::moveMarker)); && (index >= path.numElements || isMarker (points[index], Path::moveMarker));
} }


+ 2
- 2
modules/juce_graphics/native/juce_RenderingHelpers.h View File

@@ -996,10 +996,10 @@ namespace EdgeTableFillers
} }
y = y_; y = y_;
generate (scratchBuffer.getData(), x, width);
generate (scratchBuffer.get(), x, width);
et.clipLineToMask (x, y_, et.clipLineToMask (x, y_,
reinterpret_cast<uint8*> (scratchBuffer.getData()) + SrcPixelType::indexA,
reinterpret_cast<uint8*> (scratchBuffer.get()) + SrcPixelType::indexA,
sizeof (SrcPixelType), width); sizeof (SrcPixelType), width);
} }


+ 1
- 1
modules/juce_opengl/opengl/juce_OpenGLImage.cpp View File

@@ -156,7 +156,7 @@ private:
DataReleaser* r = new DataReleaser (frameBuffer, x, y, bitmapData.width, bitmapData.height); DataReleaser* r = new DataReleaser (frameBuffer, x, y, bitmapData.width, bitmapData.height);
bitmapData.dataReleaser = r; bitmapData.dataReleaser = r;
bitmapData.data = (uint8*) r->data.getData();
bitmapData.data = (uint8*) r->data.get();
bitmapData.lineStride = (bitmapData.width * bitmapData.pixelStride + 3) & ~3; bitmapData.lineStride = (bitmapData.width * bitmapData.pixelStride + 3) & ~3;
ReaderType::read (frameBuffer, bitmapData, x, y); ReaderType::read (frameBuffer, bitmapData, x, y);


Loading…
Cancel
Save