Some changes to the design of base-writer.hpp

This commit is contained in:
2023-09-11 11:58:26 -04:00
parent b7b215f79c
commit ff4ed323e0
3 changed files with 28 additions and 12 deletions

View File

@@ -235,8 +235,12 @@ class ReplayLogfile : public BaseReader<ReplayLogfile>, public std::ifstream {
using std::ifstream::ifstream;
public:
using read_string_type = std::string;
void read_bytes_into(char *n, size_t size) { read(n, size); }
bool read_beyond_eof() { return !good(); }
void read_bytes_into(char *n, size_t size) {
read(n, size);
if (!good()) {
memset(n, 0, size);
}
}
void raise_string_too_long() {
fprintf(stderr, "string in logfile is too long");
std::abort();