X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathAutoCorrect.cpp;h=17431114b8c983e622e6890d3147b1f13d379dae;hb=d85cf3218a14f5b7419dbc6b6796e65ff5dbfc74;hp=c8b6788af5235331b33417a6e1100337787dedf2;hpb=9d0ea8aeff32833a90b3fe64df0c5518a9e241be;p=lyx.git diff --git a/src/mathed/MathAutoCorrect.cpp b/src/mathed/MathAutoCorrect.cpp index c8b6788af5..17431114b8 100644 --- a/src/mathed/MathAutoCorrect.cpp +++ b/src/mathed/MathAutoCorrect.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -15,29 +15,29 @@ #include "InsetMath.h" #include "MathSupport.h" #include "MathParser.h" -#include "support/debug.h" +#include "support/debug.h" +#include "support/FileName.h" #include "support/filetools.h" // LibFileSearch #include "support/docstream.h" #include #include +using namespace std; namespace lyx { using support::libFileSearch; -using std::string; -using std::ifstream; -using std::endl; -using std::vector; - namespace { class Correction { public: /// + /// \brief Correction + // it is fine not to initialize from2_ + // coverity[UNINIT_CTOR] Correction() {} /// bool correct(MathAtom & at, char_type c) const; @@ -75,13 +75,6 @@ bool Correction::read(idocstream & is) } -void Correction::write(odocstream & os) const -{ - os << "from: '" << from1_ << "' and '" << from2_ - << "' to '" << to_ << '\'' << endl; -} - - bool Correction::correct(MathAtom & at, char_type c) const { //LYXERR(Debug::MATHED, @@ -97,6 +90,14 @@ bool Correction::correct(MathAtom & at, char_type c) const } +#if 0 +void Correction::write(odocstream & os) const +{ + os << "from: '" << from1_ << "' and '" << from2_ + << "' to '" << to_ << '\'' << endl; +} + + idocstream & operator>>(idocstream & is, Correction & corr) { corr.read(is); @@ -109,7 +110,7 @@ odocstream & operator<<(odocstream & os, Correction & corr) corr.write(os); return os; } - +#endif @@ -152,7 +153,7 @@ void initAutoCorrect() string line; ifstream is(file.toFilesystemEncoding().c_str()); while (getline(is, line)) { - if (line.size() == 0 || line[0] == '#') { + if (line.empty() || line[0] == '#') { //LYXERR(Debug::MATHED, "ignoring line '" << line << '\''); continue; } @@ -173,7 +174,7 @@ void initAutoCorrect() } // namespace anon -bool math_autocorrect(MathAtom & at, char c) +bool math_autocorrect(MathAtom & at, char_type c) { static bool initialized = false;