Skip to content

[GEN][ZH] Fix and simplify trailing CR LF in most logging related functions and macros #1232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 16 additions & 16 deletions Core/GameEngine/Source/Common/System/Xfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void Xfer::xferVersion( XferVersion *versionData, XferVersion currentVersion )
if( *versionData > currentVersion )
{

DEBUG_CRASH(( "XferVersion - Unknown version '%d' should be no higher than '%d'\n",
DEBUG_CRASH(( "XferVersion - Unknown version '%d' should be no higher than '%d'",
*versionData, currentVersion ));
throw XFER_INVALID_VERSION;

Expand Down Expand Up @@ -398,7 +398,7 @@ void Xfer::xferSTLObjectIDVector( std::vector<ObjectID> *objectIDVectorData )
if( objectIDVectorData->size() != 0 )
{

DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object vector should be empty before loading\n" ));
DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object vector should be empty before loading" ));
throw XFER_LIST_NOT_EMPTY;

} // end if
Expand All @@ -416,7 +416,7 @@ void Xfer::xferSTLObjectIDVector( std::vector<ObjectID> *objectIDVectorData )
else
{

DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand Down Expand Up @@ -465,7 +465,7 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData )
if( objectIDListData->size() != 0 )
{

DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object list should be empty before loading\n" ));
DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object list should be empty before loading" ));
throw XFER_LIST_NOT_EMPTY;

} // end if
Expand All @@ -483,7 +483,7 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData )
else
{

DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand Down Expand Up @@ -531,7 +531,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData )
if( intListData->size() != 0 )
{

DEBUG_CRASH(( "Xfer::xferSTLIntList - int list should be empty before loading\n" ));
DEBUG_CRASH(( "Xfer::xferSTLIntList - int list should be empty before loading" ));
throw XFER_LIST_NOT_EMPTY;

} // end if
Expand All @@ -549,7 +549,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData )
else
{

DEBUG_CRASH(( "xferSTLIntList - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferSTLIntList - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand All @@ -562,7 +562,7 @@ void Xfer::xferScienceType( ScienceType *science )
{

// sanity
DEBUG_ASSERTCRASH( science != NULL, ("xferScienceType - Invalid parameters\n") );
DEBUG_ASSERTCRASH( science != NULL, ("xferScienceType - Invalid parameters") );

AsciiString scienceName;

Expand All @@ -584,7 +584,7 @@ void Xfer::xferScienceType( ScienceType *science )
if( *science == SCIENCE_INVALID )
{

DEBUG_CRASH(( "xferScienceType - Unknown science '%s'\n", scienceName.str() ));
DEBUG_CRASH(( "xferScienceType - Unknown science '%s'", scienceName.str() ));
throw XFER_UNKNOWN_STRING;

} // end if
Expand All @@ -598,7 +598,7 @@ void Xfer::xferScienceType( ScienceType *science )
else
{

DEBUG_CRASH(( "xferScienceType - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferScienceType - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand All @@ -611,7 +611,7 @@ void Xfer::xferScienceVec( ScienceVec *scienceVec )
{

// sanity
DEBUG_ASSERTCRASH( scienceVec != NULL, ("xferScienceVec - Invalid parameters\n") );
DEBUG_ASSERTCRASH( scienceVec != NULL, ("xferScienceVec - Invalid parameters") );

// this deserves a version number
const XferVersion currentVersion = 1;
Expand Down Expand Up @@ -639,7 +639,7 @@ void Xfer::xferScienceVec( ScienceVec *scienceVec )
scienceVec->clear();

// Homework for today. Write 2000 words reconciling "Your code must never crash" with "Intentionally putting crashes in the code". Fucktard.
// DEBUG_CRASH(( "xferScienceVec - vector is not empty, but should be\n" ));
// DEBUG_CRASH(( "xferScienceVec - vector is not empty, but should be" ));
// throw XFER_LIST_NOT_EMPTY;
}

Expand All @@ -662,7 +662,7 @@ void Xfer::xferScienceVec( ScienceVec *scienceVec )
else
{

DEBUG_CRASH(( "xferScienceVec - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferScienceVec - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand Down Expand Up @@ -715,7 +715,7 @@ void Xfer::xferKindOf( KindOfType *kindOfData )
else
{

DEBUG_CRASH(( "xferKindOf - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferKindOf - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand Down Expand Up @@ -795,7 +795,7 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData )
if( upgradeTemplate == NULL )
{

DEBUG_CRASH(( "Xfer::xferUpgradeMask - Unknown upgrade '%s'\n", upgradeName.str() ));
DEBUG_CRASH(( "Xfer::xferUpgradeMask - Unknown upgrade '%s'", upgradeName.str() ));
throw XFER_UNKNOWN_STRING;

} // end if
Expand All @@ -816,7 +816,7 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData )
else
{

DEBUG_CRASH(( "xferUpgradeMask - Unknown xfer mode '%d'\n", getXferMode() ));
DEBUG_CRASH(( "xferUpgradeMask - Unknown xfer mode '%d'", getXferMode() ));
throw XFER_MODE_UNKNOWN;

} // end else
Expand Down
16 changes: 8 additions & 8 deletions Core/GameEngine/Source/Common/System/XferCRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ XferDeepCRC::~XferDeepCRC( void )
if( m_fileFP != NULL )
{

DEBUG_CRASH(( "Warning: Xfer file '%s' was left open\n", m_identifier.str() ));
DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() ));
close();

} // end if
Expand All @@ -222,7 +222,7 @@ void XferDeepCRC::open( AsciiString identifier )
if( m_fileFP != NULL )
{

DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open\n",
DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open",
identifier.str(), m_identifier.str() ));
throw XFER_FILE_ALREADY_OPEN;

Expand All @@ -236,7 +236,7 @@ void XferDeepCRC::open( AsciiString identifier )
if( m_fileFP == NULL )
{

DEBUG_CRASH(( "File '%s' not found\n", identifier.str() ));
DEBUG_CRASH(( "File '%s' not found", identifier.str() ));
throw XFER_FILE_NOT_FOUND;

} // end if
Expand All @@ -256,7 +256,7 @@ void XferDeepCRC::close( void )
if( m_fileFP == NULL )
{

DEBUG_CRASH(( "Xfer close called, but no file was open\n" ));
DEBUG_CRASH(( "Xfer close called, but no file was open" ));
throw XFER_FILE_NOT_OPEN;

} // end if
Expand All @@ -282,14 +282,14 @@ void XferDeepCRC::xferImplementation( void *data, Int dataSize )
}

// sanity
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferSave - file pointer for '%s' is NULL\n",
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferSave - file pointer for '%s' is NULL",
m_identifier.str()) );

// write data to file
if( fwrite( data, dataSize, 1, m_fileFP ) != 1 )
{

DEBUG_CRASH(( "XferSave - Error writing to file '%s'\n", m_identifier.str() ));
DEBUG_CRASH(( "XferSave - Error writing to file '%s'", m_identifier.str() ));
throw XFER_WRITE_ERROR;

} // end if
Expand All @@ -316,7 +316,7 @@ void XferDeepCRC::xferAsciiString( AsciiString *asciiStringData )
if( asciiStringData->getLength() > 16385 )
{

DEBUG_CRASH(( "XferSave cannot save this ascii string because it's too long. Change the size of the length header (but be sure to preserve save file compatability\n" ));
DEBUG_CRASH(( "XferSave cannot save this ascii string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" ));
throw XFER_STRING_ERROR;

} // end if
Expand All @@ -341,7 +341,7 @@ void XferDeepCRC::xferUnicodeString( UnicodeString *unicodeStringData )
if( unicodeStringData->getLength() > 255 )
{

DEBUG_CRASH(( "XferSave cannot save this unicode string because it's too long. Change the size of the length header (but be sure to preserve save file compatability\n" ));
DEBUG_CRASH(( "XferSave cannot save this unicode string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" ));
throw XFER_STRING_ERROR;

} // end if
Expand Down
22 changes: 11 additions & 11 deletions Core/GameEngine/Source/Common/System/XferLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ XferLoad::~XferLoad( void )
if( m_fileFP != NULL )
{

DEBUG_CRASH(( "Warning: Xfer file '%s' was left open\n", m_identifier.str() ));
DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() ));
close();

} // end if
Expand All @@ -70,7 +70,7 @@ void XferLoad::open( AsciiString identifier )
if( m_fileFP != NULL )
{

DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open\n",
DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open",
identifier.str(), m_identifier.str() ));
throw XFER_FILE_ALREADY_OPEN;

Expand All @@ -84,7 +84,7 @@ void XferLoad::open( AsciiString identifier )
if( m_fileFP == NULL )
{

DEBUG_CRASH(( "File '%s' not found\n", identifier.str() ));
DEBUG_CRASH(( "File '%s' not found", identifier.str() ));
throw XFER_FILE_NOT_FOUND;

} // end if
Expand All @@ -101,7 +101,7 @@ void XferLoad::close( void )
if( m_fileFP == NULL )
{

DEBUG_CRASH(( "Xfer close called, but no file was open\n" ));
DEBUG_CRASH(( "Xfer close called, but no file was open" ));
throw XFER_FILE_NOT_OPEN;

} // end if
Expand All @@ -122,15 +122,15 @@ Int XferLoad::beginBlock( void )
{

// sanity
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("Xfer begin block - file pointer for '%s' is NULL\n",
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("Xfer begin block - file pointer for '%s' is NULL",
m_identifier.str()) );

// read block size
XferBlockSize blockSize;
if( fread( &blockSize, sizeof( XferBlockSize ), 1, m_fileFP ) != 1 )
{

DEBUG_CRASH(( "Xfer - Error reading block size for '%s'\n", m_identifier.str() ));
DEBUG_CRASH(( "Xfer - Error reading block size for '%s'", m_identifier.str() ));
return 0;

} // end if
Expand All @@ -155,11 +155,11 @@ void XferLoad::skip( Int dataSize )
{

// sanity
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad::skip - file pointer for '%s' is NULL\n",
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad::skip - file pointer for '%s' is NULL",
m_identifier.str()) );

// sanity
DEBUG_ASSERTCRASH( dataSize >=0, ("XferLoad::skip - dataSize '%d' must be greater than 0\n",
DEBUG_ASSERTCRASH( dataSize >=0, ("XferLoad::skip - dataSize '%d' must be greater than 0",
dataSize) );

// skip datasize in the file from the current position
Expand All @@ -177,7 +177,7 @@ void XferLoad::xferSnapshot( Snapshot *snapshot )
if( snapshot == NULL )
{

DEBUG_CRASH(( "XferLoad::xferSnapshot - Invalid parameters\n" ));
DEBUG_CRASH(( "XferLoad::xferSnapshot - Invalid parameters" ));
throw XFER_INVALID_PARAMETERS;

} // end if
Expand Down Expand Up @@ -244,14 +244,14 @@ void XferLoad::xferImplementation( void *data, Int dataSize )
{

// sanity
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad - file pointer for '%s' is NULL\n",
DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad - file pointer for '%s' is NULL",
m_identifier.str()) );

// read data from file
if( fread( data, dataSize, 1, m_fileFP ) != 1 )
{

DEBUG_CRASH(( "XferLoad - Error reading from file '%s'\n", m_identifier.str() ));
DEBUG_CRASH(( "XferLoad - Error reading from file '%s'", m_identifier.str() ));
throw XFER_READ_ERROR;

} // end if
Expand Down
Loading
Loading