Misc: Make struct member functions file-local

This commit is contained in:
Stenzek
2023-11-18 16:21:51 +10:00
parent bee1f986a9
commit cce7be4723
39 changed files with 680 additions and 595 deletions

View File

@ -1,18 +1,23 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "assert.h"
#include "cd_image.h"
#include "cd_subchannel_replacement.h"
#include "common/error.h"
#include "common/file_system.h"
#include "common/log.h"
#include "common/path.h"
#include <algorithm>
#include <cerrno>
#include <map>
Log_SetChannel(CDImageMds);
namespace {
#pragma pack(push, 1)
struct TrackEntry
{
@ -53,6 +58,8 @@ private:
CDSubChannelReplacement m_sbi;
};
} // namespace
CDImageMds::CDImageMds() = default;
CDImageMds::~CDImageMds()
@ -112,7 +119,8 @@ bool CDImageMds::OpenAndParse(const char* filename, Error* error)
if (track_count > 99 || track_offset >= mds.size())
{
Log_ErrorPrintf("Invalid track count/block offset %u/%u in '%s'", track_count, track_offset, filename);
Error::SetString(error, fmt::format("Invalid track count/block offset {}/{} in '{}'", track_count, track_offset, filename));
Error::SetString(
error, fmt::format("Invalid track count/block offset {}/{} in '{}'", track_count, track_offset, filename));
return false;
}
@ -142,7 +150,8 @@ bool CDImageMds::OpenAndParse(const char* filename, Error* error)
if (PackedBCDToBinary(track.track_number) != track_number)
{
Log_ErrorPrintf("Unexpected track number 0x%02X in track %u", track.track_number, track_number);
Error::SetString(error, fmt::format("Unexpected track number 0x{:02X} in track {}", track.track_number, track_number));
Error::SetString(error,
fmt::format("Unexpected track number 0x{:02X} in track {}", track.track_number, track_number));
return false;
}
@ -176,7 +185,8 @@ bool CDImageMds::OpenAndParse(const char* filename, Error* error)
if (track_pregap > track_start_lba)
{
Log_ErrorPrintf("Track pregap %u is too large for start lba %u", track_pregap, track_start_lba);
Error::SetString(error, fmt::format("Track pregap {} is too large for start lba {}", track_pregap, track_start_lba));
Error::SetString(error,
fmt::format("Track pregap {} is too large for start lba {}", track_pregap, track_start_lba));
return false;
}