AString logging fix 2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@218 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
ef196ec22f
commit
cb1ce14169
@ -461,7 +461,7 @@ void cChunkMap::SaveLayer( cChunkLayer* a_Layer )
|
||||
cFile f;
|
||||
if (!f.Open(SourceFile, cFile::fmWrite))
|
||||
{
|
||||
LOGERROR("ERROR: Could not write to file %s", SourceFile );
|
||||
LOGERROR("ERROR: Could not write to file %s", SourceFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ void cChunkMap::SaveLayer( cChunkLayer* a_Layer )
|
||||
#define READ(File, Var) \
|
||||
if (File.Read(&Var, sizeof(Var)) != sizeof(Var)) \
|
||||
{ \
|
||||
LOGERROR("ERROR READING %s FROM FILE %s (line %d)", #Var, SourceFile, __LINE__); \
|
||||
LOGERROR("ERROR READING %s FROM FILE %s (line %d)", #Var, SourceFile.c_str(), __LINE__); \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
@ -553,21 +553,21 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ )
|
||||
READ(f, PakVersion);
|
||||
if (PakVersion != 1)
|
||||
{
|
||||
LOGERROR("WRONG PAK VERSION in file \"%s\"!", SourceFile);
|
||||
LOGERROR("WRONG PAK VERSION in file \"%s\"!", SourceFile.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
READ(f, ChunkVersion);
|
||||
if (ChunkVersion != 1 )
|
||||
{
|
||||
LOGERROR("WRONG CHUNK VERSION in file \"%s\"!", SourceFile);
|
||||
LOGERROR("WRONG CHUNK VERSION in file \"%s\"!", SourceFile.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
short NumChunks = 0;
|
||||
READ(f, NumChunks);
|
||||
|
||||
LOG("Num chunks in file \"%s\": %i", SourceFile, NumChunks);
|
||||
LOG("Num chunks in file \"%s\": %i", SourceFile.c_str(), NumChunks);
|
||||
|
||||
std::auto_ptr<cChunkLayer> Layer(new cChunkLayer(LAYER_SIZE * LAYER_SIZE)); // The auto_ptr deletes the Layer if we exit with an error
|
||||
Layer->m_X = a_LayerX;
|
||||
@ -586,7 +586,7 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ )
|
||||
|
||||
if (Data == NULL)
|
||||
{
|
||||
LOGERROR("Chunk with wrong coordinates in pak file! %i %i", ChunkX, ChunkZ );
|
||||
LOGERROR("Chunk with wrong coordinates [%i, %i] in pak file \"%s\"!", ChunkX, ChunkZ, SourceFile.c_str());
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
@ -604,7 +604,7 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ )
|
||||
Data->m_Compressed = new char[ Data->m_CompressedSize ];
|
||||
if (f.Read(Data->m_Compressed, Data->m_CompressedSize) != Data->m_CompressedSize)
|
||||
{
|
||||
LOGERROR("ERROR 8 READING FROM FILE %s", SourceFile);
|
||||
LOGERROR("ERROR reading compressed data for chunk #%i from file \"%s\"", i, SourceFile.c_str());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ cEvent::cEvent(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sem_unlink( c_Str ) != 0 )
|
||||
if( sem_unlink(EventName.c_str()) != 0 )
|
||||
{
|
||||
LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void cHeartBeat::SendUpdate()
|
||||
AString sPort;
|
||||
Printf(sPort, "%i", Port);
|
||||
AString sChecksum = md5( m_ServerID + sPort );
|
||||
Printf(Msg, "GET http://master.mc-server.org/?update=%s&checksum=%s&port=%d\n", m_ServerID, sChecksum , Port);
|
||||
Printf(Msg, "GET http://master.mc-server.org/?update=%s&checksum=%s&port=%d\n", m_ServerID.c_str(), sChecksum.c_str(), Port);
|
||||
SendMessage(Msg.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,15 @@ void cLog::ClearLog()
|
||||
void cLog::Log(const char * a_Format, va_list argList)
|
||||
{
|
||||
AString Message;
|
||||
if (argList != NULL)
|
||||
{
|
||||
AppendVPrintf(Message, a_Format, argList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This branch needs to be here because of *nix crashing in vsnprintf() when argList is NULL
|
||||
Message.assign(a_Format);
|
||||
}
|
||||
|
||||
time_t rawtime;
|
||||
time ( &rawtime );
|
||||
|
@ -799,7 +799,7 @@ bool cPlayer::LoadFromDisk()
|
||||
std::auto_ptr<char> buffer(new char[FileSize]);
|
||||
if (f.Read(buffer.get(), FileSize) != FileSize)
|
||||
{
|
||||
LOGERROR("ERROR READING FROM FILE \"%s\"", SourceFile);
|
||||
LOGERROR("ERROR READING FROM FILE \"%s\"", SourceFile.c_str());
|
||||
return false;
|
||||
}
|
||||
f.Close();
|
||||
@ -808,7 +808,7 @@ bool cPlayer::LoadFromDisk()
|
||||
Json::Reader reader;
|
||||
if (!reader.parse(buffer.get(), root, false))
|
||||
{
|
||||
LOGERROR("ERROR WHILE PARSING JSON FROM FILE %s", SourceFile);
|
||||
LOGERROR("ERROR WHILE PARSING JSON FROM FILE %s", SourceFile.c_str());
|
||||
}
|
||||
|
||||
buffer.reset();
|
||||
@ -882,12 +882,12 @@ bool cPlayer::SaveToDisk()
|
||||
cFile f;
|
||||
if (!f.Open(SourceFile, cFile::fmWrite))
|
||||
{
|
||||
LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_pState->PlayerName.c_str(), SourceFile);
|
||||
LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_pState->PlayerName.c_str(), SourceFile.c_str());
|
||||
return false;
|
||||
}
|
||||
if (f.Write(JsonData.c_str(), JsonData.size()) != JsonData.size())
|
||||
{
|
||||
LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile);
|
||||
LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -28,7 +28,7 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sem_unlink( c_Str ) != 0 )
|
||||
if( sem_unlink(Name.c_str()) != 0 )
|
||||
{
|
||||
LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
|
||||
}
|
||||
|
@ -190,10 +190,8 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
|
||||
const cPluginManager::PluginList & List = PM->GetAllPlugins();
|
||||
for( cPluginManager::PluginList::const_iterator itr = List.begin(); itr != List.end(); ++itr )
|
||||
{
|
||||
char c_VersionNum[32]; // 32 digits should be enough? XD
|
||||
sprintf_s( c_VersionNum, 32, "%i", (*itr)->GetVersion() );
|
||||
Content += std::string("<li>") + std::string( (*itr)->GetName() ) + " V. " + std::string( c_VersionNum ) + "</li>";
|
||||
|
||||
AString VersionNum;
|
||||
AppendPrintf(Content, "<li>%s V.%i</li>", (*itr)->GetName(), (*itr)->GetVersion());
|
||||
}
|
||||
}
|
||||
Content += "</ul>";
|
||||
|
Loading…
Reference in New Issue
Block a user