mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Used MemoryBlock::isEmpty() in a few places
This commit is contained in:
parent
b2b1685ca6
commit
0fc1ede50f
12 changed files with 20 additions and 20 deletions
|
|
@ -975,7 +975,7 @@ public:
|
|||
|
||||
void copyBuffersFromReservoir (float** destBuffers, int numDestBuffers, int bufferSize)
|
||||
{
|
||||
if ((numChannels <= 0 && bufferSize == 0) || reservoir.getSize() == 0)
|
||||
if ((numChannels <= 0 && bufferSize == 0) || reservoir.isEmpty())
|
||||
return;
|
||||
|
||||
int offset = jmax (0, bufferSize - getNumSamplesInReservoir());
|
||||
|
|
|
|||
|
|
@ -728,9 +728,9 @@ private:
|
|||
// to be able to seek back to write the header
|
||||
jassert (couldSeekOk);
|
||||
|
||||
auto headerLen = (int) (54 + (markChunk.getSize() > 0 ? markChunk.getSize() + 8 : 0)
|
||||
+ (comtChunk.getSize() > 0 ? comtChunk.getSize() + 8 : 0)
|
||||
+ (instChunk.getSize() > 0 ? instChunk.getSize() + 8 : 0));
|
||||
auto headerLen = (int) (54 + (markChunk.isEmpty() ? 0 : markChunk.getSize() + 8)
|
||||
+ (comtChunk.isEmpty() ? 0 : comtChunk.getSize() + 8)
|
||||
+ (instChunk.isEmpty() ? 0 : instChunk.getSize() + 8));
|
||||
auto audioBytes = (int) (lengthInSamples * ((bitsPerSample * numChannels) / 8));
|
||||
audioBytes += (audioBytes & 1);
|
||||
|
||||
|
|
@ -786,21 +786,21 @@ private:
|
|||
|
||||
output->write (sampleRateBytes, 10);
|
||||
|
||||
if (markChunk.getSize() > 0)
|
||||
if (! markChunk.isEmpty())
|
||||
{
|
||||
output->writeInt (chunkName ("MARK"));
|
||||
output->writeIntBigEndian ((int) markChunk.getSize());
|
||||
*output << markChunk;
|
||||
}
|
||||
|
||||
if (comtChunk.getSize() > 0)
|
||||
if (! comtChunk.isEmpty())
|
||||
{
|
||||
output->writeInt (chunkName ("COMT"));
|
||||
output->writeIntBigEndian ((int) comtChunk.getSize());
|
||||
*output << comtChunk;
|
||||
}
|
||||
|
||||
if (instChunk.getSize() > 0)
|
||||
if (! instChunk.isEmpty())
|
||||
{
|
||||
output->writeInt (chunkName ("INST"));
|
||||
output->writeIntBigEndian ((int) instChunk.getSize());
|
||||
|
|
|
|||
|
|
@ -1509,7 +1509,7 @@ private:
|
|||
usesFloatingPointData = (bitsPerSample == 32);
|
||||
}
|
||||
|
||||
static size_t chunkSize (const MemoryBlock& data) noexcept { return data.getSize() > 0 ? (8 + data.getSize()) : 0; }
|
||||
static size_t chunkSize (const MemoryBlock& data) noexcept { return data.isEmpty() ? 0 : (8 + data.getSize()); }
|
||||
|
||||
void writeChunkHeader (int chunkType, int size) const
|
||||
{
|
||||
|
|
@ -1519,7 +1519,7 @@ private:
|
|||
|
||||
void writeChunk (const MemoryBlock& data, int chunkType, int size = 0) const
|
||||
{
|
||||
if (data.getSize() > 0)
|
||||
if (! data.isEmpty())
|
||||
{
|
||||
writeChunkHeader (chunkType, size != 0 ? size : (int) data.getSize());
|
||||
*output << data;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ public:
|
|||
|
||||
jbyteArray postDataArray = nullptr;
|
||||
|
||||
if (postData.getSize() > 0)
|
||||
if (! postData.isEmpty())
|
||||
{
|
||||
postDataArray = env->NewByteArray (static_cast<jsize> (postData.getSize()));
|
||||
env->SetByteArrayRegion (postDataArray, 0, static_cast<jsize> (postData.getSize()), (const jbyte*) postData.getData());
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public:
|
|||
//==============================================================================
|
||||
// Input Stream overrides
|
||||
bool isError() const { return curl == nullptr || lastError != CURLE_OK; }
|
||||
bool isExhausted() { return (isError() || finished) && curlBuffer.getSize() == 0; }
|
||||
bool isExhausted() { return (isError() || finished) && curlBuffer.isEmpty(); }
|
||||
int64 getPosition() { return streamPos; }
|
||||
int64 getTotalLength() { return contentLength; }
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ public:
|
|||
|
||||
// step until either: 1) there is an error 2) the transaction is complete
|
||||
// or 3) data is in the in buffer
|
||||
while ((! finished) && curlBuffer.getSize() == 0)
|
||||
while ((! finished) && curlBuffer.isEmpty())
|
||||
{
|
||||
{
|
||||
const ScopedLock lock (cleanupLock);
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,7 @@ private:
|
|||
postData,
|
||||
addParametersToRequestBody);
|
||||
|
||||
if (postData.getSize() > 0)
|
||||
if (! postData.isEmpty())
|
||||
[req setHTTPBody: [NSData dataWithBytes: postData.getData()
|
||||
length: postData.getSize()]];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ URL URL::getChildURL (const String& subPath) const
|
|||
|
||||
bool URL::hasBodyDataToSend() const
|
||||
{
|
||||
return filesToUpload.size() > 0 || postData.getSize() > 0;
|
||||
return filesToUpload.size() > 0 || ! postData.isEmpty();
|
||||
}
|
||||
|
||||
void URL::createHeadersAndPostData (String& headers,
|
||||
|
|
@ -466,7 +466,7 @@ void URL::createHeadersAndPostData (String& headers,
|
|||
if (filesToUpload.size() > 0)
|
||||
{
|
||||
// (this doesn't currently support mixing custom post-data with uploads..)
|
||||
jassert (postData.getSize() == 0);
|
||||
jassert (postData.isEmpty());
|
||||
|
||||
auto boundary = String::toHexString (Random::getSystemRandom().nextInt64());
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const cha
|
|||
|
||||
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data)
|
||||
{
|
||||
if (data.getSize() > 0)
|
||||
if (! data.isEmpty())
|
||||
stream.write (data.getData(), data.getSize());
|
||||
|
||||
return stream;
|
||||
|
|
|
|||
|
|
@ -829,7 +829,7 @@ Image juce_loadWithCoreImage (InputStream& input)
|
|||
MemoryBlockHolder::Ptr memBlockHolder = new MemoryBlockHolder();
|
||||
input.readIntoMemoryBlock (memBlockHolder->block, -1);
|
||||
|
||||
if (memBlockHolder->block.getSize() == 0)
|
||||
if (memBlockHolder->block.isEmpty())
|
||||
return {};
|
||||
|
||||
#if JUCE_IOS
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ void WebBrowserComponent::reloadLastURL()
|
|||
{
|
||||
if (lastURL.isNotEmpty())
|
||||
{
|
||||
goToURL (lastURL, &lastHeaders, lastPostData.getSize() == 0 ? nullptr : &lastPostData);
|
||||
goToURL (lastURL, &lastHeaders, lastPostData.isEmpty() ? nullptr : &lastPostData);
|
||||
lastURL.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ private:
|
|||
{
|
||||
String method ("GET");
|
||||
|
||||
if (urlRequest.postData.getSize() > 0)
|
||||
if (! urlRequest.postData.isEmpty())
|
||||
{
|
||||
method = "POST";
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ void OnlineUnlockStatus::load()
|
|||
MemoryBlock mb;
|
||||
mb.fromBase64Encoding (getState());
|
||||
|
||||
if (mb.getSize() > 0)
|
||||
if (! mb.isEmpty())
|
||||
status = ValueTree::readFromGZIPData (mb.getData(), mb.getSize());
|
||||
else
|
||||
status = ValueTree (stateTagName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue