A few more cases to populate the hash in addpool

This commit is contained in:
Erica Fischer
2024-02-02 14:12:34 -08:00
parent 353cdf16e6
commit 4b8574aa87
4 changed files with 24 additions and 10 deletions
+3 -1
View File
@@ -49,10 +49,11 @@ int memfile_close(struct memfile *file) {
return 0;
}
int memfile_write(struct memfile *file, void *s, long long len) {
int memfile_write(struct memfile *file, void *s, long long len, bool &in_memory) {
// If it is full, append to the file.
// If it is not full yet, append to the string in memory.
in_memory = false;
if (file->fp != NULL) {
if (fwrite(s, sizeof(char), len, file->fp) != (size_t) len) {
return 0;
@@ -61,6 +62,7 @@ int memfile_write(struct memfile *file, void *s, long long len) {
} else {
file->map.append(std::string((char *) s, len));
file->off += len;
in_memory = true;
}
return len;