From 26f336769af8dd5c48c2c0241cd3fbfc50a3c65e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sun, 16 Sep 2007 10:36:57 +0000 Subject: [PATCH 1/1] Remove warnings reported with gcc 4.3: - Modifier on return type ignored - Ambigous else - Ambigous logical operators - Semi-colon instead of empty block - Missing header files - Missing using std::XX - Initialization out of order git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20304 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Converter.cpp | 3 ++- src/ConverterCache.cpp | 3 ++- src/CoordCache.h | 2 +- src/DocIterator.cpp | 3 ++- src/Format.cpp | 1 + src/Lexer.cpp | 6 +++-- src/LyX.cpp | 2 +- src/LyX.h | 2 +- src/ParagraphMetrics.cpp | 2 +- src/Row.cpp | 10 +++---- src/Row.h | 4 +-- src/TocBackend.cpp | 4 +-- src/TocBackend.h | 4 +-- src/frontends/LyXView.cpp | 2 +- src/frontends/LyXView.h | 4 +-- src/frontends/controllers/ButtonPolicy.cpp | 4 +-- src/frontends/controllers/ControlCitation.cpp | 2 +- src/frontends/controllers/ControlCitation.h | 2 +- src/frontends/controllers/ControlDocument.cpp | 24 +++++++++-------- src/frontends/controllers/ControlDocument.h | 14 +++++----- .../controllers/ControlParagraph.cpp | 2 +- src/frontends/controllers/ControlParagraph.h | 2 +- src/frontends/controllers/ControlPrefs.cpp | 4 +-- src/frontends/controllers/ControlPrefs.h | 4 +-- src/frontends/controllers/ControlRef.cpp | 1 + src/frontends/qt4/GuiGraphics.cpp | 27 ++++++++++--------- src/frontends/qt4/GuiImage.cpp | 6 +++-- src/frontends/qt4/TocModel.cpp | 2 ++ src/insets/ExternalSupport.cpp | 3 ++- src/insets/InsetCollapsable.cpp | 3 ++- src/insets/InsetInclude.cpp | 15 ++++++----- src/insets/InsetListingsParams.cpp | 2 +- src/insets/InsetTabular.cpp | 2 +- src/mathed/InsetMathGrid.cpp | 12 ++++----- src/output_latex.cpp | 6 +++-- src/support/lstrings.h | 1 + src/support/qstring_helpers.h | 2 +- src/support/rename.cpp | 3 ++- src/tex2lyx/preamble.cpp | 3 ++- 39 files changed, 109 insertions(+), 89 deletions(-) diff --git a/src/Converter.cpp b/src/Converter.cpp index f2a463868e..3108d6d286 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -365,9 +365,10 @@ bool Converters::convert(Buffer const * buffer, cit != edgepath.end(); ++cit) { Converter const & conv = converterlist_[*cit]; bool dummy = conv.To->dummy() && conv.to != "program"; - if (!dummy) + if (!dummy) { LYXERR(Debug::FILES) << "Converting from " << conv.from << " to " << conv.to << endl; + } infile = outfile; outfile = FileName(conv.result_dir.empty() ? changeExtension(from_file.absFilename(), conv.To->extension()) diff --git a/src/ConverterCache.cpp b/src/ConverterCache.cpp index 6bcaa60f25..72425ed8b3 100644 --- a/src/ConverterCache.cpp +++ b/src/ConverterCache.cpp @@ -296,11 +296,12 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, item->checksum = checksum; } if (!mover.copy(converted_file, item->cache_name, - support::onlyFilename(item->cache_name.absFilename()), 0600)) + support::onlyFilename(item->cache_name.absFilename()), 0600)) { LYXERR(Debug::FILES) << "ConverterCache::add(" << orig_from << "):\n" "Could not copy file." << std::endl; + } } else { CacheItem new_item(orig_from, to_format, timestamp, support::sum(orig_from)); diff --git a/src/CoordCache.h b/src/CoordCache.h index 63e0aece96..296de324e9 100644 --- a/src/CoordCache.h +++ b/src/CoordCache.h @@ -45,7 +45,7 @@ public: data_.clear(); } - bool const empty() const + bool empty() const { return data_.empty(); } diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index af36b64457..07e0d6f5e0 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -78,7 +78,7 @@ Inset * DocIterator::prevInset() const BOOST_ASSERT(!empty()); if (pos() == 0) return 0; - if (inMathed()) + if (inMathed()) { if (cell().empty()) // FIXME: this should not happen but it does. // See bug 3189 @@ -86,6 +86,7 @@ Inset * DocIterator::prevInset() const return 0; else return prevAtom().nucleus(); + } return paragraph().isInset(pos() - 1) ? paragraph().getInset(pos() - 1) : 0; } diff --git a/src/Format.cpp b/src/Format.cpp index 90f766bfeb..8bd34ad489 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -28,6 +28,7 @@ #include +using std::find_if; using std::string; using std::distance; diff --git a/src/Lexer.cpp b/src/Lexer.cpp index f9146a296b..4db980859f 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -274,9 +274,10 @@ bool Lexer::Pimpl::setFile(FileName const & filename) // The check only outputs a debug message, because it triggers // a bug in compaq cxx 6.2, where is_open() returns 'true' for // a fresh new filebuf. (JMarc) - if (fb_.is_open() || istream::off_type(is.tellg()) > 0) + if (fb_.is_open() || istream::off_type(is.tellg()) > 0) { LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: " "file or stream already set." << endl; + } fb_.open(filename.toFilesystemEncoding().c_str(), ios::in); is.rdbuf(&fb_); name = filename.absFilename(); @@ -288,9 +289,10 @@ bool Lexer::Pimpl::setFile(FileName const & filename) void Lexer::Pimpl::setStream(istream & i) { - if (fb_.is_open() || istream::off_type(is.tellg()) > 0) + if (fb_.is_open() || istream::off_type(is.tellg()) > 0) { LYXERR(Debug::LYXLEX) << "Error in Lexer::setStream: " "file or stream already set." << endl; + } is.rdbuf(i.rdbuf()); lineno = 0; } diff --git a/src/LyX.cpp b/src/LyX.cpp index 873888c291..21de3ff6cf 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -366,7 +366,7 @@ void LyX::setGuiLanguage(std::string const & language) } -Buffer const * const LyX::updateInset(Inset const * inset) const +Buffer const * LyX::updateInset(Inset const * inset) const { if (quitting || !inset) return 0; diff --git a/src/LyX.h b/src/LyX.h index be52628497..534704957e 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -103,7 +103,7 @@ public: /** redraw \c inset in all the BufferViews in which it is currently * visible. If successful return a pointer to the owning Buffer. */ - Buffer const * const updateInset(Inset const *) const; + Buffer const * updateInset(Inset const *) const; void hideDialogs(std::string const & name, Inset * inset) const; diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp index a05177831d..701e674233 100644 --- a/src/ParagraphMetrics.cpp +++ b/src/ParagraphMetrics.cpp @@ -71,7 +71,7 @@ using std::ostream; using std::ostringstream; -ParagraphMetrics::ParagraphMetrics(Paragraph const & par): par_(&par), position_(-1) +ParagraphMetrics::ParagraphMetrics(Paragraph const & par): position_(-1), par_(&par) { } diff --git a/src/Row.cpp b/src/Row.cpp index 6f1a31c078..c965210e7a 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -24,14 +24,14 @@ namespace lyx { Row::Row() - : changed_(false), crc_(0), pos_(0), end_(0), separator(0), hfill(0), - label_hfill(0), x(0), sel_beg(-1), sel_end(-1) + : separator(0), hfill(0), label_hfill(0), x(0), + sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(0), end_(0) {} Row::Row(pos_type pos) - : changed_(false), crc_(0), pos_(pos), end_(0), separator(0), hfill(0), - label_hfill(0), x(0), sel_beg(-1), sel_end(-1) + : separator(0), hfill(0), label_hfill(0), x(0), + sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0) {} @@ -89,7 +89,7 @@ void Row::setSelection(pos_type beg, pos_type end) } -void Row::dump(const char * s) const +void Row::dump(char const * s) const { lyxerr << s << " pos: " << pos_ << " end: " << end_ << " width: " << dim_.wid diff --git a/src/Row.h b/src/Row.h index f013fb49db..5b67abba5e 100644 --- a/src/Row.h +++ b/src/Row.h @@ -64,7 +64,7 @@ public: int descent() const { return dim_.des; } /// current debugging only - void dump(const char * = "") const; + void dump(char const * = "") const; /// width of a separator (i.e. space) double separator; @@ -78,8 +78,6 @@ public: pos_type sel_beg; /// pos_type sel_end; - - private: /// has the Row appearance changed since last drawing? bool changed_; diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 03f3a7433f..07fbc1fe51 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -40,13 +40,13 @@ TocItem::TocItem(ParConstIterator const & par_it, int d, } -int const TocItem::id() const +int TocItem::id() const { return par_it_->id(); } -int const TocItem::depth() const +int TocItem::depth() const { return depth_; } diff --git a/src/TocBackend.h b/src/TocBackend.h index 25b39c9538..60b4e51122 100644 --- a/src/TocBackend.h +++ b/src/TocBackend.h @@ -48,9 +48,9 @@ public: /// ~TocItem() {} /// - int const id() const; + int id() const; /// - int const depth() const; + int depth() const; /// docstring const & str() const; /// diff --git a/src/frontends/LyXView.cpp b/src/frontends/LyXView.cpp index 0ebbe0b676..29b4af65aa 100644 --- a/src/frontends/LyXView.cpp +++ b/src/frontends/LyXView.cpp @@ -421,7 +421,7 @@ void LyXView::dispatch(FuncRequest const & cmd) } -Buffer const * const LyXView::updateInset(Inset const * inset) +Buffer const * LyXView::updateInset(Inset const * inset) { WorkArea * work_area = currentWorkArea(); if (!work_area) diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index e7100d6f17..bf9aa5778d 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -62,7 +62,7 @@ public: virtual ~LyXView(); - int const id() const { return id_; } + int id() const { return id_; } virtual void close() = 0; @@ -174,7 +174,7 @@ public: /** redraw \c inset in all the BufferViews in which it is currently * visible. If successful return a pointer to the owning Buffer. */ - Buffer const * const updateInset(Inset const *); + Buffer const * updateInset(Inset const *); /// returns true if this view has the focus. virtual bool hasFocus() const = 0; diff --git a/src/frontends/controllers/ButtonPolicy.cpp b/src/frontends/controllers/ButtonPolicy.cpp index 8af5b6d652..69c15f9772 100644 --- a/src/frontends/controllers/ButtonPolicy.cpp +++ b/src/frontends/controllers/ButtonPolicy.cpp @@ -124,7 +124,7 @@ bool ButtonPolicy::isReadOnly() const } -static char const * const printState(ButtonPolicy::State const & state) +static char const * printState(ButtonPolicy::State const & state) { switch (state) { case ButtonPolicy::INITIAL: @@ -151,7 +151,7 @@ static char const * const printState(ButtonPolicy::State const & state) } -static char const * const printInput(ButtonPolicy::SMInput const & input) +static char const * printInput(ButtonPolicy::SMInput const & input) { switch (input) { case ButtonPolicy::SMI_VALID: diff --git a/src/frontends/controllers/ControlCitation.cpp b/src/frontends/controllers/ControlCitation.cpp index b96d01387b..2fa35bcac0 100644 --- a/src/frontends/controllers/ControlCitation.cpp +++ b/src/frontends/controllers/ControlCitation.cpp @@ -109,7 +109,7 @@ void ControlCitation::filterByEntryType( } -biblio::CiteEngine const ControlCitation::getEngine() const +biblio::CiteEngine ControlCitation::getEngine() const { return buffer().params().getEngine(); } diff --git a/src/frontends/controllers/ControlCitation.h b/src/frontends/controllers/ControlCitation.h index 94985eacc9..af236b8e62 100644 --- a/src/frontends/controllers/ControlCitation.h +++ b/src/frontends/controllers/ControlCitation.h @@ -46,7 +46,7 @@ public: void filterByEntryType( std::vector & keyVector, docstring entryType); /// - biblio::CiteEngine const getEngine() const; + biblio::CiteEngine getEngine() const; /// \return information for this key. docstring const getInfo(docstring const & key) const; diff --git a/src/frontends/controllers/ControlDocument.cpp b/src/frontends/controllers/ControlDocument.cpp index 1a75bc9317..d21f1d3aa7 100644 --- a/src/frontends/controllers/ControlDocument.cpp +++ b/src/frontends/controllers/ControlDocument.cpp @@ -35,6 +35,7 @@ #include using std::ostringstream; +using std::sort; using std::string; using std::vector; @@ -60,7 +61,7 @@ ControlDocument::~ControlDocument() {} -bool ControlDocument::initialiseParams(std::string const &) +bool ControlDocument::initialiseParams(string const &) { bp_.reset(new BufferParams); *bp_ = buffer().params(); @@ -100,7 +101,7 @@ vector const & ControlDocument::getSelectedModules() } -string ControlDocument::getModuleDescription(string modName) const +string ControlDocument::getModuleDescription(string const & modName) const { LyXModule const * const mod = moduleList[modName]; if (!mod) @@ -109,11 +110,12 @@ string ControlDocument::getModuleDescription(string modName) const } -std::vector - ControlDocument::getPackageList(std::string modName) const { +vector +ControlDocument::getPackageList(string const & modName) const +{ LyXModule const * const mod = moduleList[modName]; - if (!mod) - return std::vector(); //empty such thing + if (!mod) + return vector(); //empty such thing return mod->packageList; } @@ -177,7 +179,7 @@ void ControlDocument::setLanguage() const if (buffer().params().language == newL) return; - string const lang_name = newL->lang(); + string const & lang_name = newL->lang(); dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name)); } @@ -188,7 +190,7 @@ void ControlDocument::saveAsDefault() const } -bool const ControlDocument::isFontAvailable(std::string const & font) const +bool ControlDocument::isFontAvailable(string const & font) const { if (font == "default" || font == "cmr" || font == "cmss" || font == "cmtt") @@ -212,7 +214,7 @@ bool const ControlDocument::isFontAvailable(std::string const & font) const } -bool const ControlDocument::providesOSF(std::string const & font) const +bool ControlDocument::providesOSF(string const & font) const { if (font == "cmr") return isFontAvailable("eco"); @@ -223,7 +225,7 @@ bool const ControlDocument::providesOSF(std::string const & font) const } -bool const ControlDocument::providesSC(std::string const & font) const +bool ControlDocument::providesSC(string const & font) const { if (font == "palatino") return isFontAvailable("mathpazo"); @@ -234,7 +236,7 @@ bool const ControlDocument::providesSC(std::string const & font) const } -bool const ControlDocument::providesScale(std::string const & font) const +bool ControlDocument::providesScale(string const & font) const { return (font == "helvet" || font == "luximono" || font == "berasans" || font == "beramono"); diff --git a/src/frontends/controllers/ControlDocument.h b/src/frontends/controllers/ControlDocument.h index ca80fcb7bc..8d05f690c1 100644 --- a/src/frontends/controllers/ControlDocument.h +++ b/src/frontends/controllers/ControlDocument.h @@ -27,7 +27,7 @@ class BufferParams; class TextClass; namespace frontend { - + /// typedef void const * BufferId; /// @@ -66,21 +66,21 @@ public: /// Modules in use in current buffer std::vector const & getSelectedModules(); /// - std::string getModuleDescription(std::string modName) const; + std::string getModuleDescription(std::string const & modName) const; /// - std::vector getPackageList(std::string modName) const; + std::vector getPackageList(std::string const & modName) const; /// void setLanguage() const; /// void saveAsDefault() const; /// - bool const isFontAvailable(std::string const & font) const; + bool isFontAvailable(std::string const & font) const; /// does this font provide Old Style figures? - bool const providesOSF(std::string const & font) const; + bool providesOSF(std::string const & font) const; /// does this font provide true Small Caps? - bool const providesSC(std::string const & font) const; + bool providesSC(std::string const & font) const; /// does this font provide size adjustment? - bool const providesScale(std::string const & font) const; + bool providesScale(std::string const & font) const; private: /// void loadModuleNames(); diff --git a/src/frontends/controllers/ControlParagraph.cpp b/src/frontends/controllers/ControlParagraph.cpp index ab11234e1d..a7a022c37c 100644 --- a/src/frontends/controllers/ControlParagraph.cpp +++ b/src/frontends/controllers/ControlParagraph.cpp @@ -151,7 +151,7 @@ ParagraphParameters const & ControlParagraph::params() const } -bool const ControlParagraph::haveMulitParSelection() +bool ControlParagraph::haveMulitParSelection() { Cursor cur = bufferview()->cursor(); return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit(); diff --git a/src/frontends/controllers/ControlParagraph.h b/src/frontends/controllers/ControlParagraph.h index bb06f8750c..fae990012c 100644 --- a/src/frontends/controllers/ControlParagraph.h +++ b/src/frontends/controllers/ControlParagraph.h @@ -39,7 +39,7 @@ public: /// ParagraphParameters const & params() const; /// - bool const haveMulitParSelection(); + bool haveMulitParSelection(); /// bool inInset() const; /// diff --git a/src/frontends/controllers/ControlPrefs.cpp b/src/frontends/controllers/ControlPrefs.cpp index 4cd5f3ceb8..2c2c1cdb7c 100644 --- a/src/frontends/controllers/ControlPrefs.cpp +++ b/src/frontends/controllers/ControlPrefs.cpp @@ -155,7 +155,7 @@ docstring const ControlPrefs::browsedir(docstring const & path, // We support less paper sizes than the document dialog // Therefore this adjustment is needed. -PAPER_SIZE const ControlPrefs::toPaperSize(int i) const +PAPER_SIZE ControlPrefs::toPaperSize(int i) const { switch (i) { case 0: @@ -181,7 +181,7 @@ PAPER_SIZE const ControlPrefs::toPaperSize(int i) const } -int const ControlPrefs::fromPaperSize(PAPER_SIZE papersize) const +int ControlPrefs::fromPaperSize(PAPER_SIZE papersize) const { switch (papersize) { case PAPER_DEFAULT: diff --git a/src/frontends/controllers/ControlPrefs.h b/src/frontends/controllers/ControlPrefs.h index e2730c5cdf..220c2b90c2 100644 --- a/src/frontends/controllers/ControlPrefs.h +++ b/src/frontends/controllers/ControlPrefs.h @@ -72,9 +72,9 @@ public: void updateScreenFonts(); /// adjust the prefs paper sizes - PAPER_SIZE const toPaperSize(int i) const; + PAPER_SIZE toPaperSize(int i) const; /// adjust the prefs paper sizes - int const fromPaperSize(PAPER_SIZE papersize) const; + int fromPaperSize(PAPER_SIZE papersize) const; private: /// temporary lyxrc diff --git a/src/frontends/controllers/ControlRef.cpp b/src/frontends/controllers/ControlRef.cpp index 87e76c1a2a..0a5d9c4b4d 100644 --- a/src/frontends/controllers/ControlRef.cpp +++ b/src/frontends/controllers/ControlRef.cpp @@ -21,6 +21,7 @@ using lyx::docstring; +using std::find; using std::vector; using std::string; diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index a1741ba4a9..283f3f56f6 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -48,13 +48,15 @@ using lyx::support::token; using lyx::support::os::internal_path; +using std::find; + #ifndef CXX_GLOBAL_CSTD using std::floor; #endif using std::vector; using std::string; - +using std::transform; namespace lyx { namespace frontend { @@ -89,23 +91,23 @@ void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit, template -std::vector const -getFirst(std::vector const & pr) +vector const +getFirst(vector const & pr) { - std::vector tmp(pr.size()); - std::transform(pr.begin(), pr.end(), tmp.begin(), - boost::bind(&Pair::first, _1)); + vector tmp(pr.size()); + transform(pr.begin(), pr.end(), tmp.begin(), + boost::bind(&Pair::first, _1)); return tmp; } /// template -std::vector const -getSecond(std::vector const & pr) +vector const +getSecond(vector const & pr) { - std::vector tmp(pr.size()); - std::transform(pr.begin(), pr.end(), tmp.begin(), - boost::bind(&Pair::second, _1)); + vector tmp(pr.size()); + transform(pr.begin(), pr.end(), tmp.begin(), + boost::bind(&Pair::second, _1)); return tmp; } @@ -283,7 +285,7 @@ void GuiGraphicsDialog::on_browsePB_clicked() { docstring const str = controller().browse(qstring_to_ucs4(filename->text())); - if(!str.empty()){ + if (!str.empty()) { filename->setText(toqstr(str)); embedCB->setCheckState(Qt::Unchecked); changed(); @@ -725,4 +727,3 @@ bool GuiGraphicsDialog::isValid() #include "GuiGraphics_moc.cpp" - diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index d0d0e8d071..1b645311e5 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -77,9 +77,10 @@ Image::FormatList GuiImage::loadableFormats() LYXERR(Debug::GRAPHICS) << "\nThe image loader can load the following directly:\n"; - if (qt_formats.empty()) + if (qt_formats.empty()) { LYXERR(Debug::GRAPHICS) << "\nQt4 Problem: No Format available!" << endl; + } for (QList::const_iterator it =qt_formats.begin(); it != qt_formats.end(); ++it) { @@ -107,8 +108,9 @@ Image::FormatList GuiImage::loadableFormats() FormatList::const_iterator fbegin = fmts.begin(); FormatList::const_iterator fend = fmts.end(); for (FormatList::const_iterator fit = fbegin; fit != fend; ++fit) { - if (fit != fbegin) + if (fit != fbegin) { LYXERR(Debug::GRAPHICS) << ", "; + } LYXERR(Debug::GRAPHICS) << *fit; } LYXERR(Debug::GRAPHICS) << '\n' << endl; diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index cf68a115a9..24bcf72878 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -15,6 +15,8 @@ #include "debug.h" +#include + #include #include diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp index 2210a1bc72..1e58f6774e 100644 --- a/src/insets/ExternalSupport.cpp +++ b/src/insets/ExternalSupport.cpp @@ -327,11 +327,12 @@ void updateExternal(InsetExternalParams const & params, params.filename, from_format, to_format, el, Converters::try_default | Converters::try_cache); - if (!success) + if (!success) { LYXERR(Debug::EXTERNAL) << "external::updateExternal. " << "Unable to convert from " << from_format << " to " << to_format << endl; + } // return success } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index bec8c17c80..45edd5be3c 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -667,13 +667,14 @@ int InsetCollapsable::latex(Buffer const & buf, odocstream & os, } } int i = InsetText::latex(buf, os, runparams); - if (!layout_.latexname.empty()) + if (!layout_.latexname.empty()) { if (layout_.latextype == "command") { os << "}"; } else if (layout_.latextype == "environment") { os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n"; i += 4; } + } return i; } diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 1a8ec8713c..136c461aac 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -52,7 +52,7 @@ namespace lyx { - + // Implementation is in LyX.cpp extern void dispatch(FuncRequest const & action); @@ -80,6 +80,7 @@ using support::subst; using support::sum; using std::endl; +using std::find; using std::string; using std::istringstream; using std::ostream; @@ -461,7 +462,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, incfile = mangled; else if (!isValidLaTeXFilename(incfile)) { frontend::Alert::warning(_("Invalid filename"), - _("The following filename is likely to cause trouble " + _("The following filename is likely to cause trouble " "when running the exported file through LaTeX: ") + from_utf8(incfile)); } @@ -492,7 +493,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, Alert::warning(_("Different textclasses"), text); //return 0; } - + // Make sure modules used in child are all included in master //FIXME It might be worth loading the children's modules into the master //over in BufferParams rather than doing this check. @@ -502,13 +503,13 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, vector::const_iterator end = childModules.end(); for (; it != end; ++it) { string const module = *it; - vector::const_iterator found = + vector::const_iterator found = find(masterModules.begin(), masterModules.end(), module); if (found != masterModules.end()) { docstring text = bformat(_("Included file `%1$s'\n" "uses module `%2$s'\n" "which is not used in parent file."), - makeDisplayPath(included_file.absFilename()), from_utf8(module)); + makeDisplayPath(included_file.absFilename()), from_utf8(module)); Alert::warning(_("Module not found"), text); } } @@ -916,7 +917,7 @@ void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer, ParConstIt Toc & toc = toclist["listing"]; docstring const str = convert(toc.size() + 1) + ". " + from_utf8(caption); - // This inset does not have a valid ParConstIterator + // This inset does not have a valid ParConstIterator // so it has to use the iterator of its parent paragraph toc.push_back(TocItem(pit, 0, str)); } @@ -935,7 +936,7 @@ void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer, ParConstIt } -void InsetInclude::updateLabels(Buffer const & buffer, +void InsetInclude::updateLabels(Buffer const & buffer, ParIterator const &) { Buffer const * const childbuffer = getChildBuffer(buffer, params_); diff --git a/src/insets/InsetListingsParams.cpp b/src/insets/InsetListingsParams.cpp index 984bab1a60..d9e05e6b20 100644 --- a/src/insets/InsetListingsParams.cpp +++ b/src/insets/InsetListingsParams.cpp @@ -759,7 +759,7 @@ void InsetListingsParams::addParam(string const & key, string const & value) if (params_.find(key) != params_.end()) // key=value,key=value1 is allowed in listings // use key_, key__, key___ etc to avoid name conflict - while (params_.find(keyname += '_') != params_.end()); + while (params_.find(keyname += '_') != params_.end()) { } // check onoff flag // onoff parameter with value false if (!par_validator) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index ff89ddd931..47c50de74f 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -875,7 +875,7 @@ bool Tabular::leftAlreadyDrawn(idx_type cell) const row_type row = cellRow(cell); while (--column && (cell_info[row][column].multicolumn == - Tabular::CELL_PART_OF_MULTICOLUMN)); + Tabular::CELL_PART_OF_MULTICOLUMN)) { } if (getAdditionalWidth(cell_info[row][column].cellno)) return false; return rightLine(cell_info[row][column].cellno); diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 0454cc388e..d9dd7c52a4 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -1402,12 +1402,12 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd, from_utf8(N_("Unknown tabular feature '%1$s'")), lyx::from_ascii(s))); } - status.setOnOff(s == "align-left" && halign(cur.col()) == 'l' - || s == "align-right" && halign(cur.col()) == 'r' - || s == "align-center" && halign(cur.col()) == 'c' - || s == "valign-top" && valign() == 't' - || s == "valign-bottom" && valign() == 'b' - || s == "valign-middle" && valign() == 'm'); + status.setOnOff((s == "align-left" && halign(cur.col()) == 'l') + || (s == "align-right" && halign(cur.col()) == 'r') + || (s == "align-center" && halign(cur.col()) == 'c') + || (s == "valign-top" && valign() == 't') + || (s == "valign-bottom" && valign() == 'b') + || (s == "valign-middle" && valign() == 'm')); #if 0 // FIXME: What did this code do? diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 6f9a040f25..8933d78f91 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -207,8 +207,9 @@ TeXEnvironment(Buffer const & buf, texrow.newline(); } - if (par != paragraphs.end()) + if (par != paragraphs.end()) { LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl; + } return par; } @@ -585,8 +586,9 @@ TeXOnePar(Buffer const & buf, texrow.newline(); } - if (boost::next(pit) != paragraphs.end()) + if (boost::next(pit) != paragraphs.end()) { LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl; + } return ++pit; } diff --git a/src/support/lstrings.h b/src/support/lstrings.h index d7a6a799e6..ef4670e575 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -18,6 +18,7 @@ #include "support/docstring.h" +#include #include diff --git a/src/support/qstring_helpers.h b/src/support/qstring_helpers.h index 86b2e037fe..c47c95630a 100644 --- a/src/support/qstring_helpers.h +++ b/src/support/qstring_helpers.h @@ -60,7 +60,7 @@ inline bool is_utf16(char_type c) * This does only exist because of performance reasons (a real conversion * using iconv is too slow on windows). */ -inline char_type const qchar_to_ucs4(QChar const & qchar) +inline char_type qchar_to_ucs4(QChar const & qchar) { BOOST_ASSERT(is_utf16(static_cast(qchar.unicode()))); return static_cast(qchar.unicode()); diff --git a/src/support/rename.cpp b/src/support/rename.cpp index 45b1b45e86..ec6fca5389 100644 --- a/src/support/rename.cpp +++ b/src/support/rename.cpp @@ -25,12 +25,13 @@ using std::string; bool rename(FileName const & from, FileName const & to) { - if (::rename(from.toFilesystemEncoding().c_str(), to.toFilesystemEncoding().c_str()) == -1) + if (::rename(from.toFilesystemEncoding().c_str(), to.toFilesystemEncoding().c_str()) == -1) { if (copy(from, to)) { unlink(from); return true; } else return false; + } return true; } diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index bb47315d43..b39c8c123f 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -37,6 +37,7 @@ using std::string; using std::vector; using std::cerr; using std::endl; +using std::find; using support::FileName; using support::libFileSearch; @@ -99,7 +100,7 @@ void handle_opt(vector & opts, char const * const * what, string & targe if (opts.empty()) return; - for ( ; *what; ++what) { + for (; *what; ++what) { vector::iterator it = find(opts.begin(), opts.end(), *what); if (it != opts.end()) { //cerr << "### found option '" << *what << "'\n"; -- 2.39.2