X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBiblioInfo.cpp;h=44321bcad3f90a62a7e25489757a7da6603a6f75;hb=45e3a8f82701e981b1ccb2ab8d76f269867d7889;hp=9a93ed4cab288e86d5817f9a61966a75248d70f2;hpb=643deb8aa0424d52f7bc951bae95c9ec8209cfd4;p=lyx.git diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 9a93ed4cab..44321bcad3 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -756,8 +756,7 @@ docstring BibTeXInfo::getValueForKey(string const & oldkey, Buffer const & buf, ret = html::cleanAttr(ret); // make sure it is not too big - if (ret.size() > maxsize) - ret = ret.substr(0, maxsize - 3) + from_ascii("..."); + support::truncateWithEllipsis(ret, maxsize); return ret; } @@ -928,21 +927,18 @@ docstring const BiblioInfo::getLabel(vector keys, before, after, dialog, key + 1 != ken); } - if (ret.size() > max_size) { - ret.resize(max_size - 3); - ret += "..."; - } else if (too_many_keys) { - if (ret.size() > max_size - 3) - ret.resize(max_size - 3); - ret += "..."; - } + if (too_many_keys) + ret.push_back(0x2026);//HORIZONTAL ELLIPSIS + support::truncateWithEllipsis(ret, max_size); return ret; } bool BiblioInfo::isBibtex(docstring const & key) const { - BiblioInfo::const_iterator it = find(key); + docstring key1; + split(key, key1, ','); + BiblioInfo::const_iterator it = find(key1); if (it == end()) return false; return it->second.isBibTeX(); @@ -1003,9 +999,9 @@ void BiblioInfo::collectCitedEntries(Buffer const & buf) // FIXME We may want to collect these differently, in the first case, // so that we might have them in order of appearance. set citekeys; - Toc const & toc = buf.tocBackend().toc("citation"); - Toc::const_iterator it = toc.begin(); - Toc::const_iterator const en = toc.end(); + shared_ptr toc = buf.tocBackend().toc("citation"); + Toc::const_iterator it = toc->begin(); + Toc::const_iterator const en = toc->end(); for (; it != en; ++it) { if (it->str().empty()) continue; @@ -1064,6 +1060,11 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf) docstring const num = convert(++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() && entry.getAbbreviatedAuthor() == last->second.getAbbreviatedAuthor() // we access the year via getYear() so as to get it from the xref,