]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Account for old versions of Pygments
[lyx.git] / src / VCBackend.cpp
index 9f9a3ff082ecce8d89473f46ce23c347721df58a..a152a28d101e11f209f202243f6c0b011a91d2f3 100644 (file)
@@ -31,6 +31,7 @@
 #include "support/TempFile.h"
 
 #include <fstream>
+#include <iomanip>
 #include <sstream>
 
 using namespace std;
@@ -170,6 +171,8 @@ void RCS::scanMaster()
        LYXERR(Debug::LYXVC, "LyXVC::RCS: scanMaster: " << master_);
 
        ifstream ifs(master_.toFilesystemEncoding().c_str());
+       // limit the size of strings we read to avoid memory problems
+       ifs >> setw(65636);
 
        string token;
        bool read_enough = false;
@@ -284,7 +287,7 @@ LyXVC::CommandResult RCS::checkIn(string const & msg, string & log)
 
 bool RCS::checkInEnabled()
 {
-       return owner_ && !owner_->isReadonly();
+       return owner_ && !owner_->hasReadonlyFlag();
 }
 
 
@@ -326,7 +329,7 @@ string RCS::checkOut()
 
 bool RCS::checkOutEnabled()
 {
-       return owner_ && owner_->isReadonly();
+       return owner_ && owner_->hasReadonlyFlag();
 }
 
 
@@ -566,10 +569,10 @@ void CVS::scanMaster()
                if (contains(line, tmpf)) {
                        // Ok extract the fields.
                        smatch sm;
-
-                       // false positive from coverity
-                       // coverity[CHECKED_RETURN]
-                       regex_match(line, sm, reg);
+                       if (!regex_match(line, sm, reg)) {
+                               LYXERR(Debug::LYXVC, "\t  Cannot parse line. Skipping.");
+                               continue;
+                       }
 
                        //sm[0]; // whole matched string
                        //sm[1]; // filename