]> git.lyx.org Git - lyx.git/blobdiff - src/Lexer.cpp
Get rid of rtl_support preference
[lyx.git] / src / Lexer.cpp
index 778a0f2218338df5e781a6feacb35da599752eee..c4b738f119bcf13fe903d8a74df6e53e1514bc28 100644 (file)
@@ -14,6 +14,7 @@
 #include <config.h>
 
 #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);
        }
 
@@ -570,7 +569,7 @@ void Lexer::Pimpl::pushToken(string const & pt)
 //////////////////////////////////////////////////////////////////////
 
 Lexer::Lexer()
-       : pimpl_(new Pimpl(0, 0))
+       : pimpl_(new Pimpl(0, 0)), lastReadOk_(false)
 {}