Le 07/03/2017 à 12:08, Jean-Marc Lasgouttes a écrit :
commit dc126bad0441eb8721043e597657d5c18bdf6c90
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Tue Mar 7 12:02:54 2017 +0100

    Fix typo found by coverity

    We were not testing for the right end(), although it is not sure that
    an actual bug could be triggered because of that.

Richard,

This is a bug that you marked as false positive on coverity. Do you agree now that the fix was needed?

Actually there are other uses of the variable `formats' in Formats.cpp, and I think that they are all incorrect (should be formatlist). This will not matter in most cases, fortunately.

A good way to avoid this would be to instantiate formats and system_formats in some other .cpp file. They should not be available in Format.cpp. What is the correct idiom for this?

JMarc

---
 src/Format.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/Format.cpp b/src/Format.cpp
index b605c4e..1b53d73 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -433,7 +433,7 @@ string Formats::getFormatFromFile(FileName const & 
filename) const
                                        Formats::const_iterator cit =
                                                find_if(formatlist.begin(), 
formatlist.end(),
                                                        FormatMimeEqual(mime));
-                                       if (cit != formats.end()) {
+                                       if (cit != formatlist.end()) {
                                                LYXERR(Debug::GRAPHICS, "\tgot 
format from MIME type: "
                                                        << mime << " -> " << 
cit->name());
                                                // See special eps/ps handling 
below


Reply via email to