mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix warnings reported by clang
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.
This commit is contained in:
parent
6442b3a0c0
commit
38f8858671
@ -2629,11 +2629,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_CAPTION_INSERT: {
|
case LFUN_CAPTION_INSERT: {
|
||||||
code = CAPTION_CODE;
|
code = CAPTION_CODE;
|
||||||
string arg = cmd.getArg(0);
|
string arg = cmd.getArg(0);
|
||||||
bool varia = arg != "LongTableNoNumber";
|
bool varia = arg != "LongTableNoNumber"
|
||||||
if (cur.depth() > 0) {
|
&& cur.inset().allowsCaptionVariation(arg);
|
||||||
if (&cur[cur.depth() - 1].inset())
|
|
||||||
varia = cur[cur.depth() - 1].inset().allowsCaptionVariation(arg);
|
|
||||||
}
|
|
||||||
// not allowed in description items,
|
// not allowed in description items,
|
||||||
// and in specific insets
|
// and in specific insets
|
||||||
enable = !inDescriptionItem(cur)
|
enable = !inDescriptionItem(cur)
|
||||||
|
@ -1809,7 +1809,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
Buffer * const last = theBufferList().last();
|
Buffer * const last = theBufferList().last();
|
||||||
foreach (GuiView * view, allViews) {
|
foreach (GuiView * view, allViews) {
|
||||||
// all of the buffers might be locally hidden. That is, there is no active buffer.
|
// 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;
|
activeBuffers[view] = 0;
|
||||||
else
|
else
|
||||||
activeBuffers[view] = &view->currentBufferView()->buffer();
|
activeBuffers[view] = &view->currentBufferView()->buffer();
|
||||||
|
@ -59,7 +59,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
|
|||||||
{
|
{
|
||||||
Layout::LaTeXArgMap args = it.paragraph().layout().args();
|
Layout::LaTeXArgMap args = it.paragraph().layout().args();
|
||||||
pass_thru_ = it.paragraph().layout().pass_thru;
|
pass_thru_ = it.paragraph().layout().pass_thru;
|
||||||
bool const insetlayout = &it.inset() && args.empty();
|
bool const insetlayout = args.empty();
|
||||||
if (insetlayout) {
|
if (insetlayout) {
|
||||||
args = it.inset().getLayout().args();
|
args = it.inset().getLayout().args();
|
||||||
pass_thru_ = it.inset().getLayout().isPassThru();
|
pass_thru_ = it.inset().getLayout().isPassThru();
|
||||||
@ -190,7 +190,7 @@ bool InsetArgument::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Layout::LaTeXArgMap args;
|
Layout::LaTeXArgMap args;
|
||||||
bool const insetlayout = &cur.inset() && cur.paragraph().layout().latexargs().empty();
|
bool const insetlayout = cur.paragraph().layout().latexargs().empty();
|
||||||
if (insetlayout)
|
if (insetlayout)
|
||||||
args = cur.inset().getLayout().latexargs();
|
args = cur.inset().getLayout().latexargs();
|
||||||
else
|
else
|
||||||
|
@ -227,8 +227,7 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
bool varia = type != "LongTableNoNumber";
|
bool varia = type != "LongTableNoNumber";
|
||||||
// check if the immediate parent inset allows caption variation
|
// check if the immediate parent inset allows caption variation
|
||||||
if (cur.depth() > 1) {
|
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
|
status.setEnabled(varia
|
||||||
&& buffer().params().documentClass().hasInsetLayout(
|
&& buffer().params().documentClass().hasInsetLayout(
|
||||||
|
Loading…
Reference in New Issue
Block a user