@@ -6,7 +6,6 @@
#include < algorithm>
#include < array>
#include < cinttypes>
#include < cstring>
#include < limits>
#include < map>
@@ -104,8 +103,7 @@ bool WIARVZFileReader<RVZ>::Initialize(const std::string& path)
if (version < file_version_compatible || version_read_compatible > file_version)
{
ERROR_LOG (DISCIO, " Unsupported version %s in %s" , VersionToString (file_version).c_str (),
path.c_str ());
ERROR_LOG_FMT (DISCIO, " Unsupported version {} in {}" , VersionToString (file_version), path);
return false ;
}
@@ -117,7 +115,7 @@ bool WIARVZFileReader<RVZ>::Initialize(const std::string& path)
if (Common::swap64 (m_header_1.wia_file_size ) != m_file.GetSize ())
{
ERROR_LOG (DISCIO, " File size is incorrect for %s " , path. c_str () );
ERROR_LOG_FMT (DISCIO, " File size is incorrect for {} " , path);
return false ;
}
@@ -156,7 +154,7 @@ bool WIARVZFileReader<RVZ>::Initialize(const std::string& path)
if (m_compression_type > (RVZ ? WIARVZCompressionType::Zstd : WIARVZCompressionType::LZMA2) ||
(RVZ && m_compression_type == WIARVZCompressionType::Purge))
{
ERROR_LOG (DISCIO, " Unsupported compression type %u in %s " , compression_type, path. c_str () );
ERROR_LOG_FMT (DISCIO, " Unsupported compression type {} in {} " , compression_type, path);
return false ;
}
@@ -785,7 +783,7 @@ bool WIARVZFileReader<RVZ>::Chunk::HandleExceptions(const u8* data, size_t bytes
{
if (sizeof (u16) + *bytes_used > bytes_allocated)
{
ERROR_LOG (DISCIO, " More hash exceptions than expected" );
ERROR_LOG_FMT (DISCIO, " More hash exceptions than expected" );
return false ;
}
if (sizeof (u16) + *bytes_used > bytes_written)
@@ -799,7 +797,7 @@ bool WIARVZFileReader<RVZ>::Chunk::HandleExceptions(const u8* data, size_t bytes
if (exception_list_size + *bytes_used > bytes_allocated)
{
ERROR_LOG (DISCIO, " More hash exceptions than expected" );
ERROR_LOG_FMT (DISCIO, " More hash exceptions than expected" );
return false ;
}
if (exception_list_size + *bytes_used > bytes_written)
@@ -950,17 +948,17 @@ ConversionResultCode WIARVZFileReader<RVZ>::SetUpDataEntriesForWriting(
if (partition.offset < last_partition_end_offset)
{
WARN_LOG (DISCIO, " Overlapping partitions at % " PRIx64 , partition.offset );
WARN_LOG_FMT (DISCIO, " Overlapping partitions at {:x} " , partition.offset );
continue ;
}
if (volume->ReadSwapped <u32>(partition.offset , PARTITION_NONE) != u32 ( 0x10001 ) )
if (volume->ReadSwapped <u32>(partition.offset , PARTITION_NONE) != 0x10001U )
{
// This looks more like garbage data than an actual partition.
// The values of data_offset and data_size will very likely also be garbage.
// Some WBFS writing programs scrub the SSBB Masterpiece partitions without
// removing them from the partition table, causing this problem.
WARN_LOG (DISCIO, " Invalid partition at % " PRIx64 , partition.offset );
WARN_LOG_FMT (DISCIO, " Invalid partition at {:x} " , partition.offset );
continue ;
}
@@ -977,19 +975,19 @@ ConversionResultCode WIARVZFileReader<RVZ>::SetUpDataEntriesForWriting(
if (data_start % VolumeWii::BLOCK_TOTAL_SIZE != 0 )
{
WARN_LOG (DISCIO, " Misaligned partition at % " PRIx64 , partition.offset );
WARN_LOG_FMT (DISCIO, " Misaligned partition at {:x} " , partition.offset );
continue ;
}
if (*data_size < VolumeWii::BLOCK_TOTAL_SIZE)
{
WARN_LOG (DISCIO, " Very small partition at % " PRIx64 , partition.offset );
WARN_LOG_FMT (DISCIO, " Very small partition at {:x} " , partition.offset );
continue ;
}
if (data_end > iso_size)
{
WARN_LOG (DISCIO, " Too large partition at % " PRIx64 , partition.offset );
WARN_LOG_FMT (DISCIO, " Too large partition at {:x} " , partition.offset );
*data_size = iso_size - *data_offset - partition.offset ;
}
@@ -1711,7 +1709,8 @@ bool WIARVZFileReader<RVZ>::WriteHeader(File::IOFile* file, const u8* data, size
// is past the upper bound, we are already at the end of the file, so we don't need to do anything
if (*bytes_written <= upper_bound && *bytes_written + size > upper_bound)
{
WARN_LOG (DISCIO, " Headers did not fit in the allocated space. Writing to end of file instead" );
WARN_LOG_FMT (DISCIO,
" Headers did not fit in the allocated space. Writing to end of file instead" );
if (!file->Seek (0 , SEEK_END))
return false ;
*bytes_written = file->Tell ();