Mesa (main): util/fossilize_db: Update parsed_offset correctly.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 7 20:40:22 UTC 2021


Module: Mesa
Branch: main
Commit: 3c51a3aa954bb09ceb7c101dc02c1b11fb250bbf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c51a3aa954bb09ceb7c101dc02c1b11fb250bbf

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Thu Aug  5 01:26:15 2021 +0200

util/fossilize_db: Update parsed_offset correctly.

If things went perfectly parsed_offset was never updated for the
final entry and we'd seek_set to the start of the last entry. Is
fun when appending to the file next.

Fixes: 2ec1bff0f3a "util/fossilize_db: Split out reading the index."
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12204>

---

 src/util/fossilize_db.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c
index 8032e979b67..8a380812425 100644
--- a/src/util/fossilize_db.c
+++ b/src/util/fossilize_db.c
@@ -120,8 +120,6 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx)
 
    fseek(db_idx, offset, SEEK_SET);
    while (offset < len) {
-      parsed_offset = offset;
-
       char bytes_to_read[FOSSILIZE_BLOB_HASH_LENGTH + sizeof(struct foz_payload_header)];
       struct foz_payload_header *header;
 
@@ -171,6 +169,7 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx)
       _mesa_hash_table_u64_insert(foz_db->index_db, key, entry);
 
       offset += header->payload_size;
+      parsed_offset = offset;
    }
 
 



More information about the mesa-commit mailing list