Fixed warnings.

This commit is contained in:
Robert Osfield
2003-07-26 04:25:27 +00:00
parent e96c0b735b
commit edeb32778c
20 changed files with 172 additions and 179 deletions

View File

@@ -50,7 +50,7 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
trpgToken matTok;
int32 len;
bool status;
int i,j,k;
unsigned int i,j,k;
std::vector<trpgShortMaterial> shortTable;
std::vector<trpgMaterial> baseMats;
@@ -68,12 +68,12 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
if (matTok == TRPGSHORTMATTABLE) {
int32 numTex,texId;
buf.PushLimit(len);
for (i=0;i<numTable;i++)
for (j=0;j<numMat;j++) {
for (i=0;i<(unsigned int)numTable;i++)
for (j=0;j<(unsigned int)numMat;j++) {
trpgShortMaterial &smat = shortTable[i*numMat+j];
buf.Get(smat.baseMat);
buf.Get(numTex);
for (k=0;k<numTex;k++) {
for (k=0;k<(unsigned int)numTex;k++) {
buf.Get(texId);
smat.texids.push_back(texId);
}
@@ -85,7 +85,7 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
buf.Get(numBaseMat);
if (numBaseMat < 0) throw 1;
baseMats.resize(numBaseMat);
for (i=0;i<numBaseMat;i++) {
for (i=0;i<(unsigned int)numBaseMat;i++) {
buf.GetToken(matTok,len);
if (matTok != TRPGMATERIAL) throw 1;
buf.PushLimit(len);
@@ -154,11 +154,11 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
// Write the short materials
buf.Begin(TRPGSHORTMATTABLE);
for (i=0;i<shortMats.size();i++) {
for (i=0;i<(int)shortMats.size();i++) {
trpgShortMaterial &sMat = shortMats[i];
buf.Add(sMat.baseMat);
buf.Add((int)(sMat.texids.size()));
int j;
unsigned int j;
for (j=0;j<sMat.texids.size();j++)
buf.Add(sMat.texids[j]);
}
@@ -228,7 +228,7 @@ bool trpgTexTable1_0::Read(trpgReadBuffer &buf)
try {
buf.Get(numTex);
texList.resize(numTex);
for (unsigned int i=0;i<numTex;i++) {
for (unsigned int i=0;i<(unsigned int)numTex;i++) {
trpgTexture1_0 tex1_0;
tex1_0.Read(buf);
texList[i] = tex1_0;
@@ -264,7 +264,7 @@ bool trpgTexTable1_0::Write(trpgWriteBuffer &buf)
}
trpgTileTable1_0::trpgTileTable1_0(const trpgTileTable &inTable)
trpgTileTable1_0::trpgTileTable1_0(const trpgTileTable& /*inTable*/)
{
// Nothing to copy for now
}

View File

@@ -263,7 +263,7 @@ void trpgGeometry::SetTexCoords(int num,BindType bind,const float64 *data)
}
void trpgGeometry::AddTexCoord(DataType type,trpg2dPoint &pt, int n)
{
if ((n<0) || (n >= texData.size()))
if ((n<0) || (n >= (int)texData.size()))
return;
trpgTexData *td = &texData[n];
@@ -337,7 +337,7 @@ bool trpgGeometry::GetNumMaterial(int &n) const
bool trpgGeometry::GetMaterial(int id,int32 &m,bool &isLocal) const
{
isLocal = false;
if (!isValid() || id < 0 || id >= materials.size()) return false;
if (!isValid() || id < 0 || id >= (int)materials.size()) return false;
m = materials[id];
if (m < 0) {
m = -m - 1;
@@ -356,7 +356,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)
@@ -369,7 +369,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)
@@ -384,7 +384,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 || (idMax >= (int)vertDataFloat.size() && idMax >= (int)vertDataDouble.size()))
return false;
if (vertDataFloat.size() > vertDataDouble.size()) {
pt.x = vertDataFloat[id];
@@ -409,7 +409,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)
@@ -422,7 +422,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)
@@ -441,7 +441,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 || id >= (int)colors.size()) return false;
*ci = colors[id];
return true;
}
@@ -453,7 +453,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 || id >= (int)texData.size()) return false;
*tx = texData[id];
return true;
}
@@ -466,7 +466,7 @@ bool trpgGeometry::GetNumEdgeFlag(int &n) const
bool trpgGeometry::GetEdgeFlags(char *e) const
{
if (!isValid()) return false;
for (int i=0;i<edgeFlags.size();i++)
for (unsigned int i=0;i<edgeFlags.size();i++)
e[i] = edgeFlags[i];
return true;
}
@@ -525,7 +525,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Begin(TRPG_GEOM_VERT32);
int32 num = vertDataFloat.size()/3;
buf.Add(num);
for (i=0;i<3*num;i++)
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(vertDataFloat[i]);
buf.End();
}
@@ -533,7 +533,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Begin(TRPG_GEOM_VERT64);
int32 num = vertDataDouble.size()/3;
buf.Add(num);
for (i=0;i<3*num;i++)
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(vertDataDouble[i]);
buf.End();
}
@@ -548,7 +548,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Add((int32)normBind);
int32 num = normDataFloat.size()/3;
buf.Add(num);
for (i=0;i<3*num;i++)
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(normDataFloat[i]);
buf.End();
}
@@ -557,7 +557,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Add((int32)normBind);
int32 num = normDataDouble.size()/3;
buf.Add(num);
for (i=0;i<3*num;i++)
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(normDataDouble[i]);
buf.End();
}
@@ -594,7 +594,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Add((int32)td.bind);
int32 num = td.floatData.size()/2;
buf.Add(num);
for (j=0;j<num*2;j++)
for (j=0;j<(unsigned int)num*2;j++)
buf.Add(td.floatData[j]);
buf.End();
}
@@ -603,12 +603,12 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
buf.Add((int32)td.bind);
int32 num = td.doubleData.size()/2;
buf.Add(num);
for (j=0;j<num*2;j++)
for (j=0;j<(unsigned int)num*2;j++)
buf.Add(td.doubleData[j]);
buf.End();
float u;
for (j=0;j<num*2;j++)
for (j=0;j<(unsigned int)num*2;j++)
u = (float)td.doubleData[j];
}
}

View File

@@ -91,7 +91,7 @@ void trpgHeader::SetDbVersion(int32 vmaj,int32 vmin)
}
void trpgHeader::SetTileSize(int id,const trpg2dPoint &pt)
{
if (id < 0 || id >= tileSize.size()) return;
if (id < 0 || id >= (int)tileSize.size()) return;
tileSize[id] = pt;
}
void trpgHeader::SetOrigin(const trpg3dPoint &pt)
@@ -212,7 +212,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 || id >= (int)tileSize.size()) return false;
pt = tileSize[id];
return true;
}

View File

@@ -231,7 +231,7 @@ void trpgTextStyleTable::Reset()
bool trpgTextStyleTable::isValid() const
{
for (int i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
if (!styles[i].isValid())
return false;
@@ -246,7 +246,7 @@ int trpgTextStyleTable::AddStyle(const trpgTextStyle &style)
int trpgTextStyleTable::FindAddStyle(const trpgTextStyle &style)
{
for (int i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
if (styles[i] == style)
return i;
@@ -260,7 +260,7 @@ int trpgTextStyleTable::GetNumStyle() const
const trpgTextStyle *trpgTextStyleTable::GetStyleRef(int id) const
{
if (id < 0 || id >= styles.size())
if (id < 0 || id >= (int)styles.size())
return NULL;
return &styles[id];
@@ -268,7 +268,6 @@ const trpgTextStyle *trpgTextStyleTable::GetStyleRef(int id) const
bool trpgTextStyleTable::Write(trpgWriteBuffer &buf)
{
int i;
if (!isValid())
return false;
@@ -279,7 +278,7 @@ bool trpgTextStyleTable::Write(trpgWriteBuffer &buf)
buf.Add((int32)numStyle);
// Write the styles
for (i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
styles[i].Write(buf);
buf.End();
@@ -456,7 +455,7 @@ void trpgSupportStyleTable::Reset()
bool trpgSupportStyleTable::isValid() const
{
for (int i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
if (!styles[i].isValid())
return false;
@@ -471,7 +470,7 @@ int trpgSupportStyleTable::AddStyle(const trpgSupportStyle &style)
int trpgSupportStyleTable::FindAddStyle(const trpgSupportStyle &style)
{
for (int i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
if (styles[i] == style)
return i;
@@ -485,7 +484,7 @@ int trpgSupportStyleTable::GetNumStyle() const
const trpgSupportStyle *trpgSupportStyleTable::GetStyleRef(int id) const
{
if (id < 0 || id >= styles.size())
if (id < 0 || id >= (int)styles.size())
return NULL;
return &styles[id];
@@ -493,7 +492,6 @@ const trpgSupportStyle *trpgSupportStyleTable::GetStyleRef(int id) const
bool trpgSupportStyleTable::Write(trpgWriteBuffer &buf)
{
int i;
if (!isValid())
return false;
@@ -504,7 +502,7 @@ bool trpgSupportStyleTable::Write(trpgWriteBuffer &buf)
buf.Add((int32)numStyle);
// Write the styles
for (i=0;i<styles.size();i++)
for (unsigned int i=0;i<styles.size();i++)
styles[i].Write(buf);
buf.End();
@@ -519,7 +517,6 @@ bool trpgSupportStyleTable::Read(trpgReadBuffer &buf)
int32 len;
bool status;
int numStyle;
int i;
Reset();
@@ -528,7 +525,7 @@ bool trpgSupportStyleTable::Read(trpgReadBuffer &buf)
if (numStyle < 0)
throw 1;
styles.resize(numStyle);
for (i=0;i<numStyle;i++) {
for (int i=0;i<numStyle;i++) {
buf.GetToken(styleTok,len);
if (styleTok != TRPG_SUPPORT_STYLE) throw 1;
buf.PushLimit(len);
@@ -694,7 +691,7 @@ void trpgLabelPropertyTable::Reset()
bool trpgLabelPropertyTable::isValid() const
{
for (int i=0;i<properties.size();i++)
for (unsigned int i=0;i<properties.size();i++)
if (!properties[i].isValid())
return false;
@@ -709,7 +706,7 @@ int trpgLabelPropertyTable::AddProperty(const trpgLabelProperty &property)
int trpgLabelPropertyTable::FindAddProperty(const trpgLabelProperty& property)
{
for (int i=0;i<properties.size();i++)
for (unsigned int i=0;i<properties.size();i++)
if (properties[i] == property)
return i;
@@ -723,7 +720,7 @@ int trpgLabelPropertyTable::GetNumProperty() const
const trpgLabelProperty *trpgLabelPropertyTable::GetPropertyRef(int id) const
{
if (id < 0 || id >= properties.size())
if (id < 0 || id >= (int)properties.size())
return NULL;
return &properties[id];
@@ -731,7 +728,6 @@ const trpgLabelProperty *trpgLabelPropertyTable::GetPropertyRef(int id) const
bool trpgLabelPropertyTable::Write(trpgWriteBuffer &buf)
{
int i;
if (!isValid())
return false;
@@ -742,7 +738,7 @@ bool trpgLabelPropertyTable::Write(trpgWriteBuffer &buf)
buf.Add((int32)numProperty);
// Write the properties
for (i=0;i<properties.size();i++)
for (unsigned int i=0;i<properties.size();i++)
properties[i].Write(buf);
buf.End();
@@ -757,7 +753,6 @@ bool trpgLabelPropertyTable::Read(trpgReadBuffer &buf)
int32 len;
bool status;
int numProperty;
int i;
Reset();
@@ -766,7 +761,7 @@ bool trpgLabelPropertyTable::Read(trpgReadBuffer &buf)
if (numProperty < 0)
throw 1;
properties.resize(numProperty);
for (i=0;i<numProperty;i++) {
for (unsigned int i=0;i<(unsigned int)numProperty;i++) {
buf.GetToken(propertyTok,len);
if (propertyTok != TRPG_LABEL_PROPERTY) throw 1;
buf.PushLimit(len);
@@ -925,8 +920,6 @@ const std::vector<trpg3dPoint> *trpgLabel::GetSupports() const
bool trpgLabel::Write(trpgWriteBuffer &buf)
{
int i;
buf.Begin(TRPG_LABEL);
buf.Add(propertyId);
buf.Add(text);
@@ -938,7 +931,7 @@ bool trpgLabel::Write(trpgWriteBuffer &buf)
buf.Add(url);
buf.Add(location);
buf.Add((int)supports.size());
for (i=0;i<supports.size();i++)
for (unsigned i=0;i<supports.size();i++)
buf.Add(supports[i]);
buf.End();

View File

@@ -43,7 +43,8 @@ trpgLightAttr::trpgLightAttr(void)
Reset();
}
trpgLightAttr::trpgLightAttr(const trpgLightAttr &in)
trpgLightAttr::trpgLightAttr(const trpgLightAttr& in):
trpgReadWriteable(in)
{
data.commentStr = NULL;
operator=(in);
@@ -735,7 +736,8 @@ trpgLight::trpgLight(void)
index = -1;
}
trpgLight::trpgLight(const trpgLight &in)
trpgLight::trpgLight(const trpgLight &in):
trpgReadWriteable(in)
{
operator=(in);
}
@@ -776,12 +778,10 @@ bool trpgLight::GetVertex(uint32 ix, trpg3dPoint &pt) const
bool trpgLight::GetVertices(trpg3dPoint *pts) const
{
int i;
if (!isValid()) return false;
if (lightPoints.size() != 0)
for (i=0;i<lightPoints.size();i++)
for (unsigned int i=0;i<lightPoints.size();i++)
pts[i] = lightPoints[i];
return true;
@@ -789,13 +789,12 @@ bool trpgLight::GetVertices(trpg3dPoint *pts) const
bool trpgLight::GetVertices(float64 *fts) const
{
int i;
int j = 0;
unsigned int j = 0;
if (!isValid()) return false;
if (lightPoints.size() != 0)
for (i=0;i<lightPoints.size();i++) {
for (unsigned int i=0;i<lightPoints.size();i++) {
fts[j++] = lightPoints[i].x;
fts[j++] = lightPoints[i].y;
fts[j++] = lightPoints[i].z;
@@ -806,13 +805,12 @@ bool trpgLight::GetVertices(float64 *fts) const
bool trpgLight::GetVertices(float32 *fts) const
{
int i;
int j = 0;
if (!isValid()) return false;
if (lightPoints.size() != 0)
for (i=0;i<lightPoints.size();i++) {
for (unsigned int i=0;i<lightPoints.size();i++) {
fts[j++] = (float32)lightPoints[i].x;
fts[j++] = (float32)lightPoints[i].y;
fts[j++] = (float32)lightPoints[i].z;
@@ -884,7 +882,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;
@@ -900,7 +898,8 @@ trpgLightTable::trpgLightTable()
{
}
trpgLightTable::trpgLightTable(const trpgLightTable &in)
trpgLightTable::trpgLightTable(const trpgLightTable &in):
trpgReadWriteable(in)
{
*this = in;
}
@@ -942,7 +941,7 @@ int trpgLightTable::AddLightAttr(const trpgLightAttr& inLight)
}
int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight)
{
for (int i=0;i<lightList.size();i++)
for (unsigned int i=0;i<lightList.size();i++)
if (lightList[i] == inLight)
return i;
@@ -954,7 +953,7 @@ int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight)
trpgLightTable &trpgLightTable::operator = (const trpgLightTable &in)
{
Reset();
for (int i=0;i<in.lightList.size();i++)
for (unsigned int i=0;i<in.lightList.size();i++)
AddLightAttr(in.lightList[i]);
return *this;
@@ -992,7 +991,7 @@ bool trpgLightTable::GetNumLightAttrs(int &no) const
const trpgLightAttr* trpgLightTable::GetLightAttrRef(int id) const
{
if (id < 0 || id >= lightList.size()) return NULL;
if (id < 0 || id >= (int)lightList.size()) return NULL;
return &lightList[id];
}
@@ -1005,7 +1004,7 @@ bool trpgLightTable::Read(trpgReadBuffer &buf)
try {
buf.Get(numLights);
lightList.resize(numLights);
for (unsigned int i=0;i<numLights;i++) {
for (int i=0;i<numLights;i++) {
buf.GetToken(lightTok,len);
if (lightTok != TRPGLIGHTATTR) throw 1;
buf.PushLimit(len);

View File

@@ -38,7 +38,7 @@ trpgManagedTile::trpgManagedTile()
void trpgManagedTile::Reset()
{
// Null out the local material data
for (int i=0;i<localMatData.size();i++)
for (unsigned int i=0;i<localMatData.size();i++)
localMatData[i] = NULL;
groupIDs.resize(0);
@@ -102,7 +102,7 @@ const trpgLocalMaterial *trpgManagedTile::GetLocMaterial(int id) const
const std::vector<trpgLocalMaterial> *matList;
matList = tileHead.GetLocalMaterialList();
if (id <0 || id >= matList->size())
if (id <0 || id >= (int)matList->size())
return NULL;
return &(*matList)[id];
@@ -120,7 +120,7 @@ void *trpgManagedTile::GetLocalData() const
bool trpgManagedTile::SetMatData(int id,void *info)
{
if (id < 0 || id >= localMatData.size())
if (id < 0 || id >= (int)localMatData.size())
return false;
localMatData[id] = info;
@@ -130,7 +130,7 @@ bool trpgManagedTile::SetMatData(int id,void *info)
void *trpgManagedTile::GetMatData(int id) const
{
if (id < 0 || id >= localMatData.size())
if (id < 0 || id >= (int)localMatData.size())
return NULL;
return localMatData[id];
@@ -173,7 +173,7 @@ trpgPageManager::LodPageInfo::~LodPageInfo()
void trpgPageManager::LodPageInfo::Clean()
{
// Clean up managed tile structures
int i;
unsigned int i;
for (i=0;i<load.size();i++)
if (load[i])
delete load[i];
@@ -328,7 +328,7 @@ bool trpgPageManager::LodPageInfo::isWithin(trpgManagedTile *tile,trpg2iPoint &s
bool trpgPageManager::LodPageInfo::Stop()
{
// Empty the load list
int i;
unsigned int i;
for (i=0;i<load.size();i++)
freeList.push_back(load[i]);
load.resize(0);
@@ -361,7 +361,7 @@ void trpgPageManager::LodPageInfo::Update()
Some of the tiles we're supposed to load may now be
out of range. Take them off the load list.
*/
int i;
unsigned int i;
for (i=0;i<load.size();i++) {
if (load[i] && !isWithin(load[i],sw,ne)) {
freeList.push_back(load[i]);
@@ -446,7 +446,7 @@ void trpgPageManager::LodPageInfo::Update()
void trpgPageManager::LodPageInfo::Print(trpgPrintBuffer &buf)
{
char line[1024];
int i;
unsigned int i;
sprintf(line,"lod = %d, valid = %s",lod,(valid ? "yes" : "no")); buf.prnLine(line);
sprintf(line,"pageDist = %f, maxNumTiles = %d",pageDist,maxNumTiles); buf.prnLine(line);
@@ -538,7 +538,7 @@ bool trpgPageManager::SetLocation(trpg2dPoint &pt)
// Call each terrain LOD and let if figure out if something
// has changed.
bool change = false;
for (int i=0;i<pageInfo.size();i++) {
for (unsigned int i=0;i<pageInfo.size();i++) {
if (pageInfo[i].SetLocation(pt))
change = true;
}
@@ -555,7 +555,7 @@ trpgManagedTile *trpgPageManager::GetNextLoad()
// Look for anything that needs loaded
// Start with lowest LOD, work up to highest
trpgManagedTile *tile = NULL;
for (int i=0;i<pageInfo.size();i++) {
for (unsigned int i=0;i<pageInfo.size();i++) {
LodPageInfo &info = pageInfo[i];
if ((tile = info.GetNextLoad()))
break;
@@ -631,8 +631,7 @@ void trpgPageManager::AckUnload()
// Remove this tile's group IDs from the map
const std::vector<int> *groupIDs = lastTile->GetGroupIDs();
int i;
for (i=0;i<groupIDs->size();i++) {
for (unsigned int i=0;i<groupIDs->size();i++) {
ManageGroupMap::iterator p = groupMap.find((*groupIDs)[i]);
if (p != groupMap.end())
groupMap.erase(p);
@@ -647,8 +646,7 @@ void trpgPageManager::AckUnload()
bool trpgPageManager::Stop()
{
bool res=false;
int i;
for (i=0;i<pageInfo.size();i++)
for (unsigned int i=0;i<pageInfo.size();i++)
res |= pageInfo[i].Stop();
lastLoad = None;
@@ -662,8 +660,7 @@ void trpgPageManager::Print(trpgPrintBuffer &buf)
sprintf(line,"Paging pos = (%f,%f), scale = %f",pagePt.x,pagePt.y,scale); buf.prnLine(line);
buf.prnLine("Terrain LODs:");
int i;
for (i=0;i<pageInfo.size();i++) {
for (unsigned int i=0;i<pageInfo.size();i++) {
sprintf(line,"----Terrain lod %d---",i); buf.prnLine(line);
buf.IncreaseIndent();
pageInfo[i].Print(buf);

View File

@@ -53,7 +53,7 @@ bool trpgMatTable::isValid() const
if (numTable <= 0 || numMat <= 0)
return false;
for (int i=0;i<matTables.size();i++)
for (unsigned int i=0;i<matTables.size();i++)
if (!matTables[i].isValid())
return false;
@@ -185,7 +185,7 @@ int trpgMatTable::AddMaterialInSubtable(const trpgMaterial &mat,int table, bool
cmat.autoNormal == bm.autoNormal && cmat.texEnvs.size() == bm.texEnvs.size()) {
// Test the texture envs
bool isSame=true;
int i;
unsigned int i;
for (i=0;i<cmat.texEnvs.size();i++) {
trpgTextureEnv &e1 = cmat.texEnvs[i];
trpgTextureEnv &e2 = bm.texEnvs[i];
@@ -221,8 +221,6 @@ int trpgMatTable::AddMaterialInSubtable(const trpgMaterial &mat,int table, bool
// Write out material table
bool trpgMatTable::Write(trpgWriteBuffer &buf)
{
int i;
if (!isValid())
return false;
@@ -233,7 +231,7 @@ bool trpgMatTable::Write(trpgWriteBuffer &buf)
buf.Add((int32)numMat);
// Write the materials
for (i=0;i<matTables.size();i++)
for (unsigned int i=0;i<matTables.size();i++)
matTables[i].Write(buf);
buf.End();
@@ -1039,7 +1037,8 @@ trpgTexture::trpgTexture()
}
// Copy construction
trpgTexture::trpgTexture(const trpgTexture &in)
trpgTexture::trpgTexture(const trpgTexture &in):
trpgReadWriteable(in)
{
mode = in.mode;
type = in.type;
@@ -1348,7 +1347,7 @@ int32 trpgTexture::CalcTotalSize() const
(const_cast<trpgTexture *>(this))->CalcMipLevelSizes();
int totSize = 0;
for (int i=0;i<storageSize.size();i++)
for (unsigned int i=0;i<storageSize.size();i++)
totSize += storageSize[i];
return totSize;
@@ -1487,6 +1486,8 @@ void trpgTexture::CalcMipLevelSizes()
case trpg_FXT1:
isFXT = true;
break;
default:
break;
}
@@ -1589,7 +1590,8 @@ trpgTexTable::trpgTexTable()
{
}
trpgTexTable::trpgTexTable(const trpgTexTable &in)
trpgTexTable::trpgTexTable(const trpgTexTable &in):
trpgReadWriteable(in)
{
*this = in;
}
@@ -1642,7 +1644,7 @@ int trpgTexTable::AddTexture(const trpgTexture &inTex)
}
int trpgTexTable::FindAddTexture(const trpgTexture &inTex)
{
for (int i=0;i<texList.size();i++)
for (unsigned int i=0;i<texList.size();i++)
if (texList[i] == inTex)
return i;
@@ -1660,7 +1662,7 @@ void trpgTexTable::SetTexture(int id,const trpgTexture &inTex)
trpgTexTable &trpgTexTable::operator = (const trpgTexTable &in)
{
Reset();
for (int i=0;i<in.texList.size();i++)
for (unsigned int i=0;i<in.texList.size();i++)
AddTexture(in.texList[i]);
return *this;
@@ -1698,14 +1700,14 @@ bool trpgTexTable::GetNumTextures(int &no) const
bool trpgTexTable::GetTexture(int id,trpgTexture &ret) const
{
if (!isValid()) return false;
if (id < 0 || id >= texList.size()) return false;
if (id < 0 || id >= (int)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 >= (int)texList.size()) return NULL;
return &texList[id];
}
@@ -1718,7 +1720,7 @@ bool trpgTexTable::Read(trpgReadBuffer &buf)
try {
buf.Get(numTex);
texList.resize(numTex);
for (unsigned int i=0;i<numTex;i++) {
for (int i=0;i<numTex;i++) {
buf.GetToken(texTok,len);
if (texTok != TRPGTEXTURE) throw 1;
buf.PushLimit(len);

View File

@@ -34,7 +34,8 @@ trpgModel::trpgModel()
type = External;
useCount = 0;
}
trpgModel::trpgModel(const trpgModel &in)
trpgModel::trpgModel(const trpgModel &in):
trpgReadWriteable(in)
{
name = NULL;
type = External;
@@ -303,14 +304,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 || id >= (int)models.size())
return false;
model = models[id];
return true;
}
trpgModel *trpgModelTable::GetModelRef(int id)
{
if (id < 0 || id >= models.size())
if (id < 0 || id >= (int)models.size())
return NULL;
return &models[id];
}

View File

@@ -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 /*tok*/,trpgReadBuffer& /*buf*/) {
// 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 /*tok*/,trpgReadBuffer& /*buf*/) {
// 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 /*tok*/,trpgReadBuffer& /*buf*/) {
// Absorb it quietly
return (void *)1;
}

View File

@@ -161,7 +161,7 @@ void *trpgPrintGraphParser::ReadHelper::Parse(trpgToken tok,trpgReadBuffer &buf)
baseTex->GetIsMipmap(hasMipmap);
numMipmap = hasMipmap ? baseTex->CalcNumMipmaps() : 0;
for (int j=1;j<numMipmap;j++) {
int mipOffset = (const_cast<trpgTexture *>(baseTex))->MipLevelOffset(j);
//int mipOffset = (const_cast<trpgTexture *>(baseTex))->MipLevelOffset(j);
int mipSize = (const_cast<trpgTexture *>(baseTex))->MipLevelSize(j);
if (mipSize) {
char *pixels = new char[mipSize];

View File

@@ -245,7 +245,7 @@ bool trpgTexTable::Print(trpgPrintBuffer &buf) const
buf.prnLine("----Texture Table----");
buf.IncreaseIndent();
for (int i=0;i<texList.size();i++) {
for (unsigned int i=0;i<texList.size();i++) {
sprintf(ls,"Texture %d",i); buf.prnLine(ls);
texList[i].Print(buf);
}
@@ -264,7 +264,7 @@ bool trpgModelTable::Print(trpgPrintBuffer &buf) const
buf.prnLine("----Model Table----");
buf.IncreaseIndent();
for (int i=0;i<models.size();i++) {
for (unsigned int i=0;i<models.size();i++) {
sprintf(ls,"Model %d",i); buf.prnLine(ls);
models[i].Print(buf);
}
@@ -307,7 +307,7 @@ bool trpgTileHeader::Print(trpgPrintBuffer &buf) const
sprintf(ls,"matList size = %d",matList.size()); buf.prnLine(ls);
buf.IncreaseIndent();
int i;
unsigned int i;
for (i=0;i<matList.size();i++) {
sprintf(ls,"matList[%d] = %d",i,matList[i]); buf.prnLine(ls);
}
@@ -344,7 +344,7 @@ bool trpgColorInfo::Print(trpgPrintBuffer &buf) const
sprintf(ls,"type = %d, bind = %d",type,bind); buf.prnLine(ls);
sprintf(ls,"colorData size = %d",data.size());
buf.IncreaseIndent();
for (int i=0;i<data.size();i++) {
for (unsigned int i=0;i<data.size();i++) {
sprintf(ls,"color[%d] = (%f,%f,%f)",i,data[i].red,data[i].blue,data[i].green); buf.prnLine(ls);
}
buf.DecreaseIndent(2);
@@ -366,7 +366,7 @@ bool trpgTexData::Print(trpgPrintBuffer &buf) const
if (floatData.size()) {
sprintf(ls,"tex coords (float) = %d",floatData.size()); buf.prnLine(ls);
buf.IncreaseIndent();
for (int i=0;i<floatData.size()/2;i++) {
for (unsigned int i=0;i<floatData.size()/2;i++) {
sprintf(ls,"tex coord[%d] = (%f,%f)",i,floatData[i*2+0],floatData[i*2+1]); buf.prnLine(ls);
}
buf.DecreaseIndent();
@@ -374,7 +374,7 @@ bool trpgTexData::Print(trpgPrintBuffer &buf) const
if (doubleData.size()) {
sprintf(ls,"tex coords (double) = %d",doubleData.size());
buf.IncreaseIndent();
for (int i=0;i<doubleData.size()/2;i++) {
for (unsigned int i=0;i<doubleData.size()/2;i++) {
sprintf(ls,"tex coord[%d] = (%f,%f)",i,doubleData[i*2+0],doubleData[i*2+1]), buf.prnLine(ls);
}
buf.DecreaseIndent();
@@ -399,7 +399,7 @@ bool trpgGeometry::Print(trpgPrintBuffer &buf) const
sprintf(ls,"Material size = %d",materials.size()); buf.prnLine(ls);
buf.IncreaseIndent();
ls[0] = 0;
int i;
unsigned int i;
for (i=0;i<materials.size();i++) {
char locStr[100];
sprintf(locStr,"%d ",materials[i]);
@@ -633,12 +633,12 @@ bool trpgTileTable::Print(trpgPrintBuffer &buf) const
buf.IncreaseIndent();
sprintf(ls,"mode = %d",mode); buf.prnLine(ls);
sprintf(ls,"numLod = %d",lodInfo.size()); buf.prnLine(ls);
for (int i=0;i<lodInfo.size();i++) {
for (unsigned int i=0;i<lodInfo.size();i++) {
const LodInfo &li = lodInfo[i];
sprintf(ls,"LOD %d, numX = %d, numY = %d",i,li.numX,li.numY); buf.prnLine(ls);
buf.prnLine("File ID, Offset, Zmin, Zmax");
buf.IncreaseIndent();
for (int j=0;j<li.addr.size();j++) {
for (unsigned int j=0;j<li.addr.size();j++) {
sprintf(ls,"%d %d %f %f",li.addr[j].file,li.addr[j].offset,li.elev_min[j],li.elev_max[j]); buf.prnLine(ls);
}
buf.DecreaseIndent();
@@ -660,7 +660,7 @@ bool trpgLocalMaterial::Print(trpgPrintBuffer &buf) const
sprintf(ls,"baseMat = %d",baseMat); buf.prnLine(ls);
sprintf(ls,"(sx,sy) -> (ex,ey) = (%d,%d) -> (%d,%d)",sx,sy,ex,ey); buf.prnLine(ls);
sprintf(ls,"dest (width,height) = (%d,%d)",destWidth,destHeight); buf.prnLine(ls);
for (int i=0;i<addr.size();i++) {
for (unsigned int i=0;i<addr.size();i++) {
sprintf(ls,"addr (file,offset) = (%d,%d)",addr[i].file,addr[i].offset); buf.prnLine(ls);
}
buf.DecreaseIndent();
@@ -776,7 +776,7 @@ bool trpgLightTable::Print(trpgPrintBuffer &buf) const
buf.prnLine("----Light Table----");
buf.IncreaseIndent();
for (int i=0;i<lightList.size();i++) {
for (unsigned int i=0;i<lightList.size();i++) {
sprintf(ls,"Light %d",i); buf.prnLine(ls);
lightList[i].Print(buf);
}
@@ -834,7 +834,7 @@ bool trpgRangeTable::Print(trpgPrintBuffer &buf) const
buf.prnLine("----Range Table----");
buf.IncreaseIndent();
for (int i=0;i<rangeList.size();i++) {
for (unsigned int i=0;i<rangeList.size();i++) {
sprintf(ls,"----Range %d----",i); buf.prnLine(ls);
rangeList[i].Print(buf);
}
@@ -863,7 +863,7 @@ bool trpgLabel::Print(trpgPrintBuffer &buf) const
sprintf(ls,"location: (%f %f %f)",location.x,location.y,location.z); buf.prnLine(ls);
sprintf(ls,"%d support points",supports.size()); buf.prnLine(ls);
buf.IncreaseIndent();
for (int i=0;i<supports.size();i++) {
for (unsigned int i=0;i<supports.size();i++) {
sprintf(ls,"%f %f %f",supports[i].x,supports[i].y,supports[i].z); buf.prnLine(ls);
}
buf.DecreaseIndent();
@@ -901,7 +901,7 @@ bool trpgTextStyleTable::Print(trpgPrintBuffer &buf) const
buf.IncreaseIndent();
sprintf(ls,"numStyle = %d",styles.size()); buf.prnLine(ls);
buf.IncreaseIndent();
for (int i=0;i<styles.size();i++) {
for (unsigned int i=0;i<styles.size();i++) {
sprintf(ls,"Style %d",i); buf.prnLine(ls);
styles[i].Print(buf);
}
@@ -937,7 +937,7 @@ bool trpgSupportStyleTable::Print(trpgPrintBuffer &buf) const
buf.IncreaseIndent();
sprintf(ls,"numStyle = %d",styles.size()); buf.prnLine(ls);
buf.IncreaseIndent();
for (int i=0;i<styles.size();i++) {
for (unsigned int i=0;i<styles.size();i++) {
sprintf(ls,"Style %d",i); buf.prnLine(ls);
styles[i].Print(buf);
}
@@ -975,7 +975,7 @@ bool trpgLabelPropertyTable::Print(trpgPrintBuffer &buf) const
buf.IncreaseIndent();
sprintf(ls,"numProperty = %d",properties.size()); buf.prnLine(ls);
buf.IncreaseIndent();
for (int i=0;i<properties.size();i++) {
for (unsigned int i=0;i<properties.size();i++) {
sprintf(ls,"Property %d",i); buf.prnLine(ls);
properties[i].Print(buf);
}
@@ -983,4 +983,4 @@ bool trpgLabelPropertyTable::Print(trpgPrintBuffer &buf) const
buf.DecreaseIndent();
return true;
}
}

View File

@@ -42,7 +42,8 @@ trpgRange::~trpgRange(void)
Reset();
}
trpgRange::trpgRange(const trpgRange &in)
trpgRange::trpgRange(const trpgRange &in):
trpgReadWriteable(in)
{
category = NULL;
subCategory = NULL;
@@ -215,7 +216,7 @@ bool trpgRangeTable::GetRange(int id,trpgRange &ret) const
if (!isValid())
return false;
if (id < 0 || id >= rangeList.size())
if (id < 0 || id >= (int)rangeList.size())
return false;
ret = rangeList[id];
@@ -228,7 +229,7 @@ bool trpgRangeTable::SetRange(int id,trpgRange &inRange)
if (!isValid())
return false;
if (id < 0 || id >= rangeList.size())
if (id < 0 || id >= (int)rangeList.size())
return false;
rangeList[id] = inRange;
@@ -245,7 +246,7 @@ int trpgRangeTable::AddRange(trpgRange &range)
int trpgRangeTable::FindAddRange(trpgRange &range)
{
for (int i=0;i<rangeList.size();i++) {
for (unsigned int i=0;i<rangeList.size();i++) {
if (range == rangeList[i])
return i;
}
@@ -261,7 +262,7 @@ bool trpgRangeTable::Write(trpgWriteBuffer &buf)
buf.Begin(TRPGRANGETABLE);
buf.Add((int32)rangeList.size());
for (int i=0;i<rangeList.size();i++) {
for (unsigned int i=0;i<rangeList.size();i++) {
trpgRange &range = rangeList[i];
range.Write(buf);
}
@@ -307,7 +308,7 @@ trpgRangeTable & trpgRangeTable::operator = (const trpgRangeTable &inTab)
{
Reset();
for (int i=0;i<inTab.rangeList.size();i++)
for (unsigned int i=0;i<inTab.rangeList.size();i++)
rangeList.push_back(inTab.rangeList[i]);
return *this;

View File

@@ -183,10 +183,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 >= (unsigned int)numLods) return false;
trpg2iPoint lodSize;
header.GetLodSize(lod,lodSize);
if (x >= lodSize.x || y >= lodSize.y) return false;
if (x >= (unsigned int)lodSize.x || y >= (unsigned int)lodSize.y) return false;
trpgTileTable::TileMode tileMode;
tileTable.GetMode(tileMode);
@@ -291,7 +291,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 >= (unsigned int)maxXY.x || y>= (unsigned int)maxXY.y)
return false;
trpg3dPoint origin;
@@ -518,7 +518,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 ((int)strlen(dir) + nameLen + 2 > pathLen)
return false;
sprintf(fullPath,"%s" PATHSEPERATOR "%s",dir,name);

View File

@@ -318,7 +318,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.size();i++)
for (unsigned int i=0;i<limits.size();i++)
if (len > limits[i])
return false;
@@ -329,7 +329,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<limits.size();i++)
for (unsigned int i=0;i<limits.size();i++)
limits[i] -= len;
}
@@ -359,7 +359,7 @@ bool trpgMemReadBuffer::isEmpty()
return true;
// Also test the limits
for (int i=0;i<limits.size();i++)
for (unsigned int i=0;i<limits.size();i++)
if (limits[i] == 0) return true;
return false;
@@ -503,7 +503,7 @@ bool trpgrAppFile::Read(trpgMemReadBuffer *buf,int32 offset)
return false;
}
if (fread(data,sizeof(char),len,fp) != len) {
if (fread(data,sizeof(char),len,fp) != (unsigned int)len) {
valid = false;
return false;
}
@@ -555,7 +555,7 @@ bool trpgrAppFile::Read(char *data,int32 baseOffset,int32 objOffset,int32 dataSi
// Read the raw data
// Note: What about byte swapping?
if (fread(data,sizeof(char),dataSize,fp) != dataSize) {
if (fread(data,sizeof(char),dataSize,fp) != (unsigned int)dataSize) {
valid = false;
return false;
}

View File

@@ -145,7 +145,7 @@ trpgReadGroupBase::~trpgReadGroupBase()
// Delete all children
void trpgReadGroupBase::DeleteChildren()
{
for (int i=0;i<children.size();i++)
for (unsigned int i=0;i<children.size();i++)
if (children[i])
delete children[i];
}
@@ -159,7 +159,7 @@ void trpgReadGroupBase::AddChild(trpgReadNode *n)
// Unref a child (but don't delete it)
void trpgReadGroupBase::unRefChild(int id)
{
if (id < 0 || id >= children.size())
if (id < 0 || id >= (int)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<children.size();i++)
for (unsigned int i=0;i<children.size();i++)
unRefChild(i);
}
@@ -181,7 +181,7 @@ trpgMBR trpgReadGroupBase::GetMBR() const
trpgMBR *cmbr = const_cast<trpgMBR *>(&mbr);
trpgMBR kmbr;
// Ask the kids
for (int i=0;i<children.size();i++) {
for (unsigned int i=0;i<children.size();i++) {
kmbr = children[i]->GetMBR();
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 /*tok*/,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 /*tok*/,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 /*tok*/,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 /*tok*/,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 /*tok*/,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 /*tok*/,trpgReadBuffer &buf) {
trpgReadModelRef *mod = new trpgReadModelRef();
trpgModelRef *data = mod->GetData();
if (!data->Read(buf)) {
@@ -381,7 +381,7 @@ protected:
class trpgReadTileHeaderHelper : public trpgr_Callback {
public:
trpgReadTileHeaderHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
void *Parse(trpgToken /*tok*/,trpgReadBuffer &buf) {
trpgReadTileHeader *th = parse->GetTileHeaderRef();
trpgTileHeader *data = th->GetData();
if (!data->Read(buf))
@@ -488,12 +488,12 @@ 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 * /*in_node*/)
{
// We don't need it here, but this is the node we just
// finished putting children under. If you need to close
// it out in some way, do that here
trpgReadNode *node = (trpgReadNode *)in_node;
//trpgReadNode *node = (trpgReadNode *)in_node;
// Get the parent above the current one
int pos = parents.size()-2;

View File

@@ -66,7 +66,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 || lod >= (int)lodInfo.size())
return;
// Got a table we need to maintain
@@ -98,7 +98,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 || lod >= (int)lodInfo.size()) return;
if (mode != Local)
return;
LodInfo &li = lodInfo[lod];
@@ -130,7 +130,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 || lod >= (int)lodInfo.size()) return false;
if (mode != Local)
return false;
const LodInfo &li = lodInfo[lod];
@@ -163,7 +163,7 @@ bool trpgTileTable::Write(trpgWriteBuffer &buf)
buf.Add(numLod);
// Write each terrain LOD set
for (unsigned int i=0;i<numLod;i++) {
for (int i=0;i<numLod;i++) {
LodInfo &li = lodInfo[i];
buf.Add(li.numX);
buf.Add(li.numY);
@@ -206,7 +206,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf)
if (numLod <= 0) throw 1;
lodInfo.resize(numLod);
for (unsigned int i=0;i<numLod;i++) {
for (int i=0;i<numLod;i++) {
LodInfo &li = lodInfo[i];
buf.Get(li.numX);
buf.Get(li.numY);
@@ -215,7 +215,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf)
li.addr.resize(numTile);
li.elev_min.resize(numTile);
li.elev_max.resize(numTile);
unsigned int j;
int j;
for (j=0;j<numTile;j++) {
trpgwAppAddress &ref = li.addr[j];
buf.Get(ref.file);
@@ -260,13 +260,13 @@ void trpgTileHeader::Reset()
// Set functions
void trpgTileHeader::SetMaterial(int no,int id)
{
if (no < 0 || no >= matList.size())
if (no < 0 || no >= (int)matList.size())
return;
matList[no] = id;
}
void trpgTileHeader::SetModel(int no,int id)
{
if (no < 0 || no >= modelList.size())
if (no < 0 || no >= (int)modelList.size())
return;
modelList[no] = id;
}
@@ -275,7 +275,7 @@ void trpgTileHeader::SetModel(int no,int id)
void trpgTileHeader::AddMaterial(int id)
{
// Look for it first
for (int i=0;i<matList.size();i++)
for (unsigned int i=0;i<matList.size();i++)
if (matList[i] == id)
return;
// Didn't find it, add it.
@@ -283,7 +283,7 @@ void trpgTileHeader::AddMaterial(int id)
}
void trpgTileHeader::AddModel(int id)
{
for (int i=0;i<modelList.size();i++)
for (unsigned int i=0;i<modelList.size();i++)
if (modelList[i] == id)
return;
modelList.push_back(id);
@@ -310,7 +310,7 @@ bool trpgTileHeader::GetNumLocalMaterial(int32 &retNum) const
bool trpgTileHeader::GetLocalMaterial(int32 id,trpgLocalMaterial &retMat) const
{
if (id < 0 || id >= locMats.size())
if (id < 0 || id >= (int)locMats.size())
return false;
retMat = locMats[id];
@@ -334,7 +334,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 || id >= (int)matList.size())
return false;
mat = matList[id];
return true;
@@ -347,7 +347,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 || id >= (int)modelList.size())
return false;
m = modelList[id];
return true;

View File

@@ -25,3 +25,4 @@
Instead, there's a Windows specific program that merges TerraPage archives in
the merge/ directory of this distribution.
*/

View File

@@ -29,4 +29,4 @@ public:
enum {DoReport = 1<<0,DoCopy = 1<<1, DoTileOpt = 1<<2};
int merge(trpgr_Archive &inArch1,trpgr_Archive &inArch2,trpgwArchive &outArch, int flags = 0);
};
#endif
#endif

View File

@@ -96,8 +96,8 @@ trpgwArchive::trpgwArchive(char *inDir,char *inFile,trpg2dPoint &sw, trpg2dPoint
inHeader->GetTileSize(0,blockSize);
double dx = (oldSW.x - newSW.x)/blockSize.x + 10e-10;
double dy = (oldSW.y - newSW.y)/blockSize.y + 10e-10;
addOffset.x = dx;
addOffset.y = dy;
addOffset.x = (int)dx;
addOffset.y = (int)dy;
if (dx - addOffset.x > 10e-4 ||
dy - addOffset.y > 10e-4) {
delete inArch;
@@ -115,8 +115,8 @@ trpgwArchive::trpgwArchive(char *inDir,char *inFile,trpg2dPoint &sw, trpg2dPoint
trpg2dPoint tileSize;
inHeader->GetTileSize(i,tileSize);
trpg2iPoint newTileExt;
newTileExt.x = (newNE.x - newSW.x)/tileSize.x + 10e-5;
newTileExt.y = (newNE.y - newSW.y)/tileSize.y + 10e-15;
newTileExt.x = (int)((newNE.x - newSW.x)/tileSize.x + 10e-5);
newTileExt.y = (int)((newNE.y - newSW.y)/tileSize.y + 10e-15);
header.SetLodSize(i,newTileExt);
}
@@ -380,7 +380,7 @@ bool trpgwArchive::CheckpointHeader()
int32 numLod;
header.GetNumLods(numLod);
tileTable.SetNumLod(numLod);
for (unsigned int i=0;i<numLod;i++) {
for (int i=0;i<numLod;i++) {
trpg2iPoint lodSize;
header.GetLodSize(i,lodSize);
tileTable.SetNumTiles(lodSize.x,lodSize.y,i);
@@ -545,7 +545,7 @@ bool trpgwArchive::CheckpointHeader()
// Write the buffer
const char *data = buf.getData();
if (fwrite(data,sizeof(char),headLen,fp) != headLen)
if (fwrite(data,sizeof(char),headLen,fp) != (unsigned int)headLen)
{
strcpy(errMess, "Could not write the buffer");
return false;
@@ -646,7 +646,7 @@ bool trpgwArchive::WriteTile(unsigned int x,unsigned int y,unsigned int lod, flo
return false;
// Write the header first
int len;
unsigned int len;
const char *data;
if (head) {
data = head->getData();
@@ -779,7 +779,7 @@ void trpgwGeomHelper::EndPolygon()
// Turn the polygon into triangles
// Note: Only dealing with convex here
matTri = matPoly;
int numMats=matTri.size();
unsigned int numMats=matTri.size();
switch (mode) {
case trpgGeometry::Triangles:
@@ -853,7 +853,7 @@ void trpgwGeomHelper::ResetPolygon()
// Set the current color
// Note: Required
void trpgwGeomHelper::SetColor(trpgColor &col)
void trpgwGeomHelper::SetColor(trpgColor& /*col*/)
{
// tmpColor = col;
}
@@ -954,8 +954,8 @@ void trpgwGeomHelper::FlushGeom()
break;
case trpgGeometry::Quads:
{
int numVert = vert.size();
int numMat = matTri.size();
unsigned int numVert = vert.size();
unsigned int numMat = matTri.size();
unsigned int loop;
// Make sure we've got quads
@@ -965,7 +965,7 @@ void trpgwGeomHelper::FlushGeom()
trpgGeometry quads;
quads.SetPrimType(trpgGeometry::Quads);
for (loop=0;loop<numMat;loop++) quads.AddTexCoords(trpgGeometry::PerVertex);
for (int i=0;i<numVert;i++) {
for (unsigned int i=0;i<numVert;i++) {
quads.AddVertex((trpgGeometry::DataType)dtype,vert[i]);
quads.AddNormal((trpgGeometry::DataType)dtype,norm[i]);
for (loop=0;loop<numMat;loop++) quads.AddTexCoord((trpgGeometry::DataType)dtype,tex[i*numMat+loop],loop);
@@ -1014,18 +1014,17 @@ optVert::optVert(int numMat, int vid, std::vector<trpg3dPoint> &iv, std::vector<
v=iv[vid];
n=in[vid];
tex.resize(0);
for (unsigned int loop=0; loop < numMat; loop++) tex.push_back(itex[vid*numMat+loop]);
for (unsigned int loop=0; loop < (unsigned int)numMat; loop++) tex.push_back(itex[vid*numMat+loop]);
}
void trpgwGeomHelper::Optimize()
{
bool isStrip = false;
int dtype = (dataType == UseDouble ? trpgGeometry::DoubleData : trpgGeometry::FloatData);
// Potentially writing to all of these
strips.SetPrimType(trpgGeometry::TriStrips);
fans.SetPrimType(trpgGeometry::TriFans);
bags.SetPrimType(trpgGeometry::Triangles);
int numMat = matTri.size();
unsigned int numMat = matTri.size();
for (unsigned int loop =0; loop < numMat; loop++ ) {
strips.AddMaterial(matTri[loop]);
strips.AddTexCoords(trpgGeometry::PerVertex);

View File

@@ -344,14 +344,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) != (unsigned int)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) != (unsigned int)len) {
valid = false;
return false;
}
@@ -377,7 +377,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) != (unsigned int)size) {
valid = false;
return false;
}