[coff] Eliminate another peek() function

This commit is contained in:
Alexander Karatarakis 2016-11-17 16:22:22 -08:00
parent f0ef09c3fc
commit c6ac0e5ca7

View File

@ -75,14 +75,6 @@ namespace vcpkg { namespace COFFFileReader
return ret; return ret;
} }
static coff_file_header peek(fstream& fs)
{
auto original_pos = fs.tellg().seekpos();
coff_file_header ret = read(fs);
fs.seekg(original_pos);
return ret;
}
MachineType machineType() const MachineType machineType() const
{ {
static const size_t MACHINE_TYPE_OFFSET = 0; static const size_t MACHINE_TYPE_OFFSET = 0;
@ -272,7 +264,7 @@ namespace vcpkg { namespace COFFFileReader
{ {
const uint16_t first_two_bytes = peek_value_from_stream<uint16_t>(fs); const uint16_t first_two_bytes = peek_value_from_stream<uint16_t>(fs);
const bool isImportHeader = getMachineType(first_two_bytes) == MachineType::UNKNOWN; const bool isImportHeader = getMachineType(first_two_bytes) == MachineType::UNKNOWN;
const MachineType machine = isImportHeader ? import_header::read(fs).machineType() : coff_file_header::peek(fs).machineType(); const MachineType machine = isImportHeader ? import_header::read(fs).machineType() : coff_file_header::read(fs).machineType();
machine_types.insert(machine); machine_types.insert(machine);
} }
marker.advance_by(archive_member_header::HEADER_SIZE + header.member_size()); marker.advance_by(archive_member_header::HEADER_SIZE + header.member_size());