diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index 33a05340db..dd1d63a1b8 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -676,8 +676,13 @@ var var::readFromStream (InputStream& input) case varMarker_Binary: { MemoryBlock mb (numBytes - 1); - const int numRead = input.read (mb.getData(), numBytes - 1); - mb.setSize (numRead); + + if (numBytes > 1) + { + const int numRead = input.read (mb.getData(), numBytes - 1); + mb.setSize (numRead); + } + return var (mb); } diff --git a/modules/juce_events/broadcasters/juce_ListenerList.h b/modules/juce_events/broadcasters/juce_ListenerList.h index bb5117cb81..c06c9f718c 100644 --- a/modules/juce_events/broadcasters/juce_ListenerList.h +++ b/modules/juce_events/broadcasters/juce_ListenerList.h @@ -263,6 +263,27 @@ public: (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); } + //============================================================================== + /** Calls a member function on each listener in the list, with 5 parameters. */ + template + void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) + { + for (Iterator iter (*this); iter.next();) + (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); + } + + /** Calls a member function on each listener in the list, with 5 parameters and a bail-out-checker. + See the class description for info about writing a bail-out checker. */ + template + void callChecked (const BailOutCheckerType& bailOutChecker, + void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) + { + for (Iterator iter (*this); iter.next (bailOutChecker);) + (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); + } + //============================================================================== /** A dummy bail-out checker that always returns false. diff --git a/modules/juce_graphics/colour/juce_Colour.cpp b/modules/juce_graphics/colour/juce_Colour.cpp index 8da7189e9c..598330087a 100644 --- a/modules/juce_graphics/colour/juce_Colour.cpp +++ b/modules/juce_graphics/colour/juce_Colour.cpp @@ -201,7 +201,9 @@ Colour::Colour (const uint8 red, const uint8 green, const uint8 blue, const floa Colour Colour::fromFloatRGBA (const float red, const float green, const float blue, const float alpha) noexcept { - return Colour (ColourHelpers::floatToUInt8 (red), ColourHelpers::floatToUInt8 (green), ColourHelpers::floatToUInt8 (blue), alpha); + return Colour (ColourHelpers::floatToUInt8 (red), + ColourHelpers::floatToUInt8 (green), + ColourHelpers::floatToUInt8 (blue), alpha); } Colour::Colour (const float hue, const float saturation, const float brightness, const float alpha) noexcept