Le 08/03/2017 à 17:07, Jean-Marc Lasgouttes a écrit :
commit dee0ea0c214a85806d234a6b7e4b1b694e1e78f4
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Wed Mar 8 17:03:48 2017 +0100
Make a test clearer
This should hopefully please coverity now. For some reason, the
annotation did not work. Should it be in lower case?
Richard, could you confirm that the new code is correct? As far as I
know bimap_end() cannot change here and initializing the last iterator
is better practice anyway.
The annotation you used did not seem to convince coverity that
everything is alright.
JMarc
---
src/BiblioInfo.cpp | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 4220fe0..2dcc26f 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -1263,7 +1263,7 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
// used to remember the last one we saw
// we'll be comparing entries to see if we need to add
// modifiers, like "1984a"
- map<docstring, BibTeXInfo>::iterator last;
+ map<docstring, BibTeXInfo>::iterator last = bimap_.end();
vector<docstring>::const_iterator it = cited_entries_.begin();
vector<docstring>::const_iterator const en = cited_entries_.end();
@@ -1278,12 +1278,7 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
docstring const num = convert<docstring>(++keynumber);
entry.setCiteNumber(num);
} else {
- // coverity complains about our derefercing the
iterator last,
- // which was not initialized above. but it does get
initialized
- // after the first time through the loop, which is the
point of
- // the first test.
- // coverity[FORWARD_NULL]
- if (it != cited_entries_.begin()
+ if (last != bimap_.end()
&& entry.getAuthorOrEditorList() ==
last->second.getAuthorOrEditorList()
// we access the year via getYear() so as to get it
from the xref,
// if we need to do so