Browse Source

Prevented some implicit casts to bool using JUCE_STRICT_REFCOUNTEDPOINTER

tags/2021-05-28
Tom Poole 7 years ago
parent
commit
c5862246b7
5 changed files with 14 additions and 8 deletions
  1. +5
    -5
      modules/juce_core/maths/juce_Expression.cpp
  2. +6
    -0
      modules/juce_core/memory/juce_ReferenceCountedObject.h
  3. +1
    -1
      modules/juce_gui_basics/menus/juce_BurgerMenuComponent.cpp
  4. +1
    -1
      modules/juce_gui_extra/native/juce_android_PushNotifications.cpp
  5. +1
    -1
      modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp

+ 5
- 5
modules/juce_core/maths/juce_Expression.cpp View File

@@ -863,7 +863,7 @@ struct Expression::Helpers
return parseError ("Expected parameters after \"" + identifier + " (\"");
}
f->parameters.add (Expression (param));
f->parameters.add (Expression (param.get()));
while (readOperator (","))
{
@@ -872,7 +872,7 @@ struct Expression::Helpers
if (param == nullptr)
return parseError ("Expected expression after \",\"");
f->parameters.add (Expression (param));
f->parameters.add (Expression (param.get()));
}
if (readOperator (")"))
@@ -972,7 +972,7 @@ Expression::Expression (const String& stringToParse, String& parseError)
Expression Expression::parse (String::CharPointerType& stringToParse, String& parseError)
{
Helpers::Parser parser (stringToParse);
Expression e (parser.readUpToComma());
Expression e (parser.readUpToComma().get());
parseError = parser.error;
return e;
}
@@ -1006,7 +1006,7 @@ Expression Expression::operator+ (const Expression& other) const { return Expre
Expression Expression::operator- (const Expression& other) const { return Expression (new Helpers::Subtract (term, other.term)); }
Expression Expression::operator* (const Expression& other) const { return Expression (new Helpers::Multiply (term, other.term)); }
Expression Expression::operator/ (const Expression& other) const { return Expression (new Helpers::Divide (term, other.term)); }
Expression Expression::operator-() const { return Expression (term->negated()); }
Expression Expression::operator-() const { return Expression (term->negated().get()); }
Expression Expression::symbol (const String& symbol) { return Expression (new Helpers::SymbolTerm (symbol)); }
Expression Expression::function (const String& functionName, const Array<Expression>& parameters)
@@ -1034,7 +1034,7 @@ Expression Expression::adjustedToGiveNewResult (const double targetValue, const
if (const Term* parent = Helpers::findDestinationFor (newTerm.get(), termToAdjust))
{
if (Helpers::TermPtr reverseTerm = parent->createTermToEvaluateInput (scope, termToAdjust, targetValue, newTerm.get()))
termToAdjust->value = Expression (reverseTerm).evaluate (scope);
termToAdjust->value = Expression (reverseTerm.get()).evaluate (scope);
else
return Expression (targetValue);
}


+ 6
- 0
modules/juce_core/memory/juce_ReferenceCountedObject.h View File

@@ -442,6 +442,12 @@ private:
if (o != nullptr && o->decReferenceCountWithoutDeleting())
ContainerDeletePolicy<ReferencedType>::destroy (o);
}
#if JUCE_STRICT_REFCOUNTEDPOINTER
// Unimplemented. This declaration prevents an unintended cast by making
// operator bool() ambiguous.
operator ReferencedType*() const noexcept;
#endif
};


+ 1
- 1
modules/juce_gui_basics/menus/juce_BurgerMenuComponent.cpp View File

@@ -43,7 +43,7 @@ struct CustomMenuBarItemHolder : public Component
if (newComponent != custom)
{
if (custom != nullptr)
removeChildComponent (custom);
removeChildComponent (custom.get());
custom = newComponent;
addAndMakeVisible (*custom);


+ 1
- 1
modules/juce_gui_extra/native/juce_android_PushNotifications.cpp View File

@@ -1332,7 +1332,7 @@ struct PushNotifications::Pimpl
}
}
return var (dynamicObject);
return var (dynamicObject.get());
}
return {};


+ 1
- 1
modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp View File

@@ -229,7 +229,7 @@ namespace PushNotificationsDelegateDetails
propsVarObject->setProperty (propertyName, properties.getValueAt (i));
}
return var (propsVarObject);
return var (propsVarObject.get());
}
//==============================================================================


Loading…
Cancel
Save