Fix server warnings and errors resulting from LLVM based compile

This commit is contained in:
Scott Ludwig 2016-01-01 14:02:35 -08:00
parent d7f5308907
commit b2e2d5efda
7 changed files with 14 additions and 13 deletions

View File

@ -284,7 +284,7 @@ public:
#ifdef LOGGING
void ToString(char *psz, int cb) {
snprintf(psz, cb,
"CsUpdateResult(cUpdatesBlock: %ld, hash %08lx, cmsLatency: %ld)",
"CsUpdateResult(cUpdatesBlock: %ld, hash %08x, cmsLatency: %ld)",
ur.cUpdatesBlock, ur.hash, ur.cmsLatency);
}
#endif
@ -384,7 +384,7 @@ public:
void ToString(char *psz, int cb) {
snprintf(psz, cb, "WinStatsNetMessage("
"sidm: %08x, sidmAllies: %08x, "
"cCreditsAcquired: %ld, cCreditsConsumed: %ld, "
"cCreditsAcquired: %u, cCreditsConsumed: %u, "
"cEnemyMobileUnitsKilled: %d, cEnemyStructuresKilled: %d, "
"cMobileUnitsLost: %d, cStructuresLost: %d, ff: %08x)",
ws.sidm, ws.sidmAllies,

View File

@ -1,13 +1,14 @@
# Compiler command line
# Add warning check for implicit data type resolution loss, otherwise
# gcc is silent.
PRE_CC=g++ -m32
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
PRE_CC=g++ -m32
CC=$(PRE_CC) -Wshorten-64-to-32
endif
ifeq ($(UNAME), Linux)
CC=$(PRE_CC)
PRE_CC=g++-4.2 -m32
CC=$(PRE_CC) -Wconversion
endif
LD=$(CC)

View File

@ -14,7 +14,7 @@ Logger::Logger(const char *pszDir, dword server_id) :
rotating_(false) {
char szPrefix[64];
sprintf(szPrefix, "server-%lu-%lu", base::GetSecondsUnixEpocUTC(), server_id);
sprintf(szPrefix, "server-%u-%u", base::GetSecondsUnixEpocUTC(), server_id);
prefix_ = szPrefix;
worker_.Start(this, &Logger::ThreadStart);
}

View File

@ -157,7 +157,7 @@ bool NoCachePdbReader::ReadRecord(word nRec, word n, word cb, void *pv)
return true;
}
byte *NoCachePdbReader::MapRecord(word nRec, dword *pdwCookie, word *pcb)
byte *NoCachePdbReader::MapRecord(word nRec, void **ppvCookie, word *pcb)
{
// First see if the record is cached
@ -182,18 +182,18 @@ byte *NoCachePdbReader::MapRecord(word nRec, dword *pdwCookie, word *pcb)
}
m_cMapped++;
*pdwCookie = (dword)pbT;
*ppvCookie = pbT;
*pcb = cbT;
return pbT;
}
void NoCachePdbReader::UnmapRecord(word nRec, dword dwCookie)
void NoCachePdbReader::UnmapRecord(word nRec, void *pvCookie)
{
Assert(m_pb != NULL);
Assert(nRec < m_cRecs);
Assert(m_cMapped > 0);
m_cMapped--;
byte *pb = (byte *)dwCookie;
byte *pb = (byte *)pvCookie;
delete[] pb;
}

View File

@ -22,8 +22,8 @@ public:
virtual void Close();
virtual bool GetRecordSize(word nRec, word *pcb);
virtual bool ReadRecord(word nRec, word n, word cb, void *pv);
virtual byte *MapRecord(word nRec, dword *pdwCookie, word *pcb = NULL);
virtual void UnmapRecord(word nRec, dword dwCookie);
virtual byte *MapRecord(word nRec, void **ppvCookie, word *pcb = NULL);
virtual void UnmapRecord(word nRec, void *pvCookie);
private:
bool GetRecordEntry(word nRec, int cRec, RecordEntryType *prece,

View File

@ -16,7 +16,7 @@ Player::Player() {
Init(0);
}
bool Player::Init(Pid pid) {
void Player::Init(Pid pid) {
anonymous_ = false;
havestats_ = false;
cur_ = 0;

View File

@ -31,7 +31,7 @@ class Player {
public:
Player();
bool Init(Pid pid);
void Init(Pid pid);
Pid pid() const { return pid_; }
void SetEndpoint(Endpoint *endpoint);
Endpoint *endpoint() const { return endpoint_; }