Fix some compiler warnings. size_t/int/unsigned conversions and extra ';'
This commit is contained in:
@@ -158,7 +158,7 @@ inline bool validateName(const string& name)
|
||||
static char *
|
||||
copy_string (const char * s)
|
||||
{
|
||||
unsigned long int slen = strlen(s);
|
||||
size_t slen = strlen(s);
|
||||
char * copy = new char[slen + 1];
|
||||
|
||||
// the source string length is known so no need to check for '\0'
|
||||
@@ -181,15 +181,15 @@ template<typename Itr>
|
||||
static int
|
||||
find_child (Itr begin, Itr end, int index, const PropertyList& nodes)
|
||||
{
|
||||
int nNodes = nodes.size();
|
||||
size_t nNodes = nodes.size();
|
||||
boost::iterator_range<Itr> name(begin, end);
|
||||
for (int i = 0; i < nNodes; i++) {
|
||||
for (size_t i = 0; i < nNodes; i++) {
|
||||
SGPropertyNode * node = nodes[i];
|
||||
|
||||
// searching for a matching index is a lot less time consuming than
|
||||
// comparing two strings so do that first.
|
||||
if (node->getIndex() == index && boost::equals(node->getName(), name))
|
||||
return i;
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -200,10 +200,10 @@ find_child (Itr begin, Itr end, int index, const PropertyList& nodes)
|
||||
static int
|
||||
find_last_child (const char * name, const PropertyList& nodes)
|
||||
{
|
||||
int nNodes = nodes.size();
|
||||
size_t nNodes = nodes.size();
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < nNodes; i++) {
|
||||
for (size_t i = 0; i < nNodes; i++) {
|
||||
SGPropertyNode * node = nodes[i];
|
||||
if (compare_strings(node->getName(), name))
|
||||
{
|
||||
@@ -1008,9 +1008,9 @@ PropertyList
|
||||
SGPropertyNode::getChildren (const char * name) const
|
||||
{
|
||||
PropertyList children;
|
||||
int max = _children.size();
|
||||
size_t max = _children.size();
|
||||
|
||||
for (int i = 0; i < max; i++)
|
||||
for (size_t i = 0; i < max; i++)
|
||||
if (compare_strings(_children[i]->getName(), name))
|
||||
children.push_back(_children[i]);
|
||||
|
||||
@@ -1066,7 +1066,7 @@ SGPropertyNode::removeChildren (const char * name, bool keep)
|
||||
{
|
||||
PropertyList children;
|
||||
|
||||
for (int pos = _children.size() - 1; pos >= 0; pos--)
|
||||
for (int pos = static_cast<int>(_children.size() - 1); pos >= 0; pos--)
|
||||
if (compare_strings(_children[pos]->getName(), name))
|
||||
children.push_back(removeChild(pos, keep));
|
||||
|
||||
@@ -2214,7 +2214,7 @@ SGPropertyNode::fireChildRemoved (SGPropertyNode * parent,
|
||||
|
||||
SGPropertyChangeListener::~SGPropertyChangeListener ()
|
||||
{
|
||||
for (int i = _properties.size() - 1; i >= 0; i--)
|
||||
for (int i = static_cast<int>(_properties.size() - 1); i >= 0; i--)
|
||||
_properties[i]->removeChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// particles.cxx - classes to manage particles
|
||||
// started in 2008 by Tiago Gusm<73>o, using animation.hxx as reference
|
||||
// Copyright (C) 2008 Tiago Gusm<73>o
|
||||
// started in 2008 by Tiago Gusm<73>o, using animation.hxx as reference
|
||||
// Copyright (C) 2008 Tiago Gusm<73>o
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
@@ -79,7 +79,7 @@ SGConstPropertyNode_ptr GlobalParticleCallback::enabledNode = 0;
|
||||
|
||||
osg::ref_ptr<osg::Group> Particles::commonRoot;
|
||||
osg::ref_ptr<osgParticle::ParticleSystemUpdater> Particles::psu = new osgParticle::ParticleSystemUpdater;
|
||||
osg::ref_ptr<osg::Geode> Particles::commonGeode = new osg::Geode;;
|
||||
osg::ref_ptr<osg::Geode> Particles::commonGeode = new osg::Geode;
|
||||
osg::Vec3 Particles::_wind;
|
||||
bool Particles::_frozen = false;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace UpdateInterval
|
||||
static const double SuccessfulAttempt = 24*60*60;
|
||||
// interval in seconds to allow another update after a failed attempt (10 minutes)
|
||||
static const double FailedAttempt = 10*60;
|
||||
};
|
||||
}
|
||||
|
||||
typedef map<string,time_t> CompletedTiles;
|
||||
|
||||
@@ -110,7 +110,7 @@ string stripPath(string path)
|
||||
{
|
||||
// svn doesn't like trailing white-spaces or path separators - strip them!
|
||||
path = simgear::strutils::strip(path);
|
||||
int slen = path.length();
|
||||
size_t slen = path.length();
|
||||
while ((slen>0)&&
|
||||
((path[slen-1]=='/')||(path[slen-1]=='\\')))
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ inline void gamma_correct_rgb(float *color,
|
||||
color[0] = pow(color[0], tmp);
|
||||
color[1] = pow(color[1], tmp);
|
||||
color[2] = pow(color[2], tmp);
|
||||
};
|
||||
}
|
||||
|
||||
inline void gamma_correct_c(float *color,
|
||||
float reff = 2.5, float system = system_gamma)
|
||||
@@ -53,7 +53,7 @@ inline void gamma_correct_c(float *color,
|
||||
return;
|
||||
|
||||
*color = pow(*color, reff/system);
|
||||
};
|
||||
}
|
||||
|
||||
inline void gamma_restore_rgb(float *color,
|
||||
float reff = 2.5, float system = system_gamma)
|
||||
@@ -65,7 +65,7 @@ inline void gamma_restore_rgb(float *color,
|
||||
color[0] = pow(color[0], tmp);
|
||||
color[1] = pow(color[1], tmp);
|
||||
color[2] = pow(color[2], tmp);
|
||||
};
|
||||
}
|
||||
|
||||
inline void gamma_restore_c(float *color,
|
||||
float reff = 2.5, float system = system_gamma)
|
||||
@@ -74,7 +74,7 @@ inline void gamma_restore_c(float *color,
|
||||
return;
|
||||
|
||||
*color = pow(*color, system/reff);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // _SG_COLORS_HXX
|
||||
|
||||
@@ -196,11 +196,11 @@ private:
|
||||
template<typename T>
|
||||
class SGBinaryExpression : public SGExpression<T> {
|
||||
public:
|
||||
const SGExpression<T>* getOperand(unsigned i) const
|
||||
const SGExpression<T>* getOperand(size_t i) const
|
||||
{ return _expressions[i]; }
|
||||
SGExpression<T>* getOperand(unsigned i)
|
||||
SGExpression<T>* getOperand(size_t i)
|
||||
{ return _expressions[i]; }
|
||||
void setOperand(unsigned i, SGExpression<T>* expression)
|
||||
void setOperand(size_t i, SGExpression<T>* expression)
|
||||
{
|
||||
if (!expression)
|
||||
expression = new SGConstExpression<T>(T());
|
||||
@@ -229,16 +229,16 @@ private:
|
||||
template<typename T>
|
||||
class SGNaryExpression : public SGExpression<T> {
|
||||
public:
|
||||
unsigned getNumOperands() const
|
||||
size_t getNumOperands() const
|
||||
{ return _expressions.size(); }
|
||||
const SGExpression<T>* getOperand(unsigned i) const
|
||||
const SGExpression<T>* getOperand(size_t i) const
|
||||
{ return _expressions[i]; }
|
||||
SGExpression<T>* getOperand(unsigned i)
|
||||
SGExpression<T>* getOperand(size_t i)
|
||||
{ return _expressions[i]; }
|
||||
unsigned addOperand(SGExpression<T>* expression)
|
||||
size_t addOperand(SGExpression<T>* expression)
|
||||
{
|
||||
if (!expression)
|
||||
return ~unsigned(0);
|
||||
return ~size_t(0);
|
||||
_expressions.push_back(expression);
|
||||
return _expressions.size() - 1;
|
||||
}
|
||||
@@ -254,14 +254,14 @@ public:
|
||||
|
||||
virtual bool isConst() const
|
||||
{
|
||||
for (unsigned i = 0; i < _expressions.size(); ++i)
|
||||
for (size_t i = 0; i < _expressions.size(); ++i)
|
||||
if (!_expressions[i]->isConst())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
virtual SGExpression<T>* simplify()
|
||||
{
|
||||
for (unsigned i = 0; i < _expressions.size(); ++i)
|
||||
for (size_t i = 0; i < _expressions.size(); ++i)
|
||||
_expressions[i] = _expressions[i]->simplify();
|
||||
return SGExpression<T>::simplify();
|
||||
}
|
||||
@@ -782,8 +782,8 @@ public:
|
||||
virtual void eval(T& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
value = T(0);
|
||||
unsigned sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
size_t sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (size_t i = 0; i < sz; ++i)
|
||||
value += getOperand(i)->getValue(b);
|
||||
}
|
||||
using SGNaryExpression<T>::getValue;
|
||||
@@ -801,8 +801,8 @@ public:
|
||||
virtual void eval(T& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
value = getOperand(0)->getValue(b);
|
||||
unsigned sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (unsigned i = 1; i < sz; ++i)
|
||||
size_t sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (size_t i = 1; i < sz; ++i)
|
||||
value -= getOperand(i)->getValue(b);
|
||||
}
|
||||
using SGNaryExpression<T>::getValue;
|
||||
@@ -820,8 +820,8 @@ public:
|
||||
virtual void eval(T& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
value = T(1);
|
||||
unsigned sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
size_t sz = SGNaryExpression<T>::getNumOperands();
|
||||
for (size_t i = 0; i < sz; ++i)
|
||||
value *= getOperand(i)->getValue(b);
|
||||
}
|
||||
using SGNaryExpression<T>::getValue;
|
||||
@@ -838,12 +838,12 @@ public:
|
||||
{ }
|
||||
virtual void eval(T& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
unsigned sz = SGNaryExpression<T>::getNumOperands();
|
||||
size_t sz = SGNaryExpression<T>::getNumOperands();
|
||||
if (sz < 1)
|
||||
return;
|
||||
|
||||
value = getOperand(0)->getValue(b);
|
||||
for (unsigned i = 1; i < sz; ++i)
|
||||
for (size_t i = 1; i < sz; ++i)
|
||||
value = SGMisc<T>::min(value, getOperand(i)->getValue(b));
|
||||
}
|
||||
using SGNaryExpression<T>::getOperand;
|
||||
@@ -859,12 +859,12 @@ public:
|
||||
{ }
|
||||
virtual void eval(T& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
unsigned sz = SGNaryExpression<T>::getNumOperands();
|
||||
size_t sz = SGNaryExpression<T>::getNumOperands();
|
||||
if (sz < 1)
|
||||
return;
|
||||
|
||||
value = getOperand(0)->getValue(b);
|
||||
for (unsigned i = 1; i < sz; ++i)
|
||||
for (size_t i = 1; i < sz; ++i)
|
||||
value = SGMisc<T>::max(value, getOperand(i)->getValue(b));
|
||||
}
|
||||
using SGNaryExpression<T>::getOperand;
|
||||
@@ -1076,16 +1076,16 @@ namespace simgear
|
||||
class GeneralNaryExpression : public ::SGExpression<T> {
|
||||
public:
|
||||
typedef OpType operand_type;
|
||||
unsigned getNumOperands() const
|
||||
size_t getNumOperands() const
|
||||
{ return _expressions.size(); }
|
||||
const ::SGExpression<OpType>* getOperand(unsigned i) const
|
||||
const ::SGExpression<OpType>* getOperand(size_t i) const
|
||||
{ return _expressions[i]; }
|
||||
::SGExpression<OpType>* getOperand(unsigned i)
|
||||
::SGExpression<OpType>* getOperand(size_t i)
|
||||
{ return _expressions[i]; }
|
||||
unsigned addOperand(::SGExpression<OpType>* expression)
|
||||
size_t addOperand(::SGExpression<OpType>* expression)
|
||||
{
|
||||
if (!expression)
|
||||
return ~unsigned(0);
|
||||
return ~size_t(0);
|
||||
_expressions.push_back(expression);
|
||||
return _expressions.size() - 1;
|
||||
}
|
||||
@@ -1101,14 +1101,14 @@ namespace simgear
|
||||
|
||||
virtual bool isConst() const
|
||||
{
|
||||
for (unsigned i = 0; i < _expressions.size(); ++i)
|
||||
for (size_t i = 0; i < _expressions.size(); ++i)
|
||||
if (!_expressions[i]->isConst())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
virtual ::SGExpression<T>* simplify()
|
||||
{
|
||||
for (unsigned i = 0; i < _expressions.size(); ++i)
|
||||
for (size_t i = 0; i < _expressions.size(); ++i)
|
||||
_expressions[i] = _expressions[i]->simplify();
|
||||
return SGExpression<T>::simplify();
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ namespace simgear
|
||||
}
|
||||
virtual void eval(bool& value, const simgear::expression::Binding* b) const
|
||||
{
|
||||
unsigned sz = this->getNumOperands();
|
||||
size_t sz = this->getNumOperands();
|
||||
if (sz != 2)
|
||||
return;
|
||||
value = _pred(this->getOperand(0)->getValue(b),
|
||||
|
||||
Reference in New Issue
Block a user