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

View File

@@ -1281,7 +1281,7 @@ void SocketHandler::CheckList(socket_v& ref,const std::string& listname)
}
if (!found)
{
fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s);
DEB( fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s);)
}
}
}

View File

@@ -38,7 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
namespace SOCKETS_NAMESPACE {
#endif
//#ifdef _DEBUG
//#define DEB(x) x; fflush(stderr);
//#else
#define DEB(x)
//#endif
void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int err,const std::string& sys_err,loglevel_t lvl)
@@ -69,22 +73,22 @@ void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int
}
if (sock)
{
printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n",
DEB( printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n",
tp.tm_year + 1900,
tp.tm_mon + 1,
tp.tm_mday,
tp.tm_hour,tp.tm_min,tp.tm_sec,
sock -> GetSocket(),
call.c_str(),err,sys_err.c_str(),level.c_str());
call.c_str(),err,sys_err.c_str(),level.c_str()));
}
else
{
printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n",
DEB( printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n",
tp.tm_year + 1900,
tp.tm_mon + 1,
tp.tm_mday,
tp.tm_hour,tp.tm_min,tp.tm_sec,
call.c_str(),err,sys_err.c_str(),level.c_str());
call.c_str(),err,sys_err.c_str(),level.c_str()));
}
}

View File

@@ -1012,7 +1012,7 @@ void TcpSocket::Sendf(const char *format, ...)
#ifdef _WIN32
vsprintf(slask, format, ap);
#else
vsnprintf(slask, 5000, format, ap);
DEB(vsnprintf(slask, 5000, format, ap);)
#endif
va_end(ap);
Send( slask );

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)
{

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));
}

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)
{