Fix some warnings.

This commit is contained in:
Richard Kimberly Heck 2020-05-03 02:32:39 -04:00
parent 99948beff8
commit 3b2bcef455
14 changed files with 56 additions and 58 deletions

View File

@ -303,7 +303,7 @@ ColorSet::ColorSet()
{ Color_inherit, N_("inherit"), "inherit", "black", "inherit" },
{ Color_regexpframe, N_("regexp frame"), "regexpframe", "green", "regexpframe" },
{ Color_ignore, N_("ignore"), "ignore", "black", "ignore" },
{ Color_ignore, 0, 0, 0, 0 }
{ Color_ignore, nullptr, nullptr, nullptr, nullptr }
};
for (int i = 0; items[i].guiname; ++i)

View File

@ -90,7 +90,7 @@ enchant::Dict * EnchantChecker::Private::addSpeller(string const & lang)
const char * what = e.what();
LYXERR(Debug::FILES, "cannot add enchant speller: " <<
((what && *what) ? what : "unspecified enchant exception in request_dict()"));
m.speller = 0;
m.speller = nullptr;
}
spellers_[lang] = m;
return m.speller;

View File

@ -67,7 +67,7 @@ EncodingException::EncodingException(char_type c)
}
const char * EncodingException::what() const throw()
const char * EncodingException::what() const noexcept
{
return "Could not find LaTeX command for a character";
}

View File

@ -28,8 +28,8 @@ namespace support { class FileName; }
class EncodingException : public std::exception {
public:
EncodingException(char_type c);
virtual ~EncodingException() throw() {}
virtual const char * what() const throw();
virtual ~EncodingException() noexcept {}
virtual const char * what() const noexcept;
char_type failed_char;
int par_id;
@ -130,7 +130,7 @@ public:
/// Represent any of the above packages
static int const any;
///
Encoding() : fixedwidth_(true), unsafe_(false), forced_(0),
Encoding() : fixedwidth_(true), unsafe_(false), forced_(nullptr),
start_encodable_(0), package_(none), complete_(false) {}
///
Encoding(std::string const & n, std::string const & l,
@ -333,7 +333,7 @@ public:
*/
static char_type fromLaTeXCommand(docstring const & cmd, int cmdtype,
bool & combining, bool & needsTermination,
std::set<std::string> * req = 0);
std::set<std::string> * req = nullptr);
///
enum LatexCmd {
///
@ -353,7 +353,7 @@ public:
*/
static docstring fromLaTeXCommand(docstring const & cmd, int cmdtype,
bool & needsTermination, docstring & rem,
std::set<std::string> * req = 0);
std::set<std::string> * req = nullptr);
protected:
///

View File

@ -1,10 +1,10 @@
// -*- C++ -*-
/**
* \file ModuleList.cpp
* \file LayoutModuleList.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Richard Heck
* \author Richard Kimberly Heck
*
* Full author contact details are available in file CREDITS.
*/

View File

@ -102,10 +102,10 @@ public:
int lineno;
///
string pushTok;
///
char commentChar;
/// used for error messages
string context;
///
char commentChar;
private:
/// non-copyable
Pimpl(Pimpl const &);
@ -118,7 +118,7 @@ private:
public:
///
PushedTable()
: table_elem(0), table_siz(0) {}
: table_elem(nullptr), table_siz(0) {}
///
PushedTable(LexerKeyword * ki, int siz)
: table_elem(ki), table_siz(siz) {}
@ -567,7 +567,7 @@ void Lexer::Pimpl::pushToken(string const & pt)
//////////////////////////////////////////////////////////////////////
Lexer::Lexer()
: pimpl_(new Pimpl(0, 0)), lastReadOk_(false)
: pimpl_(new Pimpl(nullptr, 0)), lastReadOk_(false)
{}
@ -808,7 +808,7 @@ Lexer::operator void const *() const
// use fail() here. However, our implementation of getString() et al.
// can cause the eof() and fail() bits to be set, even though we
// haven't tried to read 'em.
return lastReadOk_? this : 0;
return lastReadOk_? this : nullptr;
}

View File

@ -37,7 +37,7 @@ namespace Alert = frontend::Alert;
LyXVC::LyXVC()
{
owner_ = 0;
owner_ = nullptr;
}
@ -91,7 +91,7 @@ bool LyXVC::file_found_hook(FileName const & fn)
}
// file is not under any VCS.
vcs.reset(0);
vcs.reset(nullptr);
return false;
}
@ -186,7 +186,7 @@ bool LyXVC::registrer()
_("(no initial description)"));
if (!ok) {
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
vcs.reset(0);
vcs.reset(nullptr);
return false;
}
if (response.empty())

View File

@ -259,7 +259,7 @@ LyXModule const * ModuleList::operator[](string const & str) const
LyXModule const & mod = *it;
return &mod;
}
return 0;
return nullptr;
}
@ -271,7 +271,7 @@ LyXModule * ModuleList::operator[](string const & str)
LyXModule & mod = *it;
return &mod;
}
return 0;
return nullptr;
}
} // namespace lyx

View File

@ -21,7 +21,7 @@ namespace lyx {
OutputParams::OutputParams(Encoding const * enc)
: flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false),
moving_arg(false), intitle(false), inbranch(false), inulemcmd(0),
local_font(0),master_language(0), encoding(enc), free_spacing(false),
local_font(nullptr),master_language(nullptr), encoding(enc), free_spacing(false),
use_babel(false), use_polyglossia(false), use_hyperref(false), use_CJK(false),
use_indices(false), use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData), postpone_fragile_stuff(false), inDisplayMath(false),

View File

@ -216,7 +216,7 @@ bool Thesaurus::thesaurusInstalled(docstring const & lang) const
Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
{
Meanings meanings;
MyThes * mythes = 0;
MyThes * mythes = nullptr;
docstring const lang_code = from_ascii(wl.lang()->code());
docstring const t = wl.word();

View File

@ -76,28 +76,25 @@ struct UndoElement
StableDocIterator const & cel,
pit_type fro, pit_type en, ParagraphList * pl, MathData * ar,
bool lc, size_t gid) :
kind(kin), cur_before(cb), cell(cel), from(fro), end(en),
pars(pl), array(ar), bparams(0),
lyx_clean(lc), group_id(gid), time(current_time())
{
}
cur_before(cb), cell(cel), from(fro), end(en),
pars(pl), array(ar), bparams(nullptr),
group_id(gid), time(current_time()), kind(kin), lyx_clean(lc)
{}
///
UndoElement(CursorData const & cb, BufferParams const & bp,
bool lc, size_t gid) :
kind(ATOMIC_UNDO), cur_before(cb), cell(), from(0), end(0),
pars(0), array(0), bparams(new BufferParams(bp)),
lyx_clean(lc), group_id(gid), time(current_time())
{
}
cur_before(cb), cell(), from(0), end(0),
pars(nullptr), array(nullptr), bparams(new BufferParams(bp)),
group_id(gid), time(current_time()), kind(ATOMIC_UNDO), lyx_clean(lc)
{}
///
UndoElement(UndoElement const & ue) :
kind(ue.kind),
cur_before(ue.cur_before), cur_after(ue.cur_after),
cell(ue.cell), from(ue.from), end(ue.end),
pars(ue.pars), array(ue.array),
bparams(ue.bparams ? new BufferParams(*ue.bparams) : 0),
lyx_clean(ue.lyx_clean), group_id(ue.group_id),
time(current_time())
bparams(ue.bparams ? new BufferParams(*ue.bparams) : nullptr),
group_id(ue.group_id), time(current_time()), kind(ue.kind),
lyx_clean(ue.lyx_clean)
{}
///
~UndoElement()
@ -105,8 +102,6 @@ struct UndoElement
if (bparams)
delete bparams;
}
/// Which kind of operation are we recording for?
UndoKind kind;
/// the position of the cursor before recordUndo
CursorData cur_before;
/// the position of the cursor at the end of the undo group
@ -123,12 +118,14 @@ struct UndoElement
MathData * array;
/// Only used in case of params undo
BufferParams const * bparams;
/// Was the buffer clean at this point?
bool lyx_clean;
/// the element's group id
size_t group_id;
/// timestamp
time_t time;
/// Which kind of operation are we recording for?
UndoKind kind;
/// Was the buffer clean at this point?
bool lyx_clean;
private:
/// Protect construction
UndoElement();
@ -193,8 +190,8 @@ private:
struct Undo::Private
{
Private(Buffer & buffer) : buffer_(buffer), undo_finished_(true),
group_id_(0), group_level_(0) {}
Private(Buffer & buffer) : buffer_(buffer),
group_id_(0), group_level_(0), undo_finished_(true) {}
// Do one undo/redo step
void doUndoRedoAction(CursorData & cur, UndoElementStack & stack,
@ -227,15 +224,16 @@ struct Undo::Private
/// Redo stack.
UndoElementStack redostack_;
/// The flag used by Undo::finishUndo().
bool undo_finished_;
/// Current group Id.
size_t group_id_;
/// Current group nesting nevel.
size_t group_level_;
/// the position of cursor before the group was created
CursorData group_cur_before_;
/// The flag used by Undo::finishUndo().
bool undo_finished_;
};
@ -343,7 +341,7 @@ void Undo::Private::doRecordUndo(UndoKind kind,
// create the position information of the Undo entry
UndoElement undo(kind,
group_cur_before_.empty() ? cur_before : group_cur_before_,
cell, from, end, 0, 0, buffer_.isClean(), group_id_);
cell, from, end, nullptr, nullptr, buffer_.isClean(), group_id_);
// fill in the real data to be saved
if (cell.inMathed()) {
@ -468,7 +466,7 @@ void Undo::Private::doUndoRedoAction(CursorData & cur, UndoElementStack & stack,
dit.cell().swap(*undo.array);
dit.inset().setBuffer(buffer_);
delete undo.array;
undo.array = 0;
undo.array = nullptr;
} else {
// Some finer machinery is needed here.
Text * text = dit.text();
@ -504,12 +502,12 @@ void Undo::Private::doUndoRedoAction(CursorData & cur, UndoElementStack & stack,
fpit->setInsetBuffers(buffer_);
delete undo.pars;
undo.pars = 0;
undo.pars = nullptr;
}
// We'll clean up in release mode.
LASSERT(undo.pars == 0, undo.pars = 0);
LASSERT(undo.array == 0, undo.array = 0);
LASSERT(undo.pars == nullptr, undo.pars = nullptr);
LASSERT(undo.array == nullptr, undo.array = nullptr);
if (!undo.cur_before.empty())
cur = undo.cur_before;

View File

@ -971,7 +971,7 @@ string CVS::repoUpdate()
dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName()));
ret = frontend::Alert::prompt(_("Changes detected"),
text, 0, 1, _("&Continue"), _("&Abort"));
hideDialogs("file", 0);
hideDialogs("file", nullptr);
}
if (ret == 1)
return string();
@ -1532,7 +1532,7 @@ string SVN::repoUpdate()
dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName()));
ret = frontend::Alert::prompt(_("Changes detected"),
text, 0, 1, _("&Yes"), _("&No"));
hideDialogs("file", 0);
hideDialogs("file", nullptr);
}
if (ret == 1)
return string();

View File

@ -210,7 +210,7 @@ LaTeXLength table[] = {
const char * stringFromUnit(int unit)
{
if (unit < 0 || unit > num_units)
return 0;
return nullptr;
return unit_name[unit];
}

View File

@ -878,7 +878,7 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
// because of branches, e.g., a branch that contains an entire new section.
// We do not really want to wrap that whole thing in a <div>...</div>.
bool special_case = false;
Inset const * specinset = par->size() == 1 ? par->getInset(0) : 0;
Inset const * specinset = par->size() == 1 ? par->getInset(0) : nullptr;
if (specinset && !specinset->getLayout().htmlisblock()) {
Layout const & style = par->layout();
FontInfo const first_font = style.labeltype == LABEL_MANUAL ?
@ -974,7 +974,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
xs << html::CR();
// we will on occasion need to remember a layout from before.
Layout const * lastlay = 0;
Layout const * lastlay = nullptr;
while (par != pend) {
Layout const & style = par->layout();
@ -1002,9 +1002,9 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
// started---which we will be if the depth is the same.
if (par->params().depth() == origdepth) {
LATTEST(bstyle == style);
if (lastlay != 0) {
if (lastlay != nullptr) {
closeItemTag(xs, *lastlay);
lastlay = 0;
lastlay = nullptr;
}
// this will be positive, if we want to skip the
@ -1093,7 +1093,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
}
}
if (lastlay != 0)
if (lastlay != nullptr)
closeItemTag(xs, *lastlay);
closeTag(xs, bstyle);
xs << html::CR();