| 46 | std::streamsize MPQStream::StartOfBlockForTesting() const { return _startOfBlock; } |
| 47 | |
| 48 | int MPQStream::underflow() { |
| 49 | if (gptr() == egptr()) { |
| 50 | _startOfBlock += egptr() - eback(); |
| 51 | DWORD amountRead; |
| 52 | if (!SFileReadFile(_mpqFile, _buffer, sizeof(_buffer), &amountRead, nullptr)) { |
| 53 | if (GetLastError() != ERROR_HANDLE_EOF) { |
| 54 | throw std::runtime_error("Error reading file from MPQ"); |
| 55 | } |
| 56 | } |
| 57 | setg(_buffer, _buffer, _buffer + amountRead); |
| 58 | } |
| 59 | |
| 60 | return gptr() == egptr() ? traits_type::eof() : traits_type::to_int_type(*gptr()); |
| 61 | } |
| 62 | |
| 63 | std::streambuf::pos_type MPQStream::seekpos(const pos_type pos, const std::ios_base::openmode which) { return seekoff(pos, std::ios_base::beg, which); } |
| 64 |
nothing calls this directly
no outgoing calls
no test coverage detected