Fix signed-ness warnings

This commit is contained in:
Richard Kimberly Heck 2020-10-13 17:24:36 -04:00
parent 406396685e
commit 28ae543a2a
4 changed files with 32 additions and 33 deletions

View File

@ -73,13 +73,14 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype, bool
bool const former_pass_thru = pass_thru_; bool const former_pass_thru = pass_thru_;
// Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them) // Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them)
// "999" is the conventional name given to those by lyx2lyx
if (name_ == "999") { if (name_ == "999") {
unsigned int const req = insetlayout ? it.inset().getLayout().requiredArgs() int const req = insetlayout ? it.inset().getLayout().requiredArgs()
: it.paragraph().layout().requiredArgs(); : it.paragraph().layout().requiredArgs();
unsigned int const opts = insetlayout ? it.inset().getLayout().optArgs() int const opts = insetlayout ? it.inset().getLayout().optArgs()
: it.paragraph().layout().optArgs(); : it.paragraph().layout().optArgs();
unsigned int nr = 0; int nr = 0;
unsigned int ours = 0; int ours = 0;
InsetList::const_iterator parit = it.paragraph().insetList().begin(); InsetList::const_iterator parit = it.paragraph().insetList().begin();
InsetList::const_iterator parend = it.paragraph().insetList().end(); InsetList::const_iterator parend = it.paragraph().insetList().end();
for (; parit != parend; ++parit) { for (; parit != parend; ++parit) {
@ -90,7 +91,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype, bool
} }
} }
bool done = false; bool done = false;
unsigned int realopts = 0; int realopts = 0;
if (nr > req) { if (nr > req) {
// We have optional arguments // We have optional arguments
realopts = nr - req; realopts = nr - req;

View File

@ -769,9 +769,9 @@ Layout::LaTeXArgMap InsetLayout::args() const
} }
unsigned int InsetLayout::optArgs() const int InsetLayout::optArgs() const
{ {
unsigned int nr = 0; int nr = 0;
Layout::LaTeXArgMap const args = InsetLayout::args(); Layout::LaTeXArgMap const args = InsetLayout::args();
Layout::LaTeXArgMap::const_iterator it = args.begin(); Layout::LaTeXArgMap::const_iterator it = args.begin();
for (; it != args.end(); ++it) { for (; it != args.end(); ++it) {
@ -782,9 +782,9 @@ unsigned int InsetLayout::optArgs() const
} }
unsigned int InsetLayout::requiredArgs() const int InsetLayout::requiredArgs() const
{ {
unsigned int nr = 0; int nr = 0;
Layout::LaTeXArgMap const args = InsetLayout::args(); Layout::LaTeXArgMap const args = InsetLayout::args();
Layout::LaTeXArgMap::const_iterator it = args.begin(); Layout::LaTeXArgMap::const_iterator it = args.begin();
for (; it != args.end(); ++it) { for (; it != args.end(); ++it) {

View File

@ -99,9 +99,9 @@ public:
/// Those are iterators for different containers. /// Those are iterators for different containers.
Layout::LaTeXArgMap args() const; Layout::LaTeXArgMap args() const;
/// ///
unsigned int optArgs() const; int optArgs() const;
/// ///
unsigned int requiredArgs() const; int requiredArgs() const;
/// ///
docstring preamble() const { return preamble_; } docstring preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this inset /// Get language dependent macro definitions needed for this inset

View File

@ -63,16 +63,16 @@ enum OpenEncoding {
struct OutputState struct OutputState
{ {
OutputState() : open_encoding_(none), cjk_inherited_(0), OutputState() : prev_env_language_(nullptr), open_encoding_(none),
prev_env_language_(nullptr), nest_level_(0) cjk_inherited_(0), nest_level_(0)
{ {
} }
OpenEncoding open_encoding_;
int cjk_inherited_;
Language const * prev_env_language_; Language const * prev_env_language_;
int nest_level_;
stack<int> lang_switch_depth_; // Both are always empty when stack<int> lang_switch_depth_; // Both are always empty when
stack<string> open_polyglossia_lang_; // not using polyglossia stack<string> open_polyglossia_lang_; // not using polyglossia
OpenEncoding open_encoding_;
int cjk_inherited_;
int nest_level_;
}; };
@ -164,10 +164,10 @@ string const getPolyglossiaBegin(string const & lang_begin_command,
struct TeXEnvironmentData struct TeXEnvironmentData
{ {
bool cjk_nested;
Layout const * style; Layout const * style;
Language const * par_language; Language const * par_language;
Encoding const * prev_encoding; Encoding const * prev_encoding;
bool cjk_nested;
bool leftindent_open; bool leftindent_open;
}; };
@ -464,9 +464,9 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs, void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs,
map<int, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix) map<size_t, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix)
{ {
unsigned int const argnr = latexargs.size(); size_t const argnr = latexargs.size();
if (argnr == 0) if (argnr == 0)
return; return;
@ -480,16 +480,16 @@ void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeX
} }
} }
for (unsigned int i = 1; i <= argnr; ++i) { for (size_t i = 1; i <= argnr; ++i) {
map<int, InsetArgument const *>::const_iterator lit = ilist.find(i); map<size_t, InsetArgument const *>::const_iterator lit = ilist.find(i);
bool inserted = false; bool inserted = false;
if (lit != ilist.end()) { if (lit != ilist.end()) {
InsetArgument const * ins = (*lit).second; InsetArgument const * ins = lit->second;
if (ins) { if (ins) {
Layout::LaTeXArgMap::const_iterator const lait = Layout::LaTeXArgMap::const_iterator const lait =
latexargs.find(ins->name()); latexargs.find(ins->name());
if (lait != latexargs.end()) { if (lait != latexargs.end()) {
Layout::latexarg arg = (*lait).second; Layout::latexarg arg = lait->second;
docstring ldelim; docstring ldelim;
docstring rdelim; docstring rdelim;
if (!arg.nodelims) { if (!arg.nodelims) {
@ -588,7 +588,7 @@ namespace {
void addArgInsets(Paragraph const & par, string const & prefix, void addArgInsets(Paragraph const & par, string const & prefix,
Layout::LaTeXArgMap const & latexargs, Layout::LaTeXArgMap const & latexargs,
map<int, InsetArgument const *> & ilist, map<size_t, InsetArgument const *> & ilist,
vector<string> & required) vector<string> & required)
{ {
for (auto const & table : par.insetList()) { for (auto const & table : par.insetList()) {
@ -601,8 +601,7 @@ void addArgInsets(Paragraph const & par, string const & prefix,
} }
string const name = prefix.empty() ? string const name = prefix.empty() ?
arg->name() : split(arg->name(), ':'); arg->name() : split(arg->name(), ':');
// why converting into an integer? size_t const nr = convert<size_t>(name);
unsigned int const nr = convert<unsigned int>(name);
if (ilist.find(nr) == ilist.end()) if (ilist.find(nr) == ilist.end())
ilist[nr] = arg; ilist[nr] = arg;
Layout::LaTeXArgMap::const_iterator const lit = Layout::LaTeXArgMap::const_iterator const lit =
@ -623,7 +622,7 @@ void latexArgInsets(Paragraph const & par, otexstream & os,
Layout::LaTeXArgMap const & latexargs, Layout::LaTeXArgMap const & latexargs,
string const & prefix) string const & prefix)
{ {
map<int, InsetArgument const *> ilist; map<size_t, InsetArgument const *> ilist;
vector<string> required; vector<string> required;
addArgInsets(par, prefix, latexargs, ilist, required); addArgInsets(par, prefix, latexargs, ilist, required);
getArgInsets(os, runparams, latexargs, ilist, required, prefix); getArgInsets(os, runparams, latexargs, ilist, required, prefix);
@ -636,7 +635,7 @@ void latexArgInsets(ParagraphList const & pars,
Layout::LaTeXArgMap const & latexargs, Layout::LaTeXArgMap const & latexargs,
string const & prefix) string const & prefix)
{ {
map<int, InsetArgument const *> ilist; map<size_t, InsetArgument const *> ilist;
vector<string> required; vector<string> required;
depth_type const current_depth = pit->params().depth(); depth_type const current_depth = pit->params().depth();
@ -656,7 +655,6 @@ void latexArgInsets(ParagraphList const & pars,
} }
ParagraphList::const_iterator spit = prev(pit, offset); ParagraphList::const_iterator spit = prev(pit, offset);
for (; spit != pars.end(); ++spit) { for (; spit != pars.end(); ++spit) {
if (spit->layout() != current_layout || if (spit->layout() != current_layout ||
spit->params().depth() < current_depth) spit->params().depth() < current_depth)
@ -674,7 +672,7 @@ void latexArgInsetsForParent(ParagraphList const & pars, otexstream & os,
Layout::LaTeXArgMap const & latexargs, Layout::LaTeXArgMap const & latexargs,
string const & prefix) string const & prefix)
{ {
map<int, InsetArgument const *> ilist; map<size_t, InsetArgument const *> ilist;
vector<string> required; vector<string> required;
for (Paragraph const & par : pars) { for (Paragraph const & par : pars) {
@ -1589,7 +1587,7 @@ void latexParagraphs(Buffer const & buf,
// The full doc will be exported but it is easier to just rely on // The full doc will be exported but it is easier to just rely on
// runparams range parameters that will be passed TeXEnvironment. // runparams range parameters that will be passed TeXEnvironment.
runparams.par_begin = 0; runparams.par_begin = 0;
runparams.par_end = paragraphs.size(); runparams.par_end = static_cast<int>(paragraphs.size());
} }
pit_type pit = runparams.par_begin; pit_type pit = runparams.par_begin;
@ -1815,7 +1813,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
// shouldn't ever reach here (see above) but avoids warning. // shouldn't ever reach here (see above) but avoids warning.
return make_pair(true, 0); return make_pair(true, 0);
case Encoding::inputenc: { case Encoding::inputenc: {
int count = inputenc_arg.length(); size_t count = inputenc_arg.length();
if (oldEnc.package() == Encoding::CJK && if (oldEnc.package() == Encoding::CJK &&
state->open_encoding_ == CJK) { state->open_encoding_ == CJK) {
os << "\\end{CJK}"; os << "\\end{CJK}";
@ -1843,7 +1841,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
return make_pair(true, count + 16); return make_pair(true, count + 16);
} }
case Encoding::CJK: { case Encoding::CJK: {
int count = inputenc_arg.length(); size_t count = inputenc_arg.length();
if (oldEnc.package() == Encoding::CJK && if (oldEnc.package() == Encoding::CJK &&
state->open_encoding_ == CJK) { state->open_encoding_ == CJK) {
os << "\\end{CJK}"; os << "\\end{CJK}";