From 77cc2c7c8c83481cabf5e0af2f83e41a22b19dc0 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Fri, 9 Oct 2015 08:08:49 +0200 Subject: [PATCH] Fix "dead store" warnings of Xcode analyze tool --- src/AspellChecker.cpp | 2 +- src/TextClass.cpp | 9 ++------- src/frontends/qt4/GuiCitation.cpp | 3 --- src/frontends/qt4/GuiPrefs.cpp | 4 +--- src/insets/InsetCollapsable.cpp | 1 - src/insets/InsetExternal.cpp | 4 +--- src/insets/InsetTabular.cpp | 1 - src/lyxfind.cpp | 5 +---- 8 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/AspellChecker.cpp b/src/AspellChecker.cpp index 06da1f8149..c4b2419994 100644 --- a/src/AspellChecker.cpp +++ b/src/AspellChecker.cpp @@ -219,7 +219,7 @@ AspellConfig * AspellChecker::Private::getConfig(string const & lang, string con } if (!have_dict) { // check for package data of OS installation - have_dict = checkAspellData(config, osPackageBase(), osPackageDataDirectory(), osPackageDictDirectory(), lang, variety); + checkAspellData(config, osPackageBase(), osPackageDataDirectory(), osPackageDictDirectory(), lang, variety); } return config ; } diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 60fab48e6c..17fc266ebd 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -413,8 +413,8 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) } // used below to track whether we are in an IfStyle or IfCounter tag. - bool ifstyle = false; - bool ifcounter = false; + bool ifstyle = false; + bool ifcounter = false; switch (static_cast(le)) { @@ -508,9 +508,6 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) Layout lay; readStyle(lexrc, lay); } - - // reset flag - ifstyle = false; break; } @@ -764,8 +761,6 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) lexrc.printError("No name given for style: `$$Token'."); error = true; } - // reset flag - ifcounter = false; break; case TC_TITLELATEXTYPE: diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 483c8fb5b1..052d700b2b 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -260,9 +260,6 @@ void GuiCitation::updateStyles(BiblioInfo const & bi) return; } - if (!selectedLV->selectionModel()->selectedIndexes().empty()) - curr = selectedLV->selectionModel()->selectedIndexes()[0].row(); - static const size_t max_length = 80; QStringList sty = citationStyles(bi, max_length); diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 72e5328a6d..f7c00f45bf 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2863,7 +2863,6 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, QString const lfun_name = toqstr(from_utf8(action_name) + ' ' + lfun.argument()); QString const shortcut = toqstr(seq.print(KeySequence::ForGui)); - KeyMap::ItemType item_tag = tag; QTreeWidgetItem * newItem = 0; // for unbind items, try to find an existing item in the system bind list @@ -2880,7 +2879,6 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, // Such an item is not displayed to avoid confusion (what is // unmatched removed?). if (!newItem) { - item_tag = KeyMap::UserExtraUnbind; return 0; } } @@ -2913,7 +2911,7 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, newItem->setText(1, shortcut); // record BindFile representation to recover KeySequence when needed. newItem->setData(1, Qt::UserRole, toqstr(seq.print(KeySequence::BindFile))); - setItemType(newItem, item_tag); + setItemType(newItem, tag); return newItem; } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 337845a607..aeac8b3586 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -348,7 +348,6 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const int const ww = max(textdim.wid, w); pi.pain.rectText(x + (ww - w) / 2, y + desc + a, buttonLabel(bv), font, Color_none, Color_none); - desc += d; } // a visual cue when the cursor is inside the inset diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index daa5831107..a62100e9b0 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -616,10 +616,8 @@ void InsetExternal::setParams(InsetExternalParams const & p) LASSERT(false, return); break; case PREVIEW_INSTANT: { - //FIXME: why is the value below immediately forgotten? - RenderMonitoredPreview * preview_ptr = renderer_->asMonitoredPreview(); renderer_.reset(new RenderMonitoredPreview(this)); - preview_ptr = renderer_->asMonitoredPreview(); + RenderMonitoredPreview * preview_ptr = preview_ptr = renderer_->asMonitoredPreview(); preview_ptr->fileChanged(bind(&InsetExternal::fileChanged, this)); if (preview_ptr->monitoring()) preview_ptr->stopMonitoring(); diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 6a138cc18d..d92acf2e0f 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -6231,7 +6231,6 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf, if (usePaste) { paste_tabular.reset(new Tabular(buffer_, rows, maxCols)); loctab = paste_tabular.get(); - cols = 0; dirtyTabularStack(true); } else { loctab = &tabular; diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index aedbc53bff..0a788c7ba8 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -592,7 +592,6 @@ string escape_for_regex(string s, bool match_latex) } if (end_pos == s.size()) { s.replace(new_pos, end_pos - new_pos, t); - pos = s.size(); LYXERR(Debug::FIND, "Regexp after \\regexp{} removal: " << s); break; } @@ -1224,12 +1223,10 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match) return 0; cur.backwardPos(); DocIterator cur_orig(cur); - bool found_match; bool pit_changed = false; - found_match = false; do { cur.pos() = 0; - found_match = match(cur, -1, false); + bool found_match = match(cur, -1, false); if (found_match) { if (pit_changed)