maintenance: eliminated 19 compiler warnings

next
Scott Giese 2 years ago
parent e50337e36a
commit eb5499fb10

@ -79,13 +79,13 @@ void GridLayout::addItem(const LayoutItemRef& item)
if (isValidLocation(item->gridLocation())) {
// re-dimension as required
const auto itemEnd = item->gridEnd();
if (itemEnd.x() >= numColumns()) {
if (itemEnd.x() >= static_cast<int>(numColumns())) {
// expand columns
_dimensions.x() = itemEnd.x() + 1;
_columns.resize(_dimensions.x());
}
if (itemEnd.y() >= numRows()) {
if (itemEnd.y() >= static_cast<int>(numRows())) {
// expand rows
_dimensions.y() = itemEnd.y() + 1;
_rows.resize(_dimensions.y());
@ -149,7 +149,7 @@ SGVec2i GridLayout::innerFindUnusedLocation(const SGVec2i& curLoc)
void GridLayout::updateCells()
{
const auto dim = _dimensions.x() * _dimensions.y();
if (_cells.size() == dim) {
if (static_cast<int>(_cells.size()) == dim) {
return;
}
@ -317,7 +317,7 @@ size_t GridLayout::numColumns() const
//----------------------------------------------------------------------------
void GridLayout::setRowStretch(size_t index, int stretch)
{
if (index >= _dimensions.y()) {
if (static_cast<int>(index) >= _dimensions.y()) {
throw sg_range_exception("GridLayout::setRowStretch: invalid row");
}
@ -339,7 +339,7 @@ void GridLayout::setRowStretch(size_t index, int stretch)
void GridLayout::setColumnStretch(size_t index, int stretch)
{
if (index >= _dimensions.x()) {
if (static_cast<int>(index) >= _dimensions.x()) {
throw sg_range_exception("GridLayout::setColumnStretch: invalid column");
}
@ -591,14 +591,14 @@ void GridLayout::doLayout(const SGRecti& geom)
SGVec2i totalMinSize = {0, 0},
totalPreferredSize = {0, 0};
for (auto row = 0; row < _rows.size(); ++row) {
for (auto row = 0; row < static_cast<int>(_rows.size()); ++row) {
totalMinSize.y() += _rows.at(row).minSize;
totalPreferredSize.y() += _rows.at(row).hintSize;
rowStretchTotal += _rows.at(row).calcStretch;
availHeight -= _rows.at(row).padding;
}
for (auto col = 0; col < _columns.size(); ++col) {
for (auto col = 0; col < static_cast<int>(_columns.size()); ++col) {
totalMinSize.x() += _columns.at(col).minSize;
totalPreferredSize.x() += _columns.at(col).hintSize;
columnStretchTotal += _columns.at(col).calcStretch;
@ -627,7 +627,7 @@ void GridLayout::doLayout(const SGRecti& geom)
}
// distribute according to stretch factors
for (auto col = 0; col < _columns.size(); ++col) {
for (auto col = 0; col < static_cast<int>(_columns.size()); ++col) {
auto& c = _columns[col];
c.calcSize = havePreferredWidth ? c.hintSize : c.minSize;
c.calcSize += (toDistribute.x() * c.calcStretch) / columnStretchTotal;
@ -642,7 +642,7 @@ void GridLayout::doLayout(const SGRecti& geom)
// re-calcualate row min/preferred now? Or is it not dependant?
for (auto row = 0; row < _rows.size(); ++row) {
for (auto row = 0; row < static_cast<int>(_rows.size()); ++row) {
auto& r = _rows[row];
r.calcSize = havePreferredHeight ? r.hintSize : r.minSize;
r.calcSize += (toDistribute.y() * r.calcStretch) / rowStretchTotal;

@ -55,7 +55,7 @@ class TestThreadRecipient : public simgear::Emesary::IReceiver
simgear::Emesary::ITransmitter* transmitter;
public:
TestThreadRecipient(simgear::Emesary::ITransmitter* _transmitter, bool addDuringReceive)
: transmitter(_transmitter), addDuringReceive(addDuringReceive), receiveCount(0), ourType("TestThread")
: transmitter(_transmitter), ourType("TestThread"), addDuringReceive(addDuringReceive), receiveCount(0)
{
r1 = new TestThreadBaseRecipient();
}
@ -89,8 +89,8 @@ public:
class EmesaryTestThread : public SGThread
{
public:
EmesaryTestThread(simgear::Emesary::ITransmitter* transmitter, bool _addDuringReceive) : addDuringReceive(_addDuringReceive), transmitter(transmitter) {
EmesaryTestThread(simgear::Emesary::ITransmitter* transmitter, bool _addDuringReceive)
: transmitter(transmitter), addDuringReceive(_addDuringReceive) {
}
protected:
simgear::Emesary::ITransmitter* transmitter;
@ -218,7 +218,7 @@ public:
virtual simgear::Emesary::ReceiptStatus Receive(simgear::Emesary::INotificationPtr n)
{
if (n->GetType() == "Test")
if (std::string{n->GetType()} == std::string{"Test"})
{
auto tbn = dynamic_pointer_cast<TestBaseNotification>(n);
SG_CHECK_EQUAL(receiveCount, tbn->index);
@ -295,7 +295,7 @@ void testEmesaryMultipleRecipients()
SG_CHECK_EQUAL(0, r->receiveCount);
});
}
SG_CHECK_NE(rcount, globalTransmitter->SentMessageCount());
SG_CHECK_NE(rcount, static_cast<int>(globalTransmitter->SentMessageCount()));
rcount = globalTransmitter->SentMessageCount();
{

@ -55,7 +55,7 @@ void SGProgram::apply(osg::State& state) const
if (!infoLog.empty()) {
// log all the shader source file names, to help in debugging link errors
std::ostringstream os;
for (int i = 0; i < getNumShaders(); ++i) {
for (uint i = 0; i < getNumShaders(); ++i) {
const auto shader = getShader(i);
os << "\t" << shader->getFileName() << "\n";
}
@ -66,7 +66,7 @@ void SGProgram::apply(osg::State& state) const
_effectFilePath);
}
for (int i = 0; i < getNumShaders(); ++i) {
for (uint i = 0; i < getNumShaders(); ++i) {
const auto shader = getShader(i);
auto pcs = shader->getPCS(state);

Loading…
Cancel
Save