From ee0c5123b1740ec44678c851e4ec6c3d1ca11c78 Mon Sep 17 00:00:00 2001 From: John Bauer Date: Mon, 23 Apr 2007 16:35:17 +0000 Subject: [PATCH] Fix the build: standard macro arg lists use ... and __VA_ARGS__ but do not allow specific names for the arg lists. --- stepmania/src/RageFileDriverDeflate.cpp | 12 ++++---- stepmania/src/RageFileDriverDirect.cpp | 28 +++++++++---------- stepmania/src/RageFileDriverDirectHelpers.cpp | 10 +++---- stepmania/src/RageFileDriverTimeout.cpp | 8 +++--- stepmania/src/RageFileDriverZip.cpp | 28 +++++++++---------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/stepmania/src/RageFileDriverDeflate.cpp b/stepmania/src/RageFileDriverDeflate.cpp index 50f0551d3c..95622cd18b 100644 --- a/stepmania/src/RageFileDriverDeflate.cpp +++ b/stepmania/src/RageFileDriverDeflate.cpp @@ -23,7 +23,7 @@ #include #endif -#define Trace(args...) if( LOG ) LOG->Trace( args ); else fprintf( stderr, args ) +#define TRACE(...) if( LOG ) LOG->Trace( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize ) { @@ -39,7 +39,7 @@ RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedS if( err == Z_MEM_ERROR ) RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS ); if( err != Z_OK ) - Trace( "Huh? inflateInit2() err = %i", err ); + TRACE( "Huh? inflateInit2() err = %i", err ); decomp_buf_ptr = decomp_buf; m_iFilePos = 0; @@ -75,7 +75,7 @@ RageFileObjInflate::~RageFileObjInflate() int err = inflateEnd( m_pInflate ); if( err != Z_OK ) - Trace( "Huh? inflateEnd() err = %i", err ); + TRACE( "Huh? inflateEnd() err = %i", err ); delete m_pInflate; } @@ -130,7 +130,7 @@ int RageFileObjInflate::ReadInternal( void *buf, size_t bytes ) case Z_OK: break; default: - Trace( "Huh? inflate err %i", err ); + TRACE( "Huh? inflate err %i", err ); } const int used = (char *)m_pInflate->next_in - decomp_buf_ptr; @@ -207,7 +207,7 @@ RageFileObjDeflate::RageFileObjDeflate( RageFileBasic *pFile ) if( err == Z_MEM_ERROR ) RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS ); if( err != Z_OK ) - Trace( "Huh? inflateInit2() err = %i", err ); + TRACE( "Huh? inflateInit2() err = %i", err ); } @@ -220,7 +220,7 @@ RageFileObjDeflate::~RageFileObjDeflate() int err = deflateEnd( m_pDeflate ); if( err != Z_OK ) - Trace( "Huh? deflateEnd() err = %i", err ); + TRACE( "Huh? deflateEnd() err = %i", err ); delete m_pDeflate; } diff --git a/stepmania/src/RageFileDriverDirect.cpp b/stepmania/src/RageFileDriverDirect.cpp index 82a989339a..6fd806157a 100644 --- a/stepmania/src/RageFileDriverDirect.cpp +++ b/stepmania/src/RageFileDriverDirect.cpp @@ -22,8 +22,8 @@ #include #endif -#define Trace(args...) if( LOG ) LOG->Trace( args ); else fprintf( stderr, args ) -#define Warn(args...) if( LOG ) LOG->Warn( args ); else fprintf( stderr, args ) +#define TRACE(...) if( LOG ) LOG->Trace( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) +#define WARN(...) if( LOG ) LOG->Warn( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) static struct FileDriverEntry_DIR: public FileDriverEntry { @@ -146,10 +146,10 @@ bool RageFileDriverDirect::Move( const RString &sOldPath_, const RString &sNewPa CreateDirectories( m_sRoot + sDir ); } - Trace("rename \"%s\" -> \"%s\"", (m_sRoot + sOldPath).c_str(), (m_sRoot + sNewPath).c_str() ); + TRACE("rename \"%s\" -> \"%s\"", (m_sRoot + sOldPath).c_str(), (m_sRoot + sNewPath).c_str() ); if( DoRename(m_sRoot + sOldPath, m_sRoot + sNewPath) == -1 ) { - Warn( "rename(%s,%s) failed: %s", (m_sRoot + sOldPath).c_str(), (m_sRoot + sNewPath).c_str(), strerror(errno) ); + WARN( "rename(%s,%s) failed: %s", (m_sRoot + sOldPath).c_str(), (m_sRoot + sNewPath).c_str(), strerror(errno) ); return false; } @@ -163,20 +163,20 @@ bool RageFileDriverDirect::Remove( const RString &sPath_ ) switch( this->GetFileType(sPath) ) { case RageFileManager::TYPE_FILE: - Trace("remove '%s'", (m_sRoot + sPath).c_str()); + TRACE("remove '%s'", (m_sRoot + sPath).c_str()); if( DoRemove(m_sRoot + sPath) == -1 ) { - Warn( "remove(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno) ); + WARN( "remove(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno) ); return false; } FDB->DelFile( sPath ); return true; case RageFileManager::TYPE_DIR: - Trace("rmdir '%s'", (m_sRoot + sPath).c_str()); + TRACE("rmdir '%s'", (m_sRoot + sPath).c_str()); if( DoRmdir(m_sRoot + sPath) == -1 ) { - Warn( "rmdir(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno) ); + WARN( "rmdir(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno) ); return false; } FDB->DelFile( sPath ); @@ -240,7 +240,7 @@ bool RageFileObjDirect::FinalFlush() /* Force a kernel buffer flush. */ if( fsync( m_iFD ) == -1 ) { - Warn( "Error synchronizing %s: %s", this->m_sPath.c_str(), strerror(errno) ); + WARN( "Error synchronizing %s: %s", this->m_sPath.c_str(), strerror(errno) ); SetError( strerror(errno) ); return false; } @@ -250,14 +250,14 @@ bool RageFileObjDirect::FinalFlush() int dirfd = open( Dirname(m_sPath), O_RDONLY ); if( dirfd == -1 ) { - Warn( "Error synchronizing open(%s dir): %s", this->m_sPath.c_str(), strerror(errno) ); + WARN( "Error synchronizing open(%s dir): %s", this->m_sPath.c_str(), strerror(errno) ); SetError( strerror(errno) ); return false; } if( fsync( dirfd ) == -1 ) { - Warn( "Error synchronizing fsync(%s dir): %s", this->m_sPath.c_str(), strerror(errno) ); + WARN( "Error synchronizing fsync(%s dir): %s", this->m_sPath.c_str(), strerror(errno) ); SetError( strerror(errno) ); close( dirfd ); return false; @@ -277,7 +277,7 @@ RageFileObjDirect::~RageFileObjDirect() { if( close( m_iFD ) == -1 ) { - Warn( "Error closing %s: %s", this->m_sPath.c_str(), strerror(errno) ); + WARN( "Error closing %s: %s", this->m_sPath.c_str(), strerror(errno) ); SetError( strerror(errno) ); bFailed = true; } @@ -312,13 +312,13 @@ RageFileObjDirect::~RageFileObjDirect() /* We failed. */ int err = GetLastError(); const RString error = werr_ssprintf( err, "Error renaming \"%s\" to \"%s\"", sOldPath.c_str(), sNewPath.c_str() ); - Warn( "%s", error.c_str() ); + WARN( "%s", error.c_str() ); SetError( error ); break; #else if( rename( sOldPath, sNewPath ) == -1 ) { - Warn( "Error renaming \"%s\" to \"%s\": %s", + WARN( "Error renaming \"%s\" to \"%s\": %s", sOldPath.c_str(), sNewPath.c_str(), strerror(errno) ); SetError( strerror(errno) ); break; diff --git a/stepmania/src/RageFileDriverDirectHelpers.cpp b/stepmania/src/RageFileDriverDirectHelpers.cpp index 45cbfbb6e4..3d83815a09 100644 --- a/stepmania/src/RageFileDriverDirectHelpers.cpp +++ b/stepmania/src/RageFileDriverDirectHelpers.cpp @@ -18,7 +18,7 @@ #include #endif -#define Warn(args...) if( LOG ) LOG->Warn( args ); else fprintf( stderr, args ) +#define WARN(...) if( LOG ) LOG->Warn( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) #if defined(_XBOX) /* Wrappers for low-level file functions, to work around Xbox issues: */ @@ -153,14 +153,14 @@ bool CreateDirectories( RString Path ) /* I can't reproduce this anymore. If we get ENOENT, log it but keep * going. */ if( errno == ENOENT ) - Warn( "Couldn't create %s: %s", curpath.c_str(), strerror(errno) ); + WARN( "Couldn't create %s: %s", curpath.c_str(), strerror(errno) ); if( errno == EEXIST || errno == ENOENT ) continue; // we expect to see these errors // XXX: This doesn't make sense. Why do we return if LOG is present here? if( LOG ) { - Warn( "Couldn't create %s: %s", curpath.c_str(), strerror(errno) ); + WARN( "Couldn't create %s: %s", curpath.c_str(), strerror(errno) ); return false; } @@ -169,7 +169,7 @@ bool CreateDirectories( RString Path ) DoStat( curpath, &st ); if( !(st.st_mode & S_IFDIR) ) { - Warn( "Couldn't create %s: path exists and is not a directory", curpath.c_str() ); + WARN( "Couldn't create %s: path exists and is not a directory", curpath.c_str() ); return false; } @@ -270,7 +270,7 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const RString &path ) continue; /* Huh? */ - Warn( "Got file '%s' in '%s' from list, but can't stat? (%s)", + WARN( "Got file '%s' in '%s' from list, but can't stat? (%s)", pEnt->d_name, sPath.c_str(), strerror(errno) ); continue; } diff --git a/stepmania/src/RageFileDriverTimeout.cpp b/stepmania/src/RageFileDriverTimeout.cpp index 0d99b62d71..e6f1f02d7a 100644 --- a/stepmania/src/RageFileDriverTimeout.cpp +++ b/stepmania/src/RageFileDriverTimeout.cpp @@ -49,7 +49,7 @@ #include "RageLog.h" #include -#define Warn(args...) if( LOG ) LOG->Warn( args ); else fprintf( stderr, args ) +#define WARN(...) if( LOG ) LOG->Warn( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) enum ThreadRequest { @@ -159,7 +159,7 @@ ThreadedFileWorker::ThreadedFileWorker( RString sPath ): /* Grab a reference to the child driver. We'll operate on it directly. */ m_pChildDriver = FILEMAN->GetFileDriver( sPath ); if( m_pChildDriver == NULL ) - Warn( "ThreadedFileWorker: Mountpoint \"%s\" not found", sPath.c_str() ); + WARN( "ThreadedFileWorker: Mountpoint \"%s\" not found", sPath.c_str() ); m_pResultFile = NULL; m_pRequestFile = NULL; @@ -864,7 +864,7 @@ bool RageFileDriverTimeout::Move( const RString &sOldPath, const RString &sNewPa int iRet = m_pWorker->Move( sOldPath, sNewPath ); if( iRet == -1 ) { - Warn( "RageFileDriverTimeout::Move(%s,%s) failed", sOldPath.c_str(), sNewPath.c_str() ); + WARN( "RageFileDriverTimeout::Move(%s,%s) failed", sOldPath.c_str(), sNewPath.c_str() ); return false; } @@ -876,7 +876,7 @@ bool RageFileDriverTimeout::Remove( const RString &sPath ) int iRet = m_pWorker->Remove( sPath ); if( iRet == -1 ) { - Warn( "RageFileDriverTimeout::Remove(%s) failed", sPath.c_str() ); + WARN( "RageFileDriverTimeout::Remove(%s) failed", sPath.c_str() ); return false; } diff --git a/stepmania/src/RageFileDriverZip.cpp b/stepmania/src/RageFileDriverZip.cpp index f2da1b8140..1f37b57b6a 100644 --- a/stepmania/src/RageFileDriverZip.cpp +++ b/stepmania/src/RageFileDriverZip.cpp @@ -12,7 +12,7 @@ #include "RageUtil_FileDB.h" #include -#define Warn(args...) if( LOG ) LOG->Warn( args ); else fprintf( stderr, args ) +#define WARN(...) if( LOG ) LOG->Warn( __VA_ARGS__ ); else fprintf( stderr, __VA_ARGS__ ) static struct FileDriverEntry_ZIP: public FileDriverEntry { @@ -50,7 +50,7 @@ bool RageFileDriverZip::Load( const RString &sPath ) if( !pFile->Open(sPath) ) { - Warn( "Couldn't open %s: %s", sPath.c_str(), pFile->GetError().c_str() ); + WARN( "Couldn't open %s: %s", sPath.c_str(), pFile->GetError().c_str() ); delete pFile; return false; } @@ -87,7 +87,7 @@ bool RageFileDriverZip::ReadEndCentralRecord( int &iTotalEntries, int &iCentralD if( sError != "" ) { - Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); + WARN( "%s: %s", m_sPath.c_str(), sError.c_str() ); return false; } @@ -112,7 +112,7 @@ bool RageFileDriverZip::SeekToEndCentralRecord() int iGot = m_pZip->Read( buf, sizeof(buf) ); if( iGot == -1 ) { - Warn( "%s: %s", m_sPath.c_str(), m_pZip->GetError().c_str() ); + WARN( "%s: %s", m_sPath.c_str(), m_pZip->GetError().c_str() ); return false; } @@ -133,7 +133,7 @@ bool RageFileDriverZip::ParseZipfile() { if( !SeekToEndCentralRecord() ) { - Warn( "Couldn't open %s: couldn't find end of central directory record", m_sPath.c_str() ); + WARN( "Couldn't open %s: couldn't find end of central directory record", m_sPath.c_str() ); return false; } @@ -162,7 +162,7 @@ bool RageFileDriverZip::ParseZipfile() } if( m_pFiles.size() == 0 ) - Warn( "%s: no files found in central file header", m_sPath.c_str() ); + WARN( "%s: no files found in central file header", m_sPath.c_str() ); return true; } @@ -173,7 +173,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info ) RString sSig = FileReading::ReadString( *m_pZip, 4, sError ); if( sSig != "\x50\x4B\x01\x02" ) { - Warn( "%s: central directory record signature not found", m_sPath.c_str() ); + WARN( "%s: central directory record signature not found", m_sPath.c_str() ); return -1; } @@ -198,7 +198,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info ) /* Check for errors before reading variable-length fields. */ if( sError != "" ) { - Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); + WARN( "%s: %s", m_sPath.c_str(), sError.c_str() ); return -1; } @@ -208,7 +208,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info ) if( sError != "" ) { - Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); + WARN( "%s: %s", m_sPath.c_str(), sError.c_str() ); return -1; } @@ -216,7 +216,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info ) * file pointer in the middle of a record. */ if( iGeneralPurpose & 1 ) { - Warn( "Skipped encrypted \"%s\" in \"%s\"", info.m_sName.c_str(), m_sPath.c_str() ); + WARN( "Skipped encrypted \"%s\" in \"%s\"", info.m_sName.c_str(), m_sPath.c_str() ); return 0; } @@ -235,7 +235,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info ) if( info.m_iCompressionMethod != STORED && info.m_iCompressionMethod != DEFLATED ) { - Warn( "File \"%s\" in \"%s\" uses unsupported compression method %i", + WARN( "File \"%s\" in \"%s\" uses unsupported compression method %i", info.m_sName.c_str(), m_sPath.c_str(), info.m_iCompressionMethod ); return 0; @@ -254,13 +254,13 @@ bool RageFileDriverZip::ReadLocalFileHeader( FileInfo &info ) if( sError != "" ) { - Warn( "%s: error opening \"%s\": %s", m_sPath.c_str(), info.m_sName.c_str(), sError.c_str() ); + WARN( "%s: error opening \"%s\": %s", m_sPath.c_str(), info.m_sName.c_str(), sError.c_str() ); return false; } if( sSig != "\x50\x4B\x03\x04" ) { - Warn( "%s: local file header not found for \"%s\"", m_sPath.c_str(), info.m_sName.c_str() ); + WARN( "%s: local file header not found for \"%s\"", m_sPath.c_str(), info.m_sName.c_str() ); return false; } @@ -272,7 +272,7 @@ bool RageFileDriverZip::ReadLocalFileHeader( FileInfo &info ) if( sError != "" ) { - Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); + WARN( "%s: %s", m_sPath.c_str(), sError.c_str() ); return false; }