]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/SGExpression.cxx
Fix use count for deleted, reference counted objects.
[simgear.git] / simgear / structure / SGExpression.cxx
index b14a5a50190568615947f92aa6f8c508514cb5bc..2633e311fdd7a646688e021d1ed7d53fb20fdc3d 100644 (file)
@@ -27,7 +27,6 @@
 #include "Singleton.hxx"
 
 #include <algorithm>
-#include <functional>
 #include <map>
 #include <utility>
 #include <string>
@@ -370,7 +369,7 @@ SGReadExpression(SGPropertyNode *inputRoot, const SGPropertyNode *expression)
             SG_LOG(SG_IO, SG_ALERT, "Cannot read \"" << name << "\" expression: no input found");
             return 0;
         }
-        
+
         SGSharedPtr<SGExpression<T> > inputExpression;
         inputExpression = SGReadExpression<T>(inputRoot, inputNode);
         if (!inputExpression) {
@@ -866,24 +865,7 @@ Expression* logicopParser(const SGPropertyNode* exp, Parser* parser)
 ExpParserRegistrar andRegistrar("and", logicopParser<AndExpression>);
 ExpParserRegistrar orRegistrar("or", logicopParser<OrExpression>);
 
-Expression* notLogicopParser(const SGPropertyNode* exp, Parser* parser)
-{
-    using namespace boost;
-    vector<Expression*> children;
-    parser->readChildren(exp, children);
-    vector<Expression*>::iterator notBool =
-        find_if(children.begin(), children.end(),
-                boost::bind(&Expression::getType, _1) != BOOL);
-    if (notBool != children.end() || children.size() != 1)
-        throw("non boolean operand to not expression");
-    NotExpression *expr = new NotExpression;
-    expr->setOperand(static_cast< ::SGExpression<bool>*>(children[0]));
-    return expr;
-}
-
-ExpParserRegistrar notRegistrar("not", notLogicopParser);
-
-int BindingLayout::addBinding(const string& name, Type type)
+size_t BindingLayout::addBinding(const string& name, Type type)
 {
     //XXX error checkint
     vector<VariableBinding>::iterator itr
@@ -891,7 +873,7 @@ int BindingLayout::addBinding(const string& name, Type type)
                   boost::bind(&VariableBinding::name, _1) == name);
     if (itr != bindings.end())
         return itr->location;
-    int result = bindings.size();
+    size_t result = bindings.size();
     bindings.push_back(VariableBinding(name, type, bindings.size()));
     return result;
 }