-LOC_EXPORT int loc_stringpool_read(struct loc_stringpool* pool, FILE* f, off_t offset, size_t length) {
- // Allocate enough space
- int r = loc_stringpool_allocate(pool, length);
- if (r)
- return r;
-
- DEBUG(pool->ctx, "Reading string pool from %zu\n", offset);
-
- // Seek to the right offset
- r = fseek(f, offset, SEEK_SET);
- if (r)
- return r;
-
- size_t bytes_read = fread(pool->data, sizeof(*pool->data), length, f);
- if (bytes_read < length) {
- ERROR(pool->ctx, "Could not read pool. Only read %zu bytes\n", bytes_read);
- return 1;
- }
-
- DEBUG(pool->ctx, "Read pool of %zu bytes\n", length);
-
- return 0;
-}
-