Use !strcmp for all property name comparisons.
This commit is contained in:
parent
d0d3b2bd7a
commit
f65f1800c7
2 changed files with 10 additions and 8 deletions
|
@ -26,6 +26,8 @@
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <string.h> // for strcmp()
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/misc/exception.hxx>
|
#include <simgear/misc/exception.hxx>
|
||||||
|
|
||||||
|
@ -313,7 +315,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
t->table = new SGInterpTable();
|
t->table = new SGInterpTable();
|
||||||
for(int i = 0; i < trans_table->nChildren(); i++) {
|
for(int i = 0; i < trans_table->nChildren(); i++) {
|
||||||
const SGPropertyNode * node = trans_table->getChild(i);
|
const SGPropertyNode * node = trans_table->getChild(i);
|
||||||
if (string(node->getName()) == "entry") {
|
if (!strcmp(node->getName(), "entry")) {
|
||||||
double ind = node->getDoubleValue("ind", 0.0);
|
double ind = node->getDoubleValue("ind", 0.0);
|
||||||
double dep = node->getDoubleValue("dep", 0.0);
|
double dep = node->getDoubleValue("dep", 0.0);
|
||||||
SG_LOG( SG_COCKPIT, SG_INFO, "Adding interpolation entry "
|
SG_LOG( SG_COCKPIT, SG_INFO, "Adding interpolation entry "
|
||||||
|
@ -485,7 +487,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
for (int i = 0; i < node->nChildren(); i++) {
|
for (int i = 0; i < node->nChildren(); i++) {
|
||||||
const SGPropertyNode * child = node->getChild(i);
|
const SGPropertyNode * child = node->getChild(i);
|
||||||
cerr << "Trying child " << child->getName() << endl;
|
cerr << "Trying child " << child->getName() << endl;
|
||||||
if (string(child->getName()) == "layer") {
|
if (!strcmp(child->getName(), "layer")) {
|
||||||
cerr << "succeeded!" << endl;
|
cerr << "succeeded!" << endl;
|
||||||
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
||||||
}
|
}
|
||||||
|
@ -516,7 +518,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
int nChunks = chunk_group->nChildren();
|
int nChunks = chunk_group->nChildren();
|
||||||
for (int i = 0; i < nChunks; i++) {
|
for (int i = 0; i < nChunks; i++) {
|
||||||
const SGPropertyNode * node = chunk_group->getChild(i);
|
const SGPropertyNode * node = chunk_group->getChild(i);
|
||||||
if (string(node->getName()) == "chunk") {
|
if (!strcmp(node->getName(), "chunk")) {
|
||||||
FGTextLayer::Chunk * chunk = readTextChunk(node);
|
FGTextLayer::Chunk * chunk = readTextChunk(node);
|
||||||
if (chunk != 0)
|
if (chunk != 0)
|
||||||
tlayer->addChunk(chunk);
|
tlayer->addChunk(chunk);
|
||||||
|
@ -576,7 +578,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
int nTransformations = trans_group->nChildren();
|
int nTransformations = trans_group->nChildren();
|
||||||
for (int i = 0; i < nTransformations; i++) {
|
for (int i = 0; i < nTransformations; i++) {
|
||||||
const SGPropertyNode * node = trans_group->getChild(i);
|
const SGPropertyNode * node = trans_group->getChild(i);
|
||||||
if (string(node->getName()) == "transformation") {
|
if (!strcmp(node->getName(), "transformation")) {
|
||||||
FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
|
FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
|
||||||
if (t != 0)
|
if (t != 0)
|
||||||
layer->addTransformation(t);
|
layer->addTransformation(t);
|
||||||
|
@ -645,7 +647,7 @@ readInstrument (const SGPropertyNode * node)
|
||||||
int nActions = action_group->nChildren();
|
int nActions = action_group->nChildren();
|
||||||
for (int i = 0; i < nActions; i++) {
|
for (int i = 0; i < nActions; i++) {
|
||||||
const SGPropertyNode * node = action_group->getChild(i);
|
const SGPropertyNode * node = action_group->getChild(i);
|
||||||
if (string(node->getName()) == "action") {
|
if (!strcmp(node->getName(), "action")) {
|
||||||
FGPanelAction * action = readAction(node, w_scale, h_scale);
|
FGPanelAction * action = readAction(node, w_scale, h_scale);
|
||||||
if (action != 0)
|
if (action != 0)
|
||||||
instrument->addAction(action);
|
instrument->addAction(action);
|
||||||
|
@ -664,7 +666,7 @@ readInstrument (const SGPropertyNode * node)
|
||||||
int nLayers = layer_group->nChildren();
|
int nLayers = layer_group->nChildren();
|
||||||
for (int i = 0; i < nLayers; i++) {
|
for (int i = 0; i < nLayers; i++) {
|
||||||
const SGPropertyNode * node = layer_group->getChild(i);
|
const SGPropertyNode * node = layer_group->getChild(i);
|
||||||
if (string(node->getName()) == "layer") {
|
if (!strcmp(node->getName(), "layer")) {
|
||||||
FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
|
FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
|
||||||
if (layer != 0)
|
if (layer != 0)
|
||||||
instrument->addLayer(layer);
|
instrument->addLayer(layer);
|
||||||
|
@ -783,7 +785,7 @@ readPanel (const SGPropertyNode * root)
|
||||||
int nInstruments = instrument_group->nChildren();
|
int nInstruments = instrument_group->nChildren();
|
||||||
for (int i = 0; i < nInstruments; i++) {
|
for (int i = 0; i < nInstruments; i++) {
|
||||||
const SGPropertyNode * node = instrument_group->getChild(i);
|
const SGPropertyNode * node = instrument_group->getChild(i);
|
||||||
if (string(node->getName()) == "instrument") {
|
if (!strcmp(node->getName(), "instrument")) {
|
||||||
FGPanelInstrument * instrument = readInstrument(node);
|
FGPanelInstrument * instrument = readInstrument(node);
|
||||||
if (instrument != 0)
|
if (instrument != 0)
|
||||||
panel->addInstrument(instrument);
|
panel->addInstrument(instrument);
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool FGMaterialLib::load( const string& mpath ) {
|
||||||
int nMaterials = materials.nChildren();
|
int nMaterials = materials.nChildren();
|
||||||
for (int i = 0; i < nMaterials; i++) {
|
for (int i = 0; i < nMaterials; i++) {
|
||||||
const SGPropertyNode * node = materials.getChild(i);
|
const SGPropertyNode * node = materials.getChild(i);
|
||||||
if (string(node->getName()) == "material") {
|
if (!strcmp(node->getName(), "material")) {
|
||||||
FGNewMat * m = new FGNewMat(node);
|
FGNewMat * m = new FGNewMat(node);
|
||||||
|
|
||||||
vector<const SGPropertyNode *>names = node->getChildren("name");
|
vector<const SGPropertyNode *>names = node->getChildren("name");
|
||||||
|
|
Loading…
Reference in a new issue