Mercurial > dovecot > core-2.2
changeset 19777:bcdda0e61d7d
lib-index: Fixed mail_index_lookup_ext_full()'s map_r with transaction-view.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 19 Feb 2016 19:11:53 +0200 |
parents | d49645a28c44 |
children | 3432ea258fe9 |
files | src/lib-index/mail-index-transaction-view.c |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-view.c Fri Feb 19 19:08:43 2016 +0200 +++ b/src/lib-index/mail-index-transaction-view.c Fri Feb 19 19:11:53 2016 +0200 @@ -411,6 +411,22 @@ 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;