X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLexer.cpp;h=06a3408f41e9591d77afabfbb3074d2f3b18d9de;hb=f1f63fcad0a5512dc277fd8e401ac6cd5736c699;hp=778a0f2218338df5e781a6feacb35da599752eee;hpb=62ca7f3ae55ad2e0c395cb554d71afab87de1ee3;p=lyx.git diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 778a0f2218..06a3408f41 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" @@ -237,10 +238,14 @@ void Lexer::Pimpl::popTable() bool Lexer::Pimpl::setFile(FileName const & filename) { +#ifdef TEX2LYX + // tex2lyx does not read lyxrc and therefore can't really check for + // zipped formats. + if (false) { +#else // Check the format of the file. - string const format = filename.guessFormatFromContents(); - - if (format == "gzip" || format == "zip" || format == "compress") { + if (formats.isZippedFile(filename)) { +#endif 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 +279,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 +478,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); }