]> git.lyx.org Git - features.git/commitdiff
Revert "Fix a number of signedness warnings"
authorRichard Kimberly Heck <rikiheck@lyx.org>
Mon, 2 Nov 2020 22:09:13 +0000 (17:09 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Mon, 2 Nov 2020 22:09:59 +0000 (17:09 -0500)
This reverts commit e8a28c33c564784899ecd427c06d1fe8678bfc07.

I was not aware that we used negative numbers for author IDs!

src/Author.cpp
src/Author.h
src/BufferParams.h
src/Changes.cpp
src/Changes.h

index c272f28a98371f438bb3ac6fb80b2600835b3f4a..ffb12983f050bc8c4bacca4d9b495bfff9de16ba 100644 (file)
@@ -32,7 +32,7 @@ static int computeHash(docstring const & name,
        // Bernstein's hash function
        unsigned int hash = 5381;
        for (char c : full_author_string)
        // 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);
 }
 
        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
 {
        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)
        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()) {
                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"
                        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;
 }
 
        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];
 }
 
        return authors_[id];
 }
 
index 118b64b8df87466f0a993a45da667824af01d712..798cfd80433499f236c2462645ab42e33cbc705e 100644 (file)
@@ -37,9 +37,9 @@ public:
        ///
        docstring nameAndEmail() const;
        ///
        ///
        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; }
        ///
        ///
        void setUsed(bool u) const { used_ = u; }
        ///
@@ -70,13 +70,13 @@ public:
        ///
        AuthorList();
        ///
        ///
        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);
        ///
        ///
        void recordCurrentAuthor(Author const & a);
        ///
-       Author const & get(size_t id) const;
+       Author const & get(int id) const;
        ///
        void sort();
        ///
        ///
        void sort();
        ///
index a6e1f575725c05ee67742871fae2d93e2ed395f1..6a5ded826013d56f8d8e089c9d7f26403c9c4280 100644 (file)
@@ -450,7 +450,7 @@ public:
        void addAuthor(Author const & a);
 
        /// map of the file's author IDs to AuthorList indexes
        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
        AuthorMap author_map_;
 
        /// the buffer's active font encoding
index eadcae9a971caaa87b6cfd6ed2e7b19ade3a5228..dfe04cd306b7d949cc0d7c98e43f99907825687f 100644 (file)
@@ -482,7 +482,7 @@ void Changes::lyxMarkChange(ostream & os, BufferParams const & bparams, int & co
 
        column = 0;
 
 
        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:
 
        switch (change.type) {
                case Change::UNCHANGED:
index d5a282ce88aa099447a25d0317fe95d7e2c25ecb..61e32b7dd9095afd2f8f863baa02c0ff67804f46 100644 (file)
@@ -83,7 +83,7 @@ public:
 
        Type type;
 
 
        Type type;
 
-       size_t author;
+       int author;
 
        time_t changetime;
 };
 
        time_t changetime;
 };