diff --git a/src/osgPlugins/txp/trpage_compat.cpp b/src/osgPlugins/txp/trpage_compat.cpp index ea37b993b..ff1161553 100644 --- a/src/osgPlugins/txp/trpage_compat.cpp +++ b/src/osgPlugins/txp/trpage_compat.cpp @@ -102,17 +102,18 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf) } // Now convert to the new style material table - for (i=0;i(shortTable.size());i++) + { trpgShortMaterial &shortMat = shortTable[i]; trpgMaterial &baseMat = baseMats[shortMat.baseMat]; matTables.push_back(baseMat); trpgMaterial &newMat = matTables[matTables.size()-1]; newMat.SetNumTexture(shortMat.texids.size()); - for (j=0;j(shortMats.size());i++) + { + trpgShortMaterial &sMat = shortMats[i]; + buf.Add(sMat.baseMat); + buf.Add((int)(sMat.texids.size())); + for (unsigned int j=0;j= materials.size()) return false; + if (!isValid() || id < 0 || static_cast(id) >= materials.size()) return false; m = materials[id]; if (m < 0) { m = -m - 1; @@ -341,7 +341,7 @@ bool trpgGeometry::GetNumVertex(int &v) const } bool trpgGeometry::GetVertices(float32 *v) const { - int i; + unsigned int i; if (!isValid()) return false; if (vertDataFloat.size() != 0) @@ -354,7 +354,7 @@ bool trpgGeometry::GetVertices(float32 *v) const } bool trpgGeometry::GetVertices(float64 *v) const { - int i; + unsigned int i; if (!isValid()) return false; if (vertDataFloat.size() != 0) @@ -367,7 +367,7 @@ bool trpgGeometry::GetVertices(float64 *v) const } bool trpgGeometry::GetVertices(osg::Vec3* v) const { - int i; + unsigned int i; if (!isValid()) return false; if (vertDataFloat.size() != 0) @@ -394,7 +394,7 @@ bool trpgGeometry::GetVertex(int n,trpg3dPoint &pt) const { int id = 3*n; int idMax = 3*n+2; - if (id < 0 || (idMax >= vertDataFloat.size() && idMax >= vertDataDouble.size())) + if (id < 0 || (static_cast(idMax) >= vertDataFloat.size() && static_cast(idMax) >= vertDataDouble.size())) return false; if (vertDataFloat.size() > vertDataDouble.size()) { pt.x = vertDataFloat[id]; @@ -419,7 +419,7 @@ bool trpgGeometry::GetNumNormal(int32 &n) const } bool trpgGeometry::GetNormals(float32 *v) const { - int i; + unsigned int i; if (!isValid()) return false; if (normDataFloat.size() != 0) @@ -432,7 +432,7 @@ bool trpgGeometry::GetNormals(float32 *v) const } bool trpgGeometry::GetNormals(float64 *v) const { - int i; + unsigned int i; if (!isValid()) return false; if (normDataFloat.size() != 0) @@ -446,7 +446,7 @@ bool trpgGeometry::GetNormals(float64 *v) const bool trpgGeometry::GetNormals(osg::Vec3* v) const { - int i; + unsigned int i; if (!isValid()) return false; if (normDataFloat.size() != 0) @@ -477,7 +477,7 @@ bool trpgGeometry::GetNumColorSets(int &n) const } bool trpgGeometry::GetColorSet(int id,trpgColorInfo *ci) const { - if (!isValid() || id < 0 || id >= colors.size()) return false; + if (!isValid() || id < 0 || static_cast(id) >= colors.size()) return false; *ci = colors[id]; return true; } @@ -489,7 +489,7 @@ bool trpgGeometry::GetNumTexCoordSets(int &n) const } bool trpgGeometry::GetTexCoordSet(int id,trpgTexData *tx) const { - if (!isValid() || id < 0 || id >= texData.size()) return false; + if (!isValid() || id < 0 || static_cast(id) >= texData.size()) return false; *tx = texData[id]; return true; } @@ -502,7 +502,7 @@ bool trpgGeometry::GetNumEdgeFlag(int &n) const bool trpgGeometry::GetEdgeFlags(char *e) const { if (!isValid()) return false; - for (int i=0;i 0) { buf.Begin(TRPG_GEOM_MATERIAL); buf.Add((int32)materials.size()); - for (i=0;i 0) { - for (i=0;i 0) { buf.Begin(TRPG_GEOM_EFLAG); buf.Add((int32)edgeFlags.size()); - for (i=0;i= tileSize.size()) return; + if (id < 0 || static_cast(id) >= tileSize.size()) return; tileSize[id] = pt; } void trpgHeader::SetOrigin(const trpg3dPoint &pt) @@ -203,7 +203,7 @@ bool trpgHeader::GetDbVersion(int32 &vmaj,int32 &vmin) const bool trpgHeader::GetTileSize(int id,trpg2dPoint &pt) const { if (!isValid()) return false; - if (id < 0 || id >= tileSize.size()) return false; + if (id < 0 || static_cast(id) >= tileSize.size()) return false; pt = tileSize[id]; return true; } diff --git a/src/osgPlugins/txp/trpage_light.cpp b/src/osgPlugins/txp/trpage_light.cpp index 4d4de9fa5..b360e331d 100644 --- a/src/osgPlugins/txp/trpage_light.cpp +++ b/src/osgPlugins/txp/trpage_light.cpp @@ -42,7 +42,7 @@ trpgLightAttr::trpgLightAttr(void) Reset(); } -trpgLightAttr::trpgLightAttr(const trpgLightAttr &in) +trpgLightAttr::trpgLightAttr(const trpgLightAttr &in):trpgReadWriteable() { operator=(in); } @@ -691,7 +691,7 @@ trpgLight::trpgLight(void) index = -1; } -trpgLight::trpgLight(const trpgLight &in) +trpgLight::trpgLight(const trpgLight &in):trpgReadWriteable() { operator=(in); } @@ -732,7 +732,7 @@ bool trpgLight::GetVertex(uint32 ix, trpg3dPoint &pt) const bool trpgLight::GetVertices(trpg3dPoint *pts) const { - int i; + unsigned int i; if (!isValid()) return false; @@ -745,8 +745,8 @@ bool trpgLight::GetVertices(trpg3dPoint *pts) const bool trpgLight::GetVertices(float64 *fts) const { - int i; - int j = 0; + unsigned int i; + unsigned int j = 0; if (!isValid()) return false; @@ -762,8 +762,8 @@ bool trpgLight::GetVertices(float64 *fts) const bool trpgLight::GetVertices(float32 *fts) const { - int i; - int j = 0; + unsigned int i; + unsigned int j = 0; if (!isValid()) return false; @@ -840,7 +840,7 @@ trpgLight& trpgLight::operator = (const trpgLight &in) Reset(); index = in.index; - for ( int i = 0; i < in.lightPoints.size(); i++ ) + for ( unsigned int i = 0; i < in.lightPoints.size(); i++ ) lightPoints.push_back(in.lightPoints[i]); return *this; @@ -856,7 +856,7 @@ trpgLightTable::trpgLightTable() { } -trpgLightTable::trpgLightTable(const trpgLightTable &in) +trpgLightTable::trpgLightTable(const trpgLightTable &in):trpgReadWriteable() { *this = in; } @@ -891,7 +891,7 @@ int trpgLightTable::AddLightAttr(const trpgLightAttr& inLight) } int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight) { - for (int i=0;i= lightList.size()) return NULL; + if (id < 0 || id >= static_cast(lightList.size())) return NULL; return &lightList[id]; } @@ -954,7 +954,7 @@ bool trpgLightTable::Read(trpgReadBuffer &buf) try { buf.Get(numLights); lightList.resize(numLights); - for (unsigned int i=0;i= texList.size()) return false; + if (id < 0 || id >= static_cast(texList.size())) return false; ret = texList[id]; return true; } const trpgTexture *trpgTexTable::GetTextureRef(int id) const { - if (id < 0 || id >= texList.size()) return NULL; + if (id < 0 || id >= static_cast(texList.size())) return NULL; return &texList[id]; } @@ -1518,7 +1516,7 @@ bool trpgTexTable::Read(trpgReadBuffer &buf) try { buf.Get(numTex); texList.resize(numTex); - for (unsigned int i=0;i= models.size()) + if (id < 0 || static_cast(id) >= models.size()) return; models[id] = mod; @@ -292,14 +292,14 @@ bool trpgModelTable::GetNumModels(int &nm) const } bool trpgModelTable::GetModel(int id,trpgModel &model) const { - if (!isValid() || id < 0 || id >= models.size()) + if (!isValid() || id < 0 || static_cast(id) >= models.size()) return false; model = models[id]; return true; } trpgModel *trpgModelTable::GetModelRef(int id) { - if (id < 0 || id >= models.size()) + if (id < 0 || static_cast(id) >= models.size()) return NULL; return &models[id]; } diff --git a/src/osgPlugins/txp/trpage_parse.cpp b/src/osgPlugins/txp/trpage_parse.cpp index cfcc6068d..91fec2661 100644 --- a/src/osgPlugins/txp/trpage_parse.cpp +++ b/src/osgPlugins/txp/trpage_parse.cpp @@ -211,7 +211,7 @@ bool trpgr_Parser::Parse(trpgReadBuffer &buf) class trpgSceneHelperPush : public trpgr_Callback { public: trpgSceneHelperPush(trpgSceneParser *in_parse) { parse = in_parse; }; - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken ,trpgReadBuffer &) { // Call the start children callback parse->StartChildren(parse->lastObject); parse->parents.push_back(parse->lastObject); @@ -225,7 +225,7 @@ protected: class trpgSceneHelperPop : public trpgr_Callback { public: trpgSceneHelperPop(trpgSceneParser *in_parse) { parse = in_parse; }; - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken ,trpgReadBuffer &) { // Make sure we don't have an extra pop if (parse->parents.size() == 0) // Note: let someone know about the extra pop @@ -246,7 +246,7 @@ protected: class trpgSceneHelperDefault : public trpgr_Callback { public: trpgSceneHelperDefault(trpgSceneParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken ,trpgReadBuffer &) { // Absorb it quietly return (void *)1; } diff --git a/src/osgPlugins/txp/trpage_print.cpp b/src/osgPlugins/txp/trpage_print.cpp index abcf2e7f6..45f204d9b 100644 --- a/src/osgPlugins/txp/trpage_print.cpp +++ b/src/osgPlugins/txp/trpage_print.cpp @@ -243,7 +243,7 @@ bool trpgTexTable::Print(trpgPrintBuffer &buf) const buf.prnLine("----Texture Table----"); buf.IncreaseIndent(); - for (int i=0;i= rangeList.size()) + if (id < 0 || id >= static_cast(rangeList.size())) return false; ret = rangeList[id]; @@ -225,7 +225,7 @@ bool trpgRangeTable::SetRange(int id,trpgRange &inRange) if (!isValid()) return false; - if (id < 0 || id >= rangeList.size()) + if (id < 0 || id >= static_cast(rangeList.size())) return false; rangeList[id] = inRange; @@ -242,7 +242,7 @@ int trpgRangeTable::AddRange(trpgRange &range) int trpgRangeTable::FindAddRange(trpgRange &range) { - for (int i=0;i(headLen)) return false; // Set up a parser // Catch the tables we need for the archive @@ -179,10 +179,10 @@ bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf // Reality check the address int32 numLods; header.GetNumLods(numLods); - if (lod >= numLods) return false; + if (lod >= static_cast(numLods)) return false; trpg2iPoint lodSize; header.GetLodSize(lod,lodSize); - if (x >= lodSize.x || y >= lodSize.y) return false; + if (x >= static_cast(lodSize.x) || y >= static_cast(lodSize.y)) return false; trpgTileTable::TileMode tileMode; tileTable.GetMode(tileMode); @@ -275,7 +275,7 @@ bool trpgr_Archive::trpgGetTileMBR(uint32 x,uint32 y,uint32 lod,trpg3dPoint &ll, header.GetNumLods(numLod); trpg2iPoint maxXY; header.GetLodSize(lod,maxXY); - if (x >= maxXY.x || y>= maxXY.y) + if (x >= static_cast(maxXY.x) || y>= static_cast(maxXY.y)) return false; trpg3dPoint origin; @@ -478,7 +478,7 @@ bool trpgrImageHelper::GetImagePath(const trpgTexture *tex,char *fullPath,int pa tex->GetName(name,nameLen); nameLen = strlen(name); - if (strlen(dir) + nameLen + 2 > pathLen) + if (strlen(dir) + nameLen + 2 > static_cast(pathLen)) return false; sprintf(fullPath,"%s" PATHSEPERATOR "%s",dir,name); diff --git a/src/osgPlugins/txp/trpage_readbuf.cpp b/src/osgPlugins/txp/trpage_readbuf.cpp index 87ab95e0f..6950b50f4 100644 --- a/src/osgPlugins/txp/trpage_readbuf.cpp +++ b/src/osgPlugins/txp/trpage_readbuf.cpp @@ -298,7 +298,7 @@ bool trpgReadBuffer::SkipToLimit() // See if the next read is going to blow the limits bool trpgReadBuffer::TestLimit(int len) { - for (int i=0;i limits[i]) return false; @@ -309,7 +309,7 @@ bool trpgReadBuffer::TestLimit(int len) // We just read a few bytes. Update the limits void trpgReadBuffer::UpdateLimits(int len) { - for (int i=0;i(len)) { valid = false; return false; } @@ -522,7 +522,7 @@ bool trpgrAppFile::Read(char *data,int32 offset,uint32 dataSize) return false; } // It's all right to read less than the whol data block - if (dataSize > len) + if (dataSize > static_cast(len)) return false; // Read the raw data diff --git a/src/osgPlugins/txp/trpage_scene.cpp b/src/osgPlugins/txp/trpage_scene.cpp index d9182f3ef..cd22c70fa 100644 --- a/src/osgPlugins/txp/trpage_scene.cpp +++ b/src/osgPlugins/txp/trpage_scene.cpp @@ -145,7 +145,7 @@ trpgReadGroupBase::~trpgReadGroupBase() // Delete all children void trpgReadGroupBase::DeleteChildren() { - for (int i=0;i= children.size()) + if (id < 0 || id >= static_cast(children.size())) return; children[id] = NULL; } @@ -167,7 +167,7 @@ void trpgReadGroupBase::unRefChild(int id) // Unref all the children (they've probably been moved elsewhere) void trpgReadGroupBase::unRefChildren() { - for (int i=0;i(&mbr); trpgMBR kmbr; // Ask the kids - for (int i=0;iGetMBR(); cmbr->Union(kmbr); } @@ -232,7 +232,7 @@ trpgMBR trpgReadGeometry::GetMBR() const class trpgReadGeometryHelper : public trpgr_Callback { public: trpgReadGeometryHelper(trpgSceneGraphParser *in_parse) { parse = in_parse;} - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadGeometry *geom = new trpgReadGeometry(); trpgGeometry *data = geom->GetData(); if (!data->Read(buf)) { @@ -261,7 +261,7 @@ protected: class trpgReadGroupHelper : public trpgr_Callback { public: trpgReadGroupHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadGroup *group = new trpgReadGroup(); trpgGroup *data = group->GetData(); if (!data->Read(buf)) { @@ -286,7 +286,7 @@ protected: class trpgReadBillboardHelper : public trpgr_Callback { public: trpgReadBillboardHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadBillboard *group = new trpgReadBillboard(); trpgBillboard *data = group->GetData(); if (!data->Read(buf)) { @@ -311,7 +311,7 @@ protected: class trpgReadAttachHelper : public trpgr_Callback { public: trpgReadAttachHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadAttach *attach = new trpgReadAttach(); trpgAttach *data = attach->GetData(); if (!data->Read(buf)) { @@ -336,7 +336,7 @@ protected: class trpgReadLodHelper : public trpgr_Callback { public: trpgReadLodHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadLod *lod = new trpgReadLod(); trpgLod *data = lod->GetData(); if (!data->Read(buf)) { @@ -361,7 +361,7 @@ protected: class trpgReadModelRefHelper : public trpgr_Callback { public: trpgReadModelRefHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) { trpgReadModelRef *mod = new trpgReadModelRef(); trpgModelRef *data = mod->GetData(); if (!data->Read(buf)) { @@ -381,7 +381,8 @@ protected: class trpgReadTileHeaderHelper : public trpgr_Callback { public: trpgReadTileHeaderHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; } - void *Parse(trpgToken tok,trpgReadBuffer &buf) { + void *Parse(trpgToken,trpgReadBuffer &buf) + { trpgReadTileHeader *th = parse->GetTileHeaderRef(); trpgTileHeader *data = th->GetData(); if (!data->Read(buf)) @@ -488,7 +489,7 @@ bool trpgSceneGraphParser::StartChildren(void *in_node) for the parent above the current one. If there isn't one, we'll just stick things in our top group. */ -bool trpgSceneGraphParser::EndChildren(void *in_node) +bool trpgSceneGraphParser::EndChildren(void *) { // We don't need it here, but this is the node we just // finished putting children under. If you need to close diff --git a/src/osgPlugins/txp/trpage_tile.cpp b/src/osgPlugins/txp/trpage_tile.cpp index 588ca46a5..a4533aac8 100644 --- a/src/osgPlugins/txp/trpage_tile.cpp +++ b/src/osgPlugins/txp/trpage_tile.cpp @@ -65,7 +65,7 @@ void trpgTileTable::SetNumLod(int numLod) void trpgTileTable::SetNumTiles(int nx,int ny,int lod) { - if (nx <= 0 || ny <= 0 || lod < 0 || lod >= lodInfo.size()) + if (nx <= 0 || ny <= 0 || lod < 0 || static_cast(lod) >= lodInfo.size()) return; // Got a table we need to maintain @@ -97,7 +97,7 @@ void trpgTileTable::SetNumTiles(int nx,int ny,int lod) } void trpgTileTable::SetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 zmin,float32 zmax) { - if (lod < 0 || lod >= lodInfo.size()) return; + if (lod < 0 || static_cast(lod) >= lodInfo.size()) return; if (mode != Local) return; LodInfo &li = lodInfo[lod]; @@ -129,7 +129,7 @@ bool trpgTileTable::GetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 &zm { if (!isValid()) return false; - if (lod < 0 || lod >= lodInfo.size()) return false; + if (lod < 0 || static_cast(lod) >= lodInfo.size()) return false; if (mode != Local) return false; const LodInfo &li = lodInfo[lod]; @@ -162,7 +162,7 @@ bool trpgTileTable::Write(trpgWriteBuffer &buf) buf.Add(numLod); // Write each terrain LOD set - for (unsigned int i=0;i= matList.size()) + if (no < 0 || static_cast(no) >= matList.size()) return; matList[no] = id; } void trpgTileHeader::SetModel(int no,int id) { - if (no < 0 || no >= modelList.size()) + if (no < 0 || static_cast(no) >= modelList.size()) return; modelList[no] = id; } @@ -274,7 +274,7 @@ void trpgTileHeader::SetModel(int no,int id) void trpgTileHeader::AddMaterial(int id) { // Look for it first - for (int i=0;i= locMats.size()) + if (id < 0 || static_cast(id) >= locMats.size()) return false; retMat = locMats[id]; @@ -333,7 +333,7 @@ bool trpgTileHeader::GetNumMaterial(int32 &no) const } bool trpgTileHeader::GetMaterial(int32 id,int32 &mat) const { - if (!isValid() || id < 0 || id >= matList.size()) + if (!isValid() || id < 0 || static_cast(id) >= matList.size()) return false; mat = matList[id]; return true; @@ -346,7 +346,7 @@ bool trpgTileHeader::GetNumModel(int32 &no) const } bool trpgTileHeader::GetModel(int32 id,int32 &m) const { - if (!isValid() || id < 0 || id >= modelList.size()) + if (!isValid() || id < 0 || static_cast(id) >= modelList.size()) return false; m = modelList[id]; return true; diff --git a/src/osgPlugins/txp/trpage_warchive.cpp b/src/osgPlugins/txp/trpage_warchive.cpp index 378a73fc6..7ce18d1fe 100644 --- a/src/osgPlugins/txp/trpage_warchive.cpp +++ b/src/osgPlugins/txp/trpage_warchive.cpp @@ -254,7 +254,7 @@ bool trpgwArchive::WriteHeader() int32 numLod; header.GetNumLods(numLod); tileTable.SetNumLod(numLod); - for (unsigned int i=0;igetData(); @@ -616,7 +616,7 @@ void trpgwGeomHelper::ResetPolygon() // Set the current color // Note: Required -void trpgwGeomHelper::SetColor(trpgColor &col) +void trpgwGeomHelper::SetColor(trpgColor &) { // tmpColor = col; } @@ -853,7 +853,7 @@ void trpgwGeomHelper::Optimize() break; case Fan: { - bool isFan; + bool isFan=false; // value shouldn't matter to the loop below, but set to false to remove warnings. int primLen = 0; // Dump A into the Fan diff --git a/src/osgPlugins/txp/trpage_writebuf.cpp b/src/osgPlugins/txp/trpage_writebuf.cpp index 76b184c05..8f9fc5c00 100644 --- a/src/osgPlugins/txp/trpage_writebuf.cpp +++ b/src/osgPlugins/txp/trpage_writebuf.cpp @@ -332,14 +332,14 @@ bool trpgwAppFile::Append(const trpgMemWriteBuffer *buf1,const trpgMemWriteBuffe // Write the data out const char *data = buf1->getData(); int len = buf1->length(); - if (fwrite(data,sizeof(char),len,fp) != len) { + if (fwrite(data,sizeof(char),len,fp) != static_cast(len)) { valid = false; return false; } if (buf2) { data = buf2->getData(); len = buf2->length(); - if (fwrite(data,sizeof(char),len,fp) != len) { + if (fwrite(data,sizeof(char),len,fp) != static_cast(len)) { valid = false; return false; } @@ -362,7 +362,7 @@ bool trpgwAppFile::Append(const char *data,int size) } // Write the data out - if (fwrite(data,sizeof(char),size,fp) != size) { + if (fwrite(data,sizeof(char),size,fp) != static_cast(size)) { valid = false; return false; }