mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Replaced sizeof format references %lu with %zu (GCC, Clang) and %Iu (MSVC) #88
This commit is contained in:
parent
1115b52dd2
commit
e61eae499c
4 changed files with 64 additions and 9 deletions
|
@ -1929,3 +1929,16 @@ CONSOLE_COMMAND( testSIMD, "test SIMD code", NULL )
|
||||||
{
|
{
|
||||||
idSIMD::Test_f( args );
|
idSIMD::Test_f( args );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RB begin
|
||||||
|
CONSOLE_COMMAND( testFormattingSizes, "test printf format security", 0 )
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
common->Printf( " sizeof( int32 ): %Iu bytes\n", sizeof( int32 ) );
|
||||||
|
common->Printf( " sizeof( int64 ): %Iu bytes\n", sizeof( int64 ) );
|
||||||
|
#else
|
||||||
|
common->Printf( " sizeof( int32 ): %zu bytes\n", sizeof( int32 ) );
|
||||||
|
common->Printf( " sizeof( int64 ): %zu bytes\n", sizeof( int64 ) );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// RB end
|
|
@ -844,7 +844,11 @@ int idFile_Memory::Write( const void* buffer, int len )
|
||||||
{
|
{
|
||||||
if( maxSize != 0 )
|
if( maxSize != 0 )
|
||||||
{
|
{
|
||||||
common->Error( "idFile_Memory::Write: exceeded maximum size %lu", maxSize );
|
#ifdef _MSC_VER
|
||||||
|
common->Error( "idFile_Memory::Write: exceeded maximum size %Iu", maxSize );
|
||||||
|
#else
|
||||||
|
common->Error( "idFile_Memory::Write: exceeded maximum size %zu", maxSize );
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int extra = granularity * ( 1 + alloc / granularity );
|
int extra = granularity * ( 1 + alloc / granularity );
|
||||||
|
@ -930,7 +934,13 @@ void idFile_Memory::PreAllocate( size_t len )
|
||||||
{
|
{
|
||||||
if( maxSize != 0 )
|
if( maxSize != 0 )
|
||||||
{
|
{
|
||||||
idLib::Error( "idFile_Memory::SetLength: exceeded maximum size %lu", maxSize );
|
// RB begin
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
idLib::Error( "idFile_Memory::SetLength: exceeded maximum size %Iu", maxSize );
|
||||||
|
#else
|
||||||
|
idLib::Error( "idFile_Memory::SetLength: exceeded maximum size %zu", maxSize );
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
}
|
}
|
||||||
char* newPtr = ( char* )Mem_Alloc( len, TAG_IDFILE );
|
char* newPtr = ( char* )Mem_Alloc( len, TAG_IDFILE );
|
||||||
if( allocated > 0 )
|
if( allocated > 0 )
|
||||||
|
@ -1116,7 +1126,13 @@ void idFile_Memory::TruncateData( size_t len )
|
||||||
{
|
{
|
||||||
if( len > allocated )
|
if( len > allocated )
|
||||||
{
|
{
|
||||||
idLib::Error( "idFile_Memory::TruncateData: len (%lu) exceeded allocated size (%lu)", len, allocated );
|
// RB begin
|
||||||
|
#ifdef _MSV_VER
|
||||||
|
idLib::Error( "idFile_Memory::TruncateData: len (%Iu) exceeded allocated size (%Iu)", len, allocated );
|
||||||
|
#else
|
||||||
|
idLib::Error( "idFile_Memory::TruncateData: len (%zu) exceeded allocated size (%zu)", len, allocated );
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -504,7 +504,13 @@ bool idZipBuilder::CreateZipFileFromFiles( const idList< idFile_Memory* >& srcFi
|
||||||
errcode = zipWriteInFileInZip( zf, buffer.Ptr(), ( unsigned int )bytesRead );
|
errcode = zipWriteInFileInZip( zf, buffer.Ptr(), ( unsigned int )bytesRead );
|
||||||
if( errcode != ZIP_OK )
|
if( errcode != ZIP_OK )
|
||||||
{
|
{
|
||||||
idLib::Warning( "Error writing to zipfile (%lu bytes)!", bytesRead );
|
// RB begin
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
idLib::Warning( "Error writing to zipfile (%Iu bytes)!", bytesRead );
|
||||||
|
#else
|
||||||
|
idLib::Warning( "Error writing to zipfile (%zu bytes)!", bytesRead );
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +618,13 @@ bool idZipBuilder::AddFile( zipFile zf, idFile_Memory* src, bool deleteFile )
|
||||||
errcode = zipWriteInFileInZip( zf, buffer.Ptr(), ( unsigned int )bytesRead );
|
errcode = zipWriteInFileInZip( zf, buffer.Ptr(), ( unsigned int )bytesRead );
|
||||||
if( errcode != ZIP_OK )
|
if( errcode != ZIP_OK )
|
||||||
{
|
{
|
||||||
idLib::Warning( "Error writing to zipfile (%lu bytes)!", bytesRead );
|
// RB begin
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
idLib::Warning( "Error writing to zipfile (%Iu bytes)!", bytesRead );
|
||||||
|
#else
|
||||||
|
idLib::Warning( "Error writing to zipfile (%zu bytes)!", bytesRead );
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,11 +940,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||||
/* Determine the best encoding. Compute the block lengths in bytes. */
|
/* Determine the best encoding. Compute the block lengths in bytes. */
|
||||||
opt_lenb = (s->opt_len+3+7)>>3;
|
opt_lenb = (s->opt_len+3+7)>>3;
|
||||||
static_lenb = (s->static_len+3+7)>>3;
|
static_lenb = (s->static_len+3+7)>>3;
|
||||||
|
// RB begin
|
||||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
#ifdef _MSC_VER
|
||||||
|
Tracev((stderr, "\nopt %Iu(%Iu) stat %Iu(%Iu) stored %Iu lit %u ",
|
||||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||||
s->last_lit));
|
s->last_lit));
|
||||||
|
#else
|
||||||
|
Tracev((stderr, "\nopt %zu(%zu) stat %zu(%zu) stored %zu lit %u ",
|
||||||
|
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||||
|
s->last_lit));
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -997,8 +1003,16 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||||
s->compressed_len += 7; /* align on byte boundary */
|
s->compressed_len += 7; /* align on byte boundary */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
|
||||||
|
// RB begin
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
Tracev((stderr,"\ncomprlen %Iu(%Iu) ", s->compressed_len>>3,
|
||||||
s->compressed_len-7*last));
|
s->compressed_len-7*last));
|
||||||
|
#else
|
||||||
|
Tracev((stderr,"\ncomprlen %zu(%zu) ", s->compressed_len>>3,
|
||||||
|
s->compressed_len-7*last));
|
||||||
|
#endif
|
||||||
|
// RB end
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue