mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-12 22:53:27 +00:00
removed nesting
This commit is contained in:
@@ -184,8 +184,11 @@ namespace
|
||||
if (!file.read(reinterpret_cast<char*>(&lc), sizeof(lc))) [[unlikely]]
|
||||
return std::nullopt;
|
||||
|
||||
if (lc.cmd == segment_cmd)
|
||||
if (lc.cmd != segment_cmd)
|
||||
{
|
||||
cmd_offset += static_cast<std::streamoff>(lc.cmdsize);
|
||||
continue;
|
||||
}
|
||||
SegmentType segment{};
|
||||
file.seekg(cmd_offset, std::ios_base::beg);
|
||||
if (!file.read(reinterpret_cast<char*>(&segment), sizeof(segment))) [[unlikely]]
|
||||
@@ -200,26 +203,24 @@ namespace
|
||||
if (!file.read(reinterpret_cast<char*>(§ion), sizeof(section))) [[unlikely]]
|
||||
return std::nullopt;
|
||||
|
||||
if (get_section_name(section.sectname) == section_name)
|
||||
if (get_section_name(section.sectname) != section_name)
|
||||
{
|
||||
sect_offset += static_cast<std::streamoff>(sizeof(section));
|
||||
continue;
|
||||
}
|
||||
|
||||
ExtractedSection out;
|
||||
out.virtual_base_addr = static_cast<std::uintptr_t>(section.addr);
|
||||
out.raw_base_addr = static_cast<std::uintptr_t>(section.offset);
|
||||
out.data.resize(static_cast<std::size_t>(section.size));
|
||||
|
||||
file.seekg(static_cast<std::streamoff>(section.offset), std::ios_base::beg);
|
||||
if (!file.read(reinterpret_cast<char*>(out.data.data()),
|
||||
static_cast<std::streamsize>(out.data.size()))) [[unlikely]]
|
||||
if (!file.read(reinterpret_cast<char*>(out.data.data()), static_cast<std::streamsize>(out.data.size())))
|
||||
[[unlikely]]
|
||||
return std::nullopt;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
sect_offset += static_cast<std::streamoff>(sizeof(section));
|
||||
}
|
||||
}
|
||||
|
||||
cmd_offset += static_cast<std::streamoff>(lc.cmdsize);
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user