Skip to content

Commit

Permalink
HibpOffline.cpp: small simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
c4rlo committed Mar 27, 2019
1 parent 58c3938 commit a7e5d06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/HibpOffline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ namespace

ParseResult parseHibpLine(QIODevice& input, QByteArray& sha1, std::size_t& numPwns)
{
char hexSha1[SHA1_BYTES * 2];
const qint64 rc = input.read(&hexSha1[0], sizeof(hexSha1));
QByteArray hexSha1(SHA1_BYTES * 2, '\0');
const qint64 rc = input.read(hexSha1.data(), hexSha1.size());
if (rc == 0) {
return ParseResult::Eof;
} else if (rc != sizeof(hexSha1)) {
} else if (rc != hexSha1.size()) {
return ParseResult::Error;
}

sha1 = QByteArray::fromHex(QByteArray(&hexSha1[0], sizeof(hexSha1)));
sha1 = QByteArray::fromHex(hexSha1);

char c;
if (!input.getChar(&c) || c != ':') {
Expand Down

0 comments on commit a7e5d06

Please sign in to comment.