| 90 | static int64_t constexpr INVALID_POS = -1; |
| 91 | |
| 92 | uint64_t FileData::Size() const |
| 93 | { |
| 94 | int64_t const pos = ftell64(m_File); |
| 95 | if (pos == INVALID_POS) |
| 96 | MYTHROW(Reader::SizeException, (GetErrorProlog(), pos)); |
| 97 | |
| 98 | if (fseek64(m_File, 0, SEEK_END)) |
| 99 | MYTHROW(Reader::SizeException, (GetErrorProlog())); |
| 100 | |
| 101 | int64_t const size = ftell64(m_File); |
| 102 | if (size == INVALID_POS) |
| 103 | MYTHROW(Reader::SizeException, (GetErrorProlog(), size)); |
| 104 | |
| 105 | if (fseek64(m_File, static_cast<off_t>(pos), SEEK_SET)) |
| 106 | MYTHROW(Reader::SizeException, (GetErrorProlog(), pos)); |
| 107 | |
| 108 | ASSERT_GREATER_OR_EQUAL(size, 0, ()); |
| 109 | return static_cast<uint64_t>(size); |
| 110 | } |
| 111 | |
| 112 | void FileData::Read(uint64_t pos, void * p, size_t size) |
| 113 | { |
no outgoing calls