Fix the build: standard macro arg lists use ... and __VA_ARGS__ but do

not allow specific names for the arg lists.
This commit is contained in:
John Bauer
2007-04-23 16:35:17 +00:00
parent 25d66981ec
commit ee0c5123b1
5 changed files with 43 additions and 43 deletions
+6 -6
View File
@@ -23,7 +23,7 @@
#include <zlib.h> #include <zlib.h>
#endif #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 ) RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize )
{ {
@@ -39,7 +39,7 @@ RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedS
if( err == Z_MEM_ERROR ) if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS ); RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK ) if( err != Z_OK )
Trace( "Huh? inflateInit2() err = %i", err ); TRACE( "Huh? inflateInit2() err = %i", err );
decomp_buf_ptr = decomp_buf; decomp_buf_ptr = decomp_buf;
m_iFilePos = 0; m_iFilePos = 0;
@@ -75,7 +75,7 @@ RageFileObjInflate::~RageFileObjInflate()
int err = inflateEnd( m_pInflate ); int err = inflateEnd( m_pInflate );
if( err != Z_OK ) if( err != Z_OK )
Trace( "Huh? inflateEnd() err = %i", err ); TRACE( "Huh? inflateEnd() err = %i", err );
delete m_pInflate; delete m_pInflate;
} }
@@ -130,7 +130,7 @@ int RageFileObjInflate::ReadInternal( void *buf, size_t bytes )
case Z_OK: case Z_OK:
break; break;
default: default:
Trace( "Huh? inflate err %i", err ); TRACE( "Huh? inflate err %i", err );
} }
const int used = (char *)m_pInflate->next_in - decomp_buf_ptr; const int used = (char *)m_pInflate->next_in - decomp_buf_ptr;
@@ -207,7 +207,7 @@ RageFileObjDeflate::RageFileObjDeflate( RageFileBasic *pFile )
if( err == Z_MEM_ERROR ) if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS ); RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK ) 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 ); int err = deflateEnd( m_pDeflate );
if( err != Z_OK ) if( err != Z_OK )
Trace( "Huh? deflateEnd() err = %i", err ); TRACE( "Huh? deflateEnd() err = %i", err );
delete m_pDeflate; delete m_pDeflate;
} }
+14 -14
View File
@@ -22,8 +22,8 @@
#include <io.h> #include <io.h>
#endif #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__ )
#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_DIR: public FileDriverEntry static struct FileDriverEntry_DIR: public FileDriverEntry
{ {
@@ -146,10 +146,10 @@ bool RageFileDriverDirect::Move( const RString &sOldPath_, const RString &sNewPa
CreateDirectories( m_sRoot + sDir ); 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 ) 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; return false;
} }
@@ -163,20 +163,20 @@ bool RageFileDriverDirect::Remove( const RString &sPath_ )
switch( this->GetFileType(sPath) ) switch( this->GetFileType(sPath) )
{ {
case RageFileManager::TYPE_FILE: 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 ) 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; return false;
} }
FDB->DelFile( sPath ); FDB->DelFile( sPath );
return true; return true;
case RageFileManager::TYPE_DIR: 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 ) 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; return false;
} }
FDB->DelFile( sPath ); FDB->DelFile( sPath );
@@ -240,7 +240,7 @@ bool RageFileObjDirect::FinalFlush()
/* Force a kernel buffer flush. */ /* Force a kernel buffer flush. */
if( fsync( m_iFD ) == -1 ) 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) ); SetError( strerror(errno) );
return false; return false;
} }
@@ -250,14 +250,14 @@ bool RageFileObjDirect::FinalFlush()
int dirfd = open( Dirname(m_sPath), O_RDONLY ); int dirfd = open( Dirname(m_sPath), O_RDONLY );
if( dirfd == -1 ) 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) ); SetError( strerror(errno) );
return false; return false;
} }
if( fsync( dirfd ) == -1 ) 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) ); SetError( strerror(errno) );
close( dirfd ); close( dirfd );
return false; return false;
@@ -277,7 +277,7 @@ RageFileObjDirect::~RageFileObjDirect()
{ {
if( close( m_iFD ) == -1 ) 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) ); SetError( strerror(errno) );
bFailed = true; bFailed = true;
} }
@@ -312,13 +312,13 @@ RageFileObjDirect::~RageFileObjDirect()
/* We failed. */ /* We failed. */
int err = GetLastError(); int err = GetLastError();
const RString error = werr_ssprintf( err, "Error renaming \"%s\" to \"%s\"", sOldPath.c_str(), sNewPath.c_str() ); 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 ); SetError( error );
break; break;
#else #else
if( rename( sOldPath, sNewPath ) == -1 ) 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) ); sOldPath.c_str(), sNewPath.c_str(), strerror(errno) );
SetError( strerror(errno) ); SetError( strerror(errno) );
break; break;
@@ -18,7 +18,7 @@
#include <io.h> #include <io.h>
#endif #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) #if defined(_XBOX)
/* Wrappers for low-level file functions, to work around Xbox issues: */ /* 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 /* I can't reproduce this anymore. If we get ENOENT, log it but keep
* going. */ * going. */
if( errno == ENOENT ) 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 ) if( errno == EEXIST || errno == ENOENT )
continue; // we expect to see these errors continue; // we expect to see these errors
// XXX: This doesn't make sense. Why do we return if LOG is present here? // XXX: This doesn't make sense. Why do we return if LOG is present here?
if( LOG ) 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; return false;
} }
@@ -169,7 +169,7 @@ bool CreateDirectories( RString Path )
DoStat( curpath, &st ); DoStat( curpath, &st );
if( !(st.st_mode & S_IFDIR) ) 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; return false;
} }
@@ -270,7 +270,7 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const RString &path )
continue; continue;
/* Huh? */ /* 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) ); pEnt->d_name, sPath.c_str(), strerror(errno) );
continue; continue;
} }
+4 -4
View File
@@ -49,7 +49,7 @@
#include "RageLog.h" #include "RageLog.h"
#include <errno.h> #include <errno.h>
#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 enum ThreadRequest
{ {
@@ -159,7 +159,7 @@ ThreadedFileWorker::ThreadedFileWorker( RString sPath ):
/* Grab a reference to the child driver. We'll operate on it directly. */ /* Grab a reference to the child driver. We'll operate on it directly. */
m_pChildDriver = FILEMAN->GetFileDriver( sPath ); m_pChildDriver = FILEMAN->GetFileDriver( sPath );
if( m_pChildDriver == NULL ) 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_pResultFile = NULL;
m_pRequestFile = NULL; m_pRequestFile = NULL;
@@ -864,7 +864,7 @@ bool RageFileDriverTimeout::Move( const RString &sOldPath, const RString &sNewPa
int iRet = m_pWorker->Move( sOldPath, sNewPath ); int iRet = m_pWorker->Move( sOldPath, sNewPath );
if( iRet == -1 ) 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; return false;
} }
@@ -876,7 +876,7 @@ bool RageFileDriverTimeout::Remove( const RString &sPath )
int iRet = m_pWorker->Remove( sPath ); int iRet = m_pWorker->Remove( sPath );
if( iRet == -1 ) if( iRet == -1 )
{ {
Warn( "RageFileDriverTimeout::Remove(%s) failed", sPath.c_str() ); WARN( "RageFileDriverTimeout::Remove(%s) failed", sPath.c_str() );
return false; return false;
} }
+14 -14
View File
@@ -12,7 +12,7 @@
#include "RageUtil_FileDB.h" #include "RageUtil_FileDB.h"
#include <cerrno> #include <cerrno>
#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 static struct FileDriverEntry_ZIP: public FileDriverEntry
{ {
@@ -50,7 +50,7 @@ bool RageFileDriverZip::Load( const RString &sPath )
if( !pFile->Open(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; delete pFile;
return false; return false;
} }
@@ -87,7 +87,7 @@ bool RageFileDriverZip::ReadEndCentralRecord( int &iTotalEntries, int &iCentralD
if( sError != "" ) if( sError != "" )
{ {
Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); WARN( "%s: %s", m_sPath.c_str(), sError.c_str() );
return false; return false;
} }
@@ -112,7 +112,7 @@ bool RageFileDriverZip::SeekToEndCentralRecord()
int iGot = m_pZip->Read( buf, sizeof(buf) ); int iGot = m_pZip->Read( buf, sizeof(buf) );
if( iGot == -1 ) 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; return false;
} }
@@ -133,7 +133,7 @@ bool RageFileDriverZip::ParseZipfile()
{ {
if( !SeekToEndCentralRecord() ) 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; return false;
} }
@@ -162,7 +162,7 @@ bool RageFileDriverZip::ParseZipfile()
} }
if( m_pFiles.size() == 0 ) 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; return true;
} }
@@ -173,7 +173,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info )
RString sSig = FileReading::ReadString( *m_pZip, 4, sError ); RString sSig = FileReading::ReadString( *m_pZip, 4, sError );
if( sSig != "\x50\x4B\x01\x02" ) 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; return -1;
} }
@@ -198,7 +198,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info )
/* Check for errors before reading variable-length fields. */ /* Check for errors before reading variable-length fields. */
if( sError != "" ) if( sError != "" )
{ {
Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); WARN( "%s: %s", m_sPath.c_str(), sError.c_str() );
return -1; return -1;
} }
@@ -208,7 +208,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info )
if( sError != "" ) if( sError != "" )
{ {
Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); WARN( "%s: %s", m_sPath.c_str(), sError.c_str() );
return -1; return -1;
} }
@@ -216,7 +216,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info )
* file pointer in the middle of a record. */ * file pointer in the middle of a record. */
if( iGeneralPurpose & 1 ) 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; return 0;
} }
@@ -235,7 +235,7 @@ int RageFileDriverZip::ProcessCdirFileHdr( FileInfo &info )
if( info.m_iCompressionMethod != STORED && info.m_iCompressionMethod != DEFLATED ) 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 ); info.m_sName.c_str(), m_sPath.c_str(), info.m_iCompressionMethod );
return 0; return 0;
@@ -254,13 +254,13 @@ bool RageFileDriverZip::ReadLocalFileHeader( FileInfo &info )
if( sError != "" ) 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; return false;
} }
if( sSig != "\x50\x4B\x03\x04" ) 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; return false;
} }
@@ -272,7 +272,7 @@ bool RageFileDriverZip::ReadLocalFileHeader( FileInfo &info )
if( sError != "" ) if( sError != "" )
{ {
Warn( "%s: %s", m_sPath.c_str(), sError.c_str() ); WARN( "%s: %s", m_sPath.c_str(), sError.c_str() );
return false; return false;
} }