mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Revert "Fix a number of signedness warnings"
This reverts commit e8a28c33c5
.
I was not aware that we used negative numbers for author IDs!
This commit is contained in:
parent
39f997048e
commit
fba1c434e5
@ -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(c);
|
||||
hash = ((hash << 5) + hash) + (unsigned int)c;
|
||||
return int(hash);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ AuthorList::AuthorList()
|
||||
{}
|
||||
|
||||
|
||||
size_t AuthorList::record(Author const & a)
|
||||
int AuthorList::record(Author const & a)
|
||||
{
|
||||
bool const valid = a.valid();
|
||||
// If we record an author which equals the current
|
||||
@ -117,9 +117,9 @@ size_t AuthorList::record(Author const & a)
|
||||
Authors::const_iterator const end = authors_.end();
|
||||
for (; it != end; ++it) {
|
||||
if (valid && *it == a)
|
||||
return size_t(it - beg);
|
||||
return it - beg;
|
||||
if (it->bufferId() == a.bufferId()) {
|
||||
size_t const id = size_t(it - beg);
|
||||
int const id = 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 @@ size_t AuthorList::record(Author const & a)
|
||||
}
|
||||
|
||||
|
||||
void AuthorList::record(size_t id, Author const & a)
|
||||
void AuthorList::record(int id, Author const & a)
|
||||
{
|
||||
LBUFERR(id < authors_.size());
|
||||
LBUFERR(unsigned(id) < authors_.size());
|
||||
authors_[id] = a;
|
||||
}
|
||||
|
||||
@ -148,9 +148,9 @@ void AuthorList::recordCurrentAuthor(Author const & a)
|
||||
}
|
||||
|
||||
|
||||
Author const & AuthorList::get(size_t id) const
|
||||
Author const & AuthorList::get(int id) const
|
||||
{
|
||||
LASSERT(id < authors_.size() , return authors_[0]);
|
||||
LASSERT(id < (int)authors_.size() , return authors_[0]);
|
||||
return authors_[id];
|
||||
}
|
||||
|
||||
|
10
src/Author.h
10
src/Author.h
@ -37,9 +37,9 @@ public:
|
||||
///
|
||||
docstring nameAndEmail() const;
|
||||
///
|
||||
size_t bufferId() const { return buffer_id_; }
|
||||
int bufferId() const { return buffer_id_; }
|
||||
///
|
||||
void setBufferId(size_t buffer_id) const { buffer_id_ = buffer_id; }
|
||||
void setBufferId(int buffer_id) const { buffer_id_ = buffer_id; }
|
||||
///
|
||||
void setUsed(bool u) const { used_ = u; }
|
||||
///
|
||||
@ -70,13 +70,13 @@ public:
|
||||
///
|
||||
AuthorList();
|
||||
///
|
||||
size_t record(Author const & a);
|
||||
int record(Author const & a);
|
||||
///
|
||||
void record(size_t id, Author const & a);
|
||||
void record(int id, Author const & a);
|
||||
///
|
||||
void recordCurrentAuthor(Author const & a);
|
||||
///
|
||||
Author const & get(size_t id) const;
|
||||
Author const & get(int id) const;
|
||||
///
|
||||
void sort();
|
||||
///
|
||||
|
@ -450,7 +450,7 @@ public:
|
||||
void addAuthor(Author const & a);
|
||||
|
||||
/// map of the file's author IDs to AuthorList indexes
|
||||
typedef std::map<size_t, size_t> AuthorMap;
|
||||
typedef std::map<int, int> AuthorMap;
|
||||
AuthorMap author_map_;
|
||||
|
||||
/// the buffer's active font encoding
|
||||
|
@ -482,7 +482,7 @@ void Changes::lyxMarkChange(ostream & os, BufferParams const & bparams, int & co
|
||||
|
||||
column = 0;
|
||||
|
||||
size_t const buffer_id = bparams.authors().get(change.author).bufferId();
|
||||
int const buffer_id = bparams.authors().get(change.author).bufferId();
|
||||
|
||||
switch (change.type) {
|
||||
case Change::UNCHANGED:
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
Type type;
|
||||
|
||||
size_t author;
|
||||
int author;
|
||||
|
||||
time_t changetime;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user