diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-02 09:41:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-02 09:41:41 +0300 |
commit | 0bd8d6d1949f29d283c6f00d4a316c4c9b2c8a5e (patch) | |
tree | 09eda5cc27fb4258a9428d0382c3654024b3938f /source/blender/blenlib | |
parent | d931e958a1a2e4080c84ed757e8db00bf64594e0 (diff) |
Add extra validation checks to array-store
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/array_store.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 7f657f4a048..b559061d2e3 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -1640,6 +1640,21 @@ bool BLI_array_store_is_valid( if (!(bchunk_list_size(chunk_list) == chunk_list->total_size)) { return false; } + + if (BLI_listbase_count(&chunk_list->chunk_refs) != chunk_list->chunk_refs_len) { + return false; + } + +#ifdef USE_MERGE_CHUNKS + /* ensure we merge all chunks that could be merged */ + if (chunk_list->total_size > bs->info.chunk_byte_size_min) { + for (BChunkRef *cref = chunk_list->chunk_refs.first; cref; cref = cref->next) { + if (cref->link->data_len < bs->info.chunk_byte_size_min) { + return false; + } + } + } +#endif } { |