X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLexer.cpp;h=df2ce6913100ef292cb1c5f8f22f16fe92acff33;hb=84d4d45daa9e0b1a18ab0133c6caa5f34e7f8616;hp=778a0f2218338df5e781a6feacb35da599752eee;hpb=62ca7f3ae55ad2e0c395cb554d71afab87de1ee3;p=lyx.git diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 778a0f2218..df2ce69131 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -14,6 +14,7 @@ #include #include "Lexer.h" +#include "Format.h" #include "support/convert.h" #include "support/debug.h" @@ -238,9 +239,7 @@ void Lexer::Pimpl::popTable() bool Lexer::Pimpl::setFile(FileName const & filename) { // Check the format of the file. - string const format = filename.guessFormatFromContents(); - - if (format == "gzip" || format == "zip" || format == "compress") { + if (formats.isZippedFile(filename)) { LYXERR(Debug::LYXLEX, "lyxlex: compressed"); // The check only outputs a debug message, because it triggers // a bug in compaq cxx 6.2, where is_open() returns 'true' for @@ -274,9 +273,9 @@ bool Lexer::Pimpl::setFile(FileName const & filename) // Skip byte order mark. if (is.peek() == 0xef) { - int c = is.get(); + is.get(); if (is.peek() == 0xbb) { - c = is.get(); + is.get(); LASSERT(is.get() == 0xbf, /**/); } else is.unget(); @@ -473,7 +472,7 @@ bool Lexer::Pimpl::eatLine() is.get(cc); c = cc; //LYXERR(Debug::LYXLEX, "Lexer::EatLine read char: `" << c << '\''); - if (c != '\r') + if (c != '\r' && is) buff.push_back(c); }