]> git.lyx.org Git - features.git/commitdiff
Fix warnings reported by clang
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 27 Nov 2014 17:51:26 +0000 (18:51 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 27 Nov 2014 18:10:43 +0000 (19:10 +0100)
All these problems have the same root: the address of a reference can never be 0, and it does not make sense to test it.

src/Text3.cpp
src/frontends/qt4/GuiApplication.cpp
src/insets/InsetArgument.cpp
src/insets/InsetCaption.cpp

index 20885ddc664f6f65c37bc677118d5bea1faf6c92..2092ac6ac0fb19c52a0278f209a0f818ee047fba 100644 (file)
@@ -2629,11 +2629,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_CAPTION_INSERT: {
                code = CAPTION_CODE;
                string arg = cmd.getArg(0);
-               bool varia = arg != "LongTableNoNumber";
-               if (cur.depth() > 0) {
-                       if (&cur[cur.depth() - 1].inset())
-                               varia = cur[cur.depth() - 1].inset().allowsCaptionVariation(arg);
-               }
+               bool varia = arg != "LongTableNoNumber"
+                       && cur.inset().allowsCaptionVariation(arg);
                // not allowed in description items,
                // and in specific insets
                enable = !inDescriptionItem(cur)
index 9229f155ef368ac051f0aa51136aae5259aab5d6..0fbba746e4e7949eae9c35c8d2fc1647a1dde020 100644 (file)
@@ -1809,7 +1809,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                Buffer * const last = theBufferList().last();
                foreach (GuiView * view, allViews) {
                        // all of the buffers might be locally hidden. That is, there is no active buffer.
-                       if (!view || !view->currentBufferView() || !&view->currentBufferView()->buffer())
+                       if (!view || !view->currentBufferView())
                                activeBuffers[view] = 0;
                        else
                                activeBuffers[view] = &view->currentBufferView()->buffer();
index 2e4285e7fef5ca48f341717e3080ed0f3420fdf1..804be7adc623ea81b298f6192e2ff4c55f4125dd 100644 (file)
@@ -59,7 +59,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        Layout::LaTeXArgMap args = it.paragraph().layout().args();
        pass_thru_ = it.paragraph().layout().pass_thru;
-       bool const insetlayout = &it.inset() && args.empty();
+       bool const insetlayout = args.empty();
        if (insetlayout) {
                args = it.inset().getLayout().args();
                pass_thru_ = it.inset().getLayout().isPassThru();
@@ -190,7 +190,7 @@ bool InsetArgument::getStatus(Cursor & cur, FuncRequest const & cmd,
                                return true;
                        }
                        Layout::LaTeXArgMap args;
-                       bool const insetlayout = &cur.inset() && cur.paragraph().layout().latexargs().empty();
+                       bool const insetlayout = cur.paragraph().layout().latexargs().empty();
                        if (insetlayout)
                                args = cur.inset().getLayout().latexargs();
                        else
index 14baf86c5f34a4ea43d8d727669462c1e9c3eb23..65cddc2971a328a21aaa6652118d188558449646 100644 (file)
@@ -227,8 +227,7 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
                        bool varia = type != "LongTableNoNumber";
                        // check if the immediate parent inset allows caption variation
                        if (cur.depth() > 1) {
-                               if (&cur[cur.depth() - 2].inset())
-                                       varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type);
+                               varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type);
                        }
                        status.setEnabled(varia
                                          && buffer().params().documentClass().hasInsetLayout(