fix bit detection

This commit is contained in:
Syping 2020-10-25 14:42:31 +01:00
parent 11ae78cc2f
commit 9fdcba128f

View file

@ -25,14 +25,14 @@ checksum_lib::checksum_lib(PluginFormatFunction formatFunc, PluginHash32Function
{
p_formatName = QString::fromUtf8(formatFunc());
p_checksumSize = hashSzFunc();
p_funcBit = 64;
p_funcBit = 32;
}
checksum_lib::checksum_lib(PluginFormatFunction formatFunc, PluginHash64Function hash64Func, PluginHashSzFunction hashSzFunc) : hash64Func(hash64Func)
{
p_formatName = QString::fromUtf8(formatFunc());
p_checksumSize = hashSzFunc();
p_funcBit = 32;
p_funcBit = 64;
}
QByteArray checksum_lib::generateChecksum(const QByteArray &data)
@ -44,11 +44,13 @@ QByteArray checksum_lib::generateChecksum(const QByteArray &data)
const u_int32_t hash = hash32Func(udata, size);
free(udata);
return QByteArray::number((quint32)hash, 16);
return QByteArray();
}
else {
const u_int64_t hash = hash64Func(udata, size);
free(udata);
return QByteArray::number((quint64)hash, 16);
return QByteArray();
}
}