X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FAuthor.cpp;h=ffb12983f050bc8c4bacca4d9b495bfff9de16ba;hb=49a17aaa5dc37139eb3deddaf3cbd2606608a0b7;hp=9a2dc1ea432fca51a6241f633540614a8c2fb063;hpb=715b8cda54a2aded29260b57ff201b16fd906f21;p=features.git diff --git a/src/Author.cpp b/src/Author.cpp index 9a2dc1ea43..ffb12983f0 100644 --- a/src/Author.cpp +++ b/src/Author.cpp @@ -31,8 +31,8 @@ static int computeHash(docstring const & name, string const full_author_string = to_utf8(name + email); // Bernstein's hash function unsigned int hash = 5381; - for (unsigned int i = 0; i < full_author_string.length(); ++i) - hash = ((hash << 5) + hash) + (unsigned int)(full_author_string[i]); + for (char c : full_author_string) + hash = ((hash << 5) + hash) + (unsigned int)c; return int(hash); } @@ -119,12 +119,13 @@ int AuthorList::record(Author const & a) if (valid && *it == a) return it - beg; if (it->bufferId() == a.bufferId()) { - int id = it - beg; - if (!it->valid()) - // we need to handle the case of a valid author being registred + 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" // does not clear the buffer's author list. record(id, a); + } return id; } }