Skip to content

Commit

Permalink
lib-index: Fixed mail_index_lookup_ext_full()'s map_r with transactio…
Browse files Browse the repository at this point in the history
…n-view.
  • Loading branch information
sirainen committed Feb 19, 2016
1 parent ecb1ecd commit 382d45f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib-index/mail-index-transaction-view.c
Expand Up @@ -411,6 +411,22 @@ tview_lookup_ext_update(struct mail_index_view_transaction *tview, uint32_t seq,
tview->lookup_map =
mail_index_map_clone(tview->view.index->map);
}
if (!mail_index_map_get_ext_idx(tview->lookup_map, ext_id, &map_ext_idx)) {
/* extension doesn't yet exist in the map. add it there with
the preliminary information (mainly its size) so if caller
looks it up, it's going to be found. */
const struct mail_index_registered_ext *rext =
array_idx(&tview->view.index->extensions, ext_id);
struct mail_index_ext_header ext_hdr;

memset(&ext_hdr, 0, sizeof(ext_hdr));
ext_hdr.hdr_size = rext->hdr_size;
ext_hdr.record_size = ext_buf->arr.element_size - sizeof(uint32_t);
ext_hdr.record_align = rext->record_align;

mail_index_map_register_ext(tview->lookup_map, rext->name,
(uint32_t)-1, &ext_hdr);
}

data = array_idx(ext_buf, idx);
*map_r = tview->lookup_map;
Expand Down

0 comments on commit 382d45f

Please sign in to comment.