1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Prevented some implicit casts to bool using JUCE_STRICT_REFCOUNTEDPOINTER

This commit is contained in:
Tom Poole 2018-07-16 17:45:00 +01:00
parent bc244b23de
commit c5862246b7
5 changed files with 14 additions and 8 deletions

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);
}

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
};

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);

View file

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

View file

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