1
0

Cosmetic touchups.

Removed trailing whitespace, added cast to remove warning, added file seeking in case of corrupt files.
This commit is contained in:
Mattes D 2014-12-11 14:34:09 +01:00
parent 1b1f971752
commit 33c6ff872e
5 changed files with 11 additions and 10 deletions

View File

@ -280,8 +280,8 @@ public:
void HandleEntityLeaveBed (int a_EntityID); void HandleEntityLeaveBed (int a_EntityID);
void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting); void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting);
/** Kicks the current player if the same username is already logged in. /** Kicks the client if the same username is already logged in.
Returns false if a player has been kicked, true otherwise. */ Returns false if the client has been kicked, true otherwise. */
bool CheckMultiLogin(const AString & a_Username); bool CheckMultiLogin(const AString & a_Username);
/** Called when the protocol handshake has been received (for protocol versions that support it; /** Called when the protocol handshake has been received (for protocol versions that support it;

View File

@ -63,7 +63,7 @@ bool cEvent::Wait(unsigned a_TimeoutMSec)
} // switch (wait_until()) } // switch (wait_until())
} // while (m_ShouldWait && not timeout) } // while (m_ShouldWait && not timeout)
// The wait timed out in the while() condition: // The wait timed out in the while condition:
return false; return false;
} }

View File

@ -2966,10 +2966,11 @@ bool cWSSAnvil::cMCAFile::OpenFile(bool a_IsForReading)
if (writeOutNeeded) if (writeOutNeeded)
{ {
m_File.Seek(0);
if ( if (
(m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Write chunk offsets (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Write chunk offsets
(m_File.Write(m_TimeStamps, sizeof(m_TimeStamps)) != sizeof(m_TimeStamps)) // Write chunk timestamps (m_File.Write(m_TimeStamps, sizeof(m_TimeStamps)) != sizeof(m_TimeStamps)) // Write chunk timestamps
) )
{ {
LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str()); LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str());
m_File.Close(); m_File.Close();
@ -3104,7 +3105,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri
m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize); m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize);
// Set the modification time // Set the modification time
m_TimeStamps[LocalX + 32 * LocalZ] = htonl(time(nullptr)); m_TimeStamps[LocalX + 32 * LocalZ] = htonl(static_cast<u_long>(time(nullptr)));
if (m_File.Seek(0) < 0) if (m_File.Seek(0) < 0)
{ {