Fix compile for gcc 4.4.

--HG--
branch : trunk
This commit is contained in:
panaut0lordv
2009-05-06 19:30:34 +02:00
parent 8cd49be2ff
commit b3de9cdff7
6 changed files with 45 additions and 23 deletions
+15 -9
View File
@@ -22,6 +22,12 @@
#include <string.h>
//#ifdef _DEBUG
//#define DEB(x) x
//#else
#define DEB(x)
//#endif
using namespace G3D;
namespace VMAP
@@ -86,15 +92,15 @@ namespace VMAP
//============================================================
bool CoordModelMapping::readCoordinateMapping(const std::string& pDirectoryFileName)
{
FILE *f = fopen(pDirectoryFileName.c_str(), "rb");
DEB( FILE *f = fopen(pDirectoryFileName.c_str(), "rb");)
bool result = false;
char buffer[500+1];
if(f)
DEB( if(f))
{
result = true;
CMappingEntry* cMappingEntry;
while(fgets(buffer, 500, f))
DEB( while(fgets(buffer, 500, f)))
{
//char namebuffer[500];
char positionbuffer[500];
@@ -115,8 +121,8 @@ namespace VMAP
nameEnd += findPosChar(&buffer[nameEnd], ' ', 1);
buffer[nameEnd] = 0; // terminate the name
sscanf(buffer, "%d %d", &xpos, &ypos);
sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec);
DEB( sscanf(buffer, "%d %d", &xpos, &ypos);)
DEB( sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec);)
unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart]));
if(!iMapIds.contains(mapId))
{
@@ -136,12 +142,12 @@ namespace VMAP
addCMappingEntry(cMappingEntry);
}
char namebuffer2[500];
sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale);
DEB( sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale);)
cMappingEntry->addFilename(namebuffer2);
//break;
}
}
fclose(f);
DEB( fclose(f);)
}
return result;
}
@@ -165,10 +171,10 @@ namespace VMAP
int noVerc;
int startName = findPosChar(rawNames[pos].c_str(), ' ', 1) + 1;
int endName = (int) rawNames[pos].length();
sscanf(rawNames[pos].c_str(), "%d", &noVerc);
DEB( sscanf(rawNames[pos].c_str(), "%d", &noVerc);)
memcpy(namebuffer, &rawNames[pos].c_str()[startName], endName-startName);
namebuffer[endName-startName] = 0;
sscanf(rawNames[pos].c_str(), "%d", &noVerc);
DEB( sscanf(rawNames[pos].c_str(), "%d", &noVerc);)
std::string modelPosFileName = std::string(namebuffer);
if(noVerc > MIN_VERTICES_FOR_OWN_CONTAINER_FILE)
{
+7 -1
View File
@@ -24,6 +24,12 @@
#include <G3D/Table.h>
#include <G3D/Array.h>
//#ifdef _DEBUG
//#define DEB(x) x
//#else
#define DEB(x)
//#endif
/**
This Class is a helper Class to convert the raw vector data into BSP-Trees.
We read the directory file of the raw data output and build logical groups.
@@ -77,7 +83,7 @@ namespace VMAP
static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos)
{
char b[100];
sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);
DEB( sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);)
return(std::string(b));
}
+12 -6
View File
@@ -20,6 +20,12 @@
#include "DebugCmdLogger.h"
//#ifdef _DEBUG
//#define DEB(x) x
//#else
#define DEB(x)
//#endif
using namespace G3D;
namespace VMAP
@@ -97,25 +103,25 @@ namespace VMAP
bool CommandFileRW::getNewCommands(Array<Command>& pCmdArray)
{
bool result = false;
FILE* f = fopen(iFileName.c_str(), "rb");
if(f)
DEB( FILE* f = fopen(iFileName.c_str(), "rb");)
DEB( if(f))
{
Command cmd;
if(fseek(f, iLastPos, SEEK_SET) == 0) { result = true; }
DEB( if(fseek(f, iLastPos, SEEK_SET) == 0) { result = true; })
while(result)
{
if(fread(&cmd, sizeof(Command), 1, f) != 1)
DEB( if(fread(&cmd, sizeof(Command), 1, f) != 1))
{
result = false;
}
iLastPos = ftell(f);
DEB( iLastPos = ftell(f);)
if(cmd.getType() == STOP)
{
break;
}
pCmdArray.append(cmd);
}
fclose(f);
DEB( fclose(f);)
}
if(result)
{