Commit a441acab authored by Laurent Montel's avatar Laurent Montel 😁

Fix some warning found by cppcheck

parent 2efdb89e
......@@ -348,7 +348,6 @@ bool parseGenericQuotedString(const char *&scursor, const char *const send,
QString &result, bool isCRLF,
const char openChar, const char closeChar)
{
char ch;
// We are in a quoted-string or domain-literal or comment and the
// cursor points to the first char after the openChar.
// We will apply unfolding and quoted-pair removal.
......@@ -358,7 +357,7 @@ bool parseGenericQuotedString(const char *&scursor, const char *const send,
assert(*(scursor - 1) == openChar || *(scursor - 1) == closeChar);
while (scursor != send) {
ch = *scursor++;
char ch = *scursor++;
if (ch == closeChar || ch == openChar) {
// end of quoted-string or another opening char:
......@@ -2026,7 +2025,6 @@ bool parseDateTime(const char *&scursor, const char *const send,
Headers::Base *extractFirstHeader(QByteArray &head)
{
int endOfFieldBody = 0;
bool folded = false;
Headers::Base *header = nullptr;
......@@ -2042,7 +2040,7 @@ Headers::Base *extractFirstHeader(QByteArray &head)
if (head[startOfFieldBody] == ' ') { // skip the space after the ':', if there
startOfFieldBody++;
}
endOfFieldBody = findHeaderLineEnd(head, startOfFieldBody, &folded);
int endOfFieldBody = findHeaderLineEnd(head, startOfFieldBody, &folded);
// rawFieldBody references actual data from 'heaed'
QByteArray rawFieldBody = QByteArray::fromRawData(head.constData() + startOfFieldBody, endOfFieldBody - startOfFieldBody);
if (folded) {
......
......@@ -124,10 +124,9 @@ NonMimeParser::~NonMimeParser() {}
QByteArray NonMimeParser::guessMimeType(const QByteArray &fileName)
{
QByteArray tmp, mimeType;
int pos;
if (!fileName.isEmpty()) {
pos = fileName.lastIndexOf('.');
int pos = fileName.lastIndexOf('.');
if (pos++ != -1) {
tmp = fileName.mid(pos, fileName.length() - pos).toUpper();
if (tmp == "JPG" || tmp == "JPEG") {
......
......@@ -154,7 +154,7 @@ QByteArray uniqueString()
static const char chars[] = "0123456789abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
time_t now;
char p[11];
int pos, ran;
int ran;
unsigned int timeval;
p[10] = '\0';
......@@ -163,7 +163,7 @@ QByteArray uniqueString()
timeval = (now / ran) + QCoreApplication::applicationPid();
for (int i = 0; i < 10; i++) {
pos = (int)(61.0 * rand() / (RAND_MAX + 1.0));
int pos = (int)(61.0 * rand() / (RAND_MAX + 1.0));
//qDebug() << pos;
p[i] = chars[pos];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment