Replace most returns with CHECK_ASSERTION

Also fix some Seek methods return types being unsigned, while returning
negative errors.

Added the CHECK_ASSERTION macro checks in a couple more places.

Simplified CHECK_ASSERTION macro usage.
This commit is contained in:
Raul Tambre 2015-11-08 13:42:41 +02:00
parent 9c2f48cd1d
commit 5d5a4f804b
14 changed files with 159 additions and 394 deletions

View file

@ -86,11 +86,7 @@ bool UnpackPKG(const fs::file& pkg_f, const std::string& dir, volatile f64& prog
// Define decryption subfunction (`psp` arg selects the key for specific block)
auto decrypt = [&](u64 offset, u64 size, bool psp) -> u64
{
if (pkg_f.seek(start_offset + header.data_offset + offset) < 0)
{
LOG_ERROR(LOADER, "PKG: Package file seek to %u failed.", start_offset + header.data_offset + offset);
return -1;
}
CHECK_ASSERTION(pkg_f.seek(start_offset + header.data_offset + offset) != -1);
// Read the data and set available size
const u64 read = pkg_f.read(buf.get(), size);