From 48ffccb8b8e4d7336f747eecdef0e32e08c4cab6 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 8 Nov 2012 16:35:56 +0000 Subject: [PATCH] Minor cleanups. --- modules/juce_core/containers/juce_NamedValueSet.cpp | 6 ++++-- modules/juce_core/native/juce_posix_SharedCode.h | 4 ++++ modules/juce_data_structures/values/juce_ValueTree.cpp | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/juce_core/containers/juce_NamedValueSet.cpp b/modules/juce_core/containers/juce_NamedValueSet.cpp index 27a5232b9e..91567f607a 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.cpp +++ b/modules/juce_core/containers/juce_NamedValueSet.cpp @@ -149,8 +149,10 @@ const var& NamedValueSet::operator[] (const Identifier& name) const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const { - const var* const v = getVarPointer (name); - return v != nullptr ? *v : defaultReturnValue; + if (const var* const v = getVarPointer (name)) + return *v; + + return defaultReturnValue; } var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 85bffbe899..4744ca66c3 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -517,6 +517,10 @@ void FileOutputStream::flushInternal() status = getResultForErrno(); #if JUCE_ANDROID + // This stuff tells the OS to asynchronously update the metadata + // that the OS has cached aboud the file - this metadata is used + // when the device is acting as a USB drive, and unless it's explicitly + // refreshed, it'll get out of step with the real file. const LocalRef t (javaString (file.getFullPathName())); android.activity.callVoidMethod (JuceAppActivity.scanFile, t.get()); #endif diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index e94e86c858..2caa9c9870 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -987,6 +987,7 @@ ValueTree ValueTree::readFromStream (InputStream& input) } const int numChildren = input.readCompressedInt(); + v.object->children.ensureStorageAllocated (numChildren); for (int i = 0; i < numChildren; ++i) {