mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
IOS: Simplify usage of GetVector
By making GetVector return nullptr for invalid indices, we don't have to check the total number of vectors all the time before calling GetVector.
This commit is contained in:
@ -78,7 +78,8 @@ IOCtlVRequest::IOCtlVRequest(const u32 address_) : Request(address_)
|
||||
|
||||
const IOCtlVRequest::IOVector* IOCtlVRequest::GetVector(size_t index) const
|
||||
{
|
||||
ASSERT(index < (in_vectors.size() + io_vectors.size()));
|
||||
if (index >= in_vectors.size() + io_vectors.size())
|
||||
return nullptr;
|
||||
if (index < in_vectors.size())
|
||||
return &in_vectors[index];
|
||||
return &io_vectors[index - in_vectors.size()];
|
||||
|
@ -154,7 +154,10 @@ struct IOCtlVRequest final : Request
|
||||
// merging them into a single std::vector would make using the first out vector more complicated.
|
||||
std::vector<IOVector> in_vectors;
|
||||
std::vector<IOVector> io_vectors;
|
||||
|
||||
/// Returns the specified vector or nullptr if the index is out of bounds.
|
||||
const IOVector* GetVector(size_t index) const;
|
||||
|
||||
explicit IOCtlVRequest(u32 address);
|
||||
bool HasNumberOfValidVectors(size_t in_count, size_t io_count) const;
|
||||
void Dump(std::string_view description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
|
Reference in New Issue
Block a user