commit e8a28c33c564784899ecd427c06d1fe8678bfc07
Author: Richard Kimberly Heck <[email protected]>
Date: Mon Nov 2 12:03:37 2020 -0500
Fix a number of signedness warnings
---
src/Author.cpp | 16 ++++++++--------
src/Author.h | 10 +++++-----
src/BufferParams.h | 2 +-
src/Changes.cpp | 2 +-
src/Changes.h | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/Author.cpp b/src/Author.cpp
index ffb1298..c272f28 100644
--- a/src/Author.cpp
+++ b/src/Author.cpp
@@ -32,7 +32,7 @@ static int computeHash(docstring const & name,
// Bernstein's hash function
unsigned int hash = 5381;
for (char c : full_author_string)
- hash = ((hash << 5) + hash) + (unsigned int)c;
+ hash = ((hash << 5) + hash) + unsigned(c);
return int(hash);
}
@@ -103,7 +103,7 @@ AuthorList::AuthorList()
{}
-int AuthorList::record(Author const & a)
+size_t AuthorList::record(Author const & a)
{
bool const valid = a.valid();
// If we record an author which equals the current
@@ -117,9 +117,9 @@ int AuthorList::record(Author const & a)
Authors::const_iterator const end = authors_.end();
for (; it != end; ++it) {
if (valid && *it == a)
- return it - beg;
+ return size_t(it - beg);
if (it->bufferId() == a.bufferId()) {
- int const id = it - beg;
+ size_t const id = size_t(it - beg);
if (!it->valid()) {
// we need to handle the case of a valid author
being registered
// after an invalid one. For instance, because
"buffer-reload"
@@ -134,9 +134,9 @@ int AuthorList::record(Author const & a)
}
-void AuthorList::record(int id, Author const & a)
+void AuthorList::record(size_t id, Author const & a)
{
- LBUFERR(unsigned(id) < authors_.size());
+ LBUFERR(id < authors_.size());
authors_[id] = a;
}
@@ -148,9 +148,9 @@ void AuthorList::recordCurrentAuthor(Author const & a)
}
-Author const & AuthorList::get(int id) const
+Author const & AuthorList::get(size_t id) const
{
- LASSERT(id < (int)authors_.size() , return authors_[0]);
+ LASSERT(id < authors_.size() , return authors_[0]);
return authors_[id];
}
diff --git a/src/Author.h b/src/Author.h
index 798cfd8..118b64b 100644
--- a/src/Author.h
+++ b/src/Author.h
@@ -37,9 +37,9 @@ public:
///
docstring nameAndEmail() const;
///
- int bufferId() const { return buffer_id_; }
+ size_t bufferId() const { return buffer_id_; }
///
- void setBufferId(int buffer_id) const { buffer_id_ = buffer_id; }
+ void setBufferId(size_t buffer_id) const { buffer_id_ = buffer_id; }
///
void setUsed(bool u) const { used_ = u; }
///
@@ -70,13 +70,13 @@ public:
///
AuthorList();
///
- int record(Author const & a);
+ size_t record(Author const & a);
///
- void record(int id, Author const & a);
+ void record(size_t id, Author const & a);
///
void recordCurrentAuthor(Author const & a);
///
- Author const & get(int id) const;
+ Author const & get(size_t id) const;
///
void sort();
///
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 6a5ded8..a6e1f57 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -450,7 +450,7 @@ public:
void addAuthor(Author const & a);
/// map of the file's author IDs to AuthorList indexes
- typedef std::map<int, int> AuthorMap;
+ typedef std::map<size_t, size_t> AuthorMap;
AuthorMap author_map_;
/// the buffer's active font encoding
diff --git a/src/Changes.cpp b/src/Changes.cpp
index dfe04cd..eadcae9 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -482,7 +482,7 @@ void Changes::lyxMarkChange(ostream & os, BufferParams
const & bparams, int & co
column = 0;
- int const buffer_id = bparams.authors().get(change.author).bufferId();
+ size_t const buffer_id =
bparams.authors().get(change.author).bufferId();
switch (change.type) {
case Change::UNCHANGED:
diff --git a/src/Changes.h b/src/Changes.h
index 61e32b7..d5a282c 100644
--- a/src/Changes.h
+++ b/src/Changes.h
@@ -83,7 +83,7 @@ public:
Type type;
- int author;
+ size_t author;
time_t changetime;
};
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs