| 891 | } |
| 892 | |
| 893 | void read_raw(void * ptr, size_t len) const { |
| 894 | if (len == 0) { |
| 895 | return; |
| 896 | } |
| 897 | errno = 0; |
| 898 | std::size_t ret = std::fread(ptr, len, 1, fp); |
| 899 | if (ferror(fp)) { |
| 900 | throw std::runtime_error(format("read error: %s", strerror(errno))); |
| 901 | } |
| 902 | if (ret != 1) { |
| 903 | throw std::runtime_error(std::string("unexpectedly reached end of file")); |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | uint32_t read_u32() const { |
| 908 | uint32_t ret; |
no test coverage detected