From 8f2ec5faed903a91c1bcfb3270c2801568e9e446 Mon Sep 17 00:00:00 2001 From: Jon Szymaniak Date: Wed, 15 Jul 2015 15:14:49 -0400 Subject: [PATCH] burst tagger: Fixed off-by-one in get_tags_in_range() usage I've observed missing "tx_sob" tags in case where d_tag_name is associated with the last sample provided to work(). This is caused by the upper-bound provided to get_tags_in_range() being 1 less than it should be. Per the documentation of get_tags_in_range() (as of v3.7.7.1), the abs_end value is exclusive: "Given a [start,end), returns a vector of all tags in the range with a given key." Therefore, the upper limit should be: nread + nouput_items not nread + noutput_items - 1 Example: let nread = 100 let noutput_items = 100 We want tags within: [100, 199] = [nread, n_read + n_output_items - 1] Represented with an exclusive upper bound, as required by get_tags_in_range(): [100, 200) = [nread, n_read + nouput_items) --- lib/burst_tagger_impl.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/burst_tagger_impl.cc b/lib/burst_tagger_impl.cc index 4bfaabf..418d052 100644 --- a/lib/burst_tagger_impl.cc +++ b/lib/burst_tagger_impl.cc @@ -73,8 +73,7 @@ burst_tagger_impl::work(int noutput_items, std::vector tags; const uint64_t nread = nitems_read(0); - get_tags_in_range(tags, 0, nread, nread + noutput_items - 1, - d_tag_name); + get_tags_in_range(tags, 0, nread, nread + noutput_items, d_tag_name); std::sort(tags.begin(), tags.end(), tag_t::offset_compare); // copy until the first tag