mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix a bunch of warnings
This commit is contained in:
parent
99bf96c56b
commit
33d663720b
@ -45,14 +45,14 @@ namespace lyx {
|
|||||||
|
|
||||||
|
|
||||||
DocIterator::DocIterator()
|
DocIterator::DocIterator()
|
||||||
: boundary_(false), inset_(0), buffer_(0)
|
: boundary_(false), inset_(nullptr), buffer_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// We could be able to get rid of this if only every BufferView were
|
// We could be able to get rid of this if only every BufferView were
|
||||||
// associated to a buffer on construction.
|
// associated to a buffer on construction.
|
||||||
DocIterator::DocIterator(Buffer * buf)
|
DocIterator::DocIterator(Buffer * buf)
|
||||||
: boundary_(false), inset_(0), buffer_(buf)
|
: boundary_(false), inset_(nullptr), buffer_(buf)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -115,13 +115,13 @@ LyXErr & operator<<(LyXErr & os, DocIterator const & it)
|
|||||||
|
|
||||||
Inset * DocIterator::nextInset() const
|
Inset * DocIterator::nextInset() const
|
||||||
{
|
{
|
||||||
LASSERT(!empty(), return 0);
|
LASSERT(!empty(), return nullptr);
|
||||||
if (pos() == lastpos())
|
if (pos() == lastpos())
|
||||||
return 0;
|
return nullptr;
|
||||||
if (pos() > lastpos()) {
|
if (pos() > lastpos()) {
|
||||||
LYXERR0("Should not happen, but it does: pos() = "
|
LYXERR0("Should not happen, but it does: pos() = "
|
||||||
<< pos() << ", lastpos() = " << lastpos());
|
<< pos() << ", lastpos() = " << lastpos());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (inMathed())
|
if (inMathed())
|
||||||
return nextAtom().nucleus();
|
return nextAtom().nucleus();
|
||||||
@ -131,15 +131,15 @@ Inset * DocIterator::nextInset() const
|
|||||||
|
|
||||||
Inset * DocIterator::prevInset() const
|
Inset * DocIterator::prevInset() const
|
||||||
{
|
{
|
||||||
LASSERT(!empty(), return 0);
|
LASSERT(!empty(), return nullptr);
|
||||||
if (pos() == 0)
|
if (pos() == 0)
|
||||||
return 0;
|
return nullptr;
|
||||||
if (inMathed()) {
|
if (inMathed()) {
|
||||||
if (cell().empty())
|
if (cell().empty())
|
||||||
// FIXME: this should not happen but it does.
|
// FIXME: this should not happen but it does.
|
||||||
// See bug 3189
|
// See bug 3189
|
||||||
// http://www.lyx.org/trac/ticket/3189
|
// http://www.lyx.org/trac/ticket/3189
|
||||||
return 0;
|
return nullptr;
|
||||||
else
|
else
|
||||||
return prevAtom().nucleus();
|
return prevAtom().nucleus();
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ Inset * DocIterator::prevInset() const
|
|||||||
|
|
||||||
Inset * DocIterator::realInset() const
|
Inset * DocIterator::realInset() const
|
||||||
{
|
{
|
||||||
LASSERT(inTexted(), return 0);
|
LASSERT(inTexted(), return nullptr);
|
||||||
// if we are in a tabular, we need the cell
|
// if we are in a tabular, we need the cell
|
||||||
if (inset().lyxCode() == TABULAR_CODE) {
|
if (inset().lyxCode() == TABULAR_CODE) {
|
||||||
InsetTabular * tabular = inset().asInsetTabular();
|
InsetTabular * tabular = inset().asInsetTabular();
|
||||||
@ -190,7 +190,7 @@ MathAtom & DocIterator::nextAtom() const
|
|||||||
|
|
||||||
Text * DocIterator::text() const
|
Text * DocIterator::text() const
|
||||||
{
|
{
|
||||||
LASSERT(!empty(), return 0);
|
LASSERT(!empty(), return nullptr);
|
||||||
return top().text();
|
return top().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ MathData & DocIterator::cell() const
|
|||||||
|
|
||||||
Text * DocIterator::innerText() const
|
Text * DocIterator::innerText() const
|
||||||
{
|
{
|
||||||
LASSERT(!empty(), return 0);
|
LASSERT(!empty(), return nullptr);
|
||||||
return innerTextSlice().text();
|
return innerTextSlice().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ Inset * DocIterator::innerInsetOfType(int code) const
|
|||||||
for (int i = depth() - 1; i >= 0; --i)
|
for (int i = depth() - 1; i >= 0; --i)
|
||||||
if (slices_[i].inset_->lyxCode() == code)
|
if (slices_[i].inset_->lyxCode() == code)
|
||||||
return slices_[i].inset_;
|
return slices_[i].inset_;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ void DocIterator::forwardPos()
|
|||||||
// not at cell/paragraph end?
|
// not at cell/paragraph end?
|
||||||
if (tip.pos() != tip.lastpos()) {
|
if (tip.pos() != tip.lastpos()) {
|
||||||
// move into an inset to the right if possible
|
// move into an inset to the right if possible
|
||||||
Inset * n = 0;
|
Inset * n = nullptr;
|
||||||
if (inMathed())
|
if (inMathed())
|
||||||
n = (tip.cell().begin() + tip.pos())->nucleus();
|
n = (tip.cell().begin() + tip.pos())->nucleus();
|
||||||
else
|
else
|
||||||
@ -486,7 +486,7 @@ void DocIterator::backwardPos()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// move into an inset to the left if possible
|
// move into an inset to the left if possible
|
||||||
Inset * n = 0;
|
Inset * n = nullptr;
|
||||||
if (inMathed())
|
if (inMathed())
|
||||||
n = (top().cell().begin() + top().pos())->nucleus();
|
n = (top().cell().begin() + top().pos())->nucleus();
|
||||||
else
|
else
|
||||||
@ -631,7 +631,7 @@ void DocIterator::sanitize()
|
|||||||
Inset * inset = inset_;
|
Inset * inset = inset_;
|
||||||
// re-add the slices one by one, and adjust the inset pointer.
|
// re-add the slices one by one, and adjust the inset pointer.
|
||||||
for (size_t i = 0, n = sl.size(); i != n; ++i) {
|
for (size_t i = 0, n = sl.size(); i != n; ++i) {
|
||||||
if (inset == 0) {
|
if (inset == nullptr) {
|
||||||
// FIXME
|
// FIXME
|
||||||
LYXERR0(" Should not happen, but does e.g. after "
|
LYXERR0(" Should not happen, but does e.g. after "
|
||||||
"C-n C-l C-z S-C-z\n"
|
"C-n C-l C-z S-C-z\n"
|
||||||
@ -732,7 +732,7 @@ docstring DocIterator::getPossibleLabel() const
|
|||||||
Encoding const * DocIterator::getEncoding() const
|
Encoding const * DocIterator::getEncoding() const
|
||||||
{
|
{
|
||||||
if (empty())
|
if (empty())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
BufferParams const & bp = buffer()->params();
|
BufferParams const & bp = buffer()->params();
|
||||||
if (bp.useNonTeXFonts)
|
if (bp.useNonTeXFonts)
|
||||||
@ -804,7 +804,7 @@ StableDocIterator::StableDocIterator(DocIterator const & dit) :
|
|||||||
data_(dit.internalData())
|
data_(dit.internalData())
|
||||||
{
|
{
|
||||||
for (size_t i = 0, n = data_.size(); i != n; ++i)
|
for (size_t i = 0, n = data_.size(); i != n; ++i)
|
||||||
data_[i].inset_ = 0;
|
data_[i].inset_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ vector<char_type> Encoding::symbolsList() const
|
|||||||
// add all encodable characters
|
// add all encodable characters
|
||||||
copy(encodable_.begin(), encodable_.end(), back_inserter(symbols));
|
copy(encodable_.begin(), encodable_.end(), back_inserter(symbols));
|
||||||
// now the ones from the unicodesymbols file that are not already there
|
// now the ones from the unicodesymbols file that are not already there
|
||||||
for (pair<char_type, CharInfo> const & elem : unicodesymbols) {
|
for (auto const & elem : unicodesymbols) {
|
||||||
if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
|
if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
|
||||||
symbols.push_back(elem.first);
|
symbols.push_back(elem.first);
|
||||||
}
|
}
|
||||||
@ -636,9 +636,9 @@ Encodings::fromLyXName(string const & name, bool allowUnsafe) const
|
|||||||
{
|
{
|
||||||
EncodingList::const_iterator const it = encodinglist.find(name);
|
EncodingList::const_iterator const it = encodinglist.find(name);
|
||||||
if (it == encodinglist.end())
|
if (it == encodinglist.end())
|
||||||
return 0;
|
return nullptr;
|
||||||
if (!allowUnsafe && it->second.unsafe())
|
if (!allowUnsafe && it->second.unsafe())
|
||||||
return 0;
|
return nullptr;
|
||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ Encodings::fromLaTeXName(string const & n, int const & p, bool allowUnsafe) cons
|
|||||||
if ((it->second.latexName() == name) && (it->second.package() & p)
|
if ((it->second.latexName() == name) && (it->second.package() & p)
|
||||||
&& (!it->second.unsafe() || allowUnsafe))
|
&& (!it->second.unsafe() || allowUnsafe))
|
||||||
return &it->second;
|
return &it->second;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ Encodings::fromIconvName(string const & n, int const & p, bool allowUnsafe) cons
|
|||||||
if ((it->second.iconvName() == n) && (it->second.package() & p)
|
if ((it->second.iconvName() == n) && (it->second.package() & p)
|
||||||
&& (!it->second.unsafe() || allowUnsafe))
|
&& (!it->second.unsafe() || allowUnsafe))
|
||||||
return &it->second;
|
return &it->second;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
string const arg2 = cmd.getArg(1);
|
string const arg2 = cmd.getArg(1);
|
||||||
if (arg1 != "deco") {
|
if (arg1 != "deco") {
|
||||||
LYXERR0("LFUN_IPAMACRO_INSERT: wrong argument");
|
LYXERR0("LFUN_IPAMACRO_INSERT: wrong argument");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return new InsetIPADeco(buf, arg2);
|
return new InsetIPADeco(buf, arg2);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
string arg = cmd.getArg(0);
|
string arg = cmd.getArg(0);
|
||||||
if (arg.empty()) {
|
if (arg.empty()) {
|
||||||
LYXERR0("argument-insert needs an argument!");
|
LYXERR0("argument-insert needs an argument!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return new InsetArgument(buf, arg);
|
return new InsetArgument(buf, arg);
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
if (argument == "figure" || argument == "table")
|
if (argument == "figure" || argument == "table")
|
||||||
return new InsetWrap(buf, argument);
|
return new InsetWrap(buf, argument);
|
||||||
lyxerr << "Non-existent wrapfig type: " << argument << endl;
|
lyxerr << "Non-existent wrapfig type: " << argument << endl;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INDEX_INSERT: {
|
case LFUN_INDEX_INSERT: {
|
||||||
@ -231,7 +231,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_TABULAR_INSERT: {
|
case LFUN_TABULAR_INSERT: {
|
||||||
if (cmd.argument().empty())
|
if (cmd.argument().empty())
|
||||||
return 0;
|
return nullptr;
|
||||||
istringstream ss(to_utf8(cmd.argument()));
|
istringstream ss(to_utf8(cmd.argument()));
|
||||||
int r = 0, c = 0;
|
int r = 0, c = 0;
|
||||||
ss >> r >> c;
|
ss >> r >> c;
|
||||||
@ -281,7 +281,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case NO_CODE:
|
case NO_CODE:
|
||||||
lyxerr << "No such inset '" << name << "'.";
|
lyxerr << "No such inset '" << name << "'.";
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
case BIBITEM_CODE: {
|
case BIBITEM_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
@ -406,7 +406,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
default:
|
default:
|
||||||
lyxerr << "Inset '" << name << "' not permitted with LFUN_INSET_INSERT."
|
lyxerr << "Inset '" << name << "' not permitted with LFUN_INSET_INSERT."
|
||||||
<< endl;
|
<< endl;
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
} //end LFUN_INSET_INSERT
|
} //end LFUN_INSET_INSERT
|
||||||
@ -478,7 +478,6 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
return new InsetSpace(isp);
|
return new InsetSpace(isp);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -491,11 +490,11 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
lyx_exit(1);
|
lyx_exit(1);
|
||||||
} else if (message.type_ == WarningException) {
|
} else if (message.type_ == WarningException) {
|
||||||
Alert::warning(message.title_, message.details_);
|
Alert::warning(message.title_, message.details_);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -575,7 +574,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
|||||||
break;
|
break;
|
||||||
case REF_CODE:
|
case REF_CODE:
|
||||||
if (inscmd["name"].empty() && inscmd["reference"].empty())
|
if (inscmd["name"].empty() && inscmd["reference"].empty())
|
||||||
return 0;
|
return nullptr;
|
||||||
inset.reset(new InsetRef(buf, inscmd));
|
inset.reset(new InsetRef(buf, inscmd));
|
||||||
break;
|
break;
|
||||||
case TOC_CODE:
|
case TOC_CODE:
|
||||||
@ -587,7 +586,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
|||||||
<< "'" << endl;
|
<< "'" << endl;
|
||||||
while (lex.isOK() && lex.getString() != "\\end_inset")
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
||||||
lex.next();
|
lex.next();
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
inset->setBuffer(*buf);
|
inset->setBuffer(*buf);
|
||||||
} else {
|
} else {
|
||||||
@ -675,7 +674,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
|||||||
<< "'" << endl;
|
<< "'" << endl;
|
||||||
while (lex.isOK() && lex.getString() != "\\end_inset")
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
||||||
lex.next();
|
lex.next();
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the buffer reference for proper parsing of some insets
|
// Set the buffer reference for proper parsing of some insets
|
||||||
|
Loading…
Reference in New Issue
Block a user