replace qChecksum32() with qHash() [ci reset]

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-20 01:03:55 +03:00
parent 8df8dda669
commit fdfd7de84e
5 changed files with 1 additions and 26 deletions

1
README
View file

@ -60,7 +60,6 @@ There are several things you should be aware before considering Katie:
- support for PostgreSQL v9.1+
- support for locale aliases
- support for generating SHA-256 and SHA-512 hash sums (SHA-2)
- support for generating CRC-32 checksums via qChecksum32() function
- verification section for plugins build with Clang
- qCompress() and qUncompress() use ZSTD which is much faster
- stack backtrace on assert, crash or warning via execinfo

View file

@ -1,6 +1,5 @@
# add_definitions()
set(EXTRA_CORE_LIBS
${ZLIB_LIBRARIES}
${ICU_LIBRARIES}
${ZSTD_LIBRARIES}
${JANSSON_LIBRARIES}
@ -109,7 +108,6 @@ include_directories(
${CMAKE_BINARY_DIR}/include
${CMAKE_BINARY_DIR}/privateinclude
${CMAKE_BINARY_DIR}/include/QtCore
${ZLIB_INCLUDE_DIRS}
${ICU_INCLUDES}
${ZSTD_INCLUDES}
${JANSSON_INCLUDES}

View file

@ -163,7 +163,7 @@ static inline QByteArray normalizeTypeInternal(const char *t, const char *e, boo
{
const int len = e - t;
#ifndef QT_BOOTSTRAPPED
const quint32 cachekey = qChecksum32(t, len);
const quint32 cachekey = qHash(QByteArray::fromRawData(t, len));
QMutexLocker lock(qGlobalNormalizedTypeMutex());
QByteArray cached = qGlobalNormalizedTypeHash()->value(cachekey);
if (!cached.isEmpty()) {

View file

@ -36,7 +36,6 @@
#include <stdlib.h>
#ifndef QT_NO_COMPRESS
#include <zlib.h>
#include <zstd.h>
#include <zstd_errors.h>
#endif // QT_NO_COMPRESS
@ -293,26 +292,6 @@ quint16 qChecksum(const char *data, uint len)
return ~crc & 0xffff;
}
/*!
\relates QByteArray
Returns the CRC-32 checksum of the first \a len bytes of \a data.
The checksum is independent of the byte order (endianness).
*/
quint32 qChecksum32(const char *data, uint len)
{
#ifndef QT_NO_COMPRESS
quint32 crc_32 = ::crc32(0, 0, 0);
return ::crc32(crc_32, reinterpret_cast<const uchar *>(data), len);
#else
Q_UNUSED(data)
Q_UNUSED(len)
Q_ASSERT_X(false, "qChecksum32", "Function is a stub!");
return 0;
#endif
}
#ifndef QT_NO_COMPRESS
/*!
\fn QByteArray qCompress(const QByteArray& data, int compressionLevel)

View file

@ -78,7 +78,6 @@ inline int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
// qChecksum: Internet checksum
Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len);
Q_CORE_EXPORT quint32 qChecksum32(const char *s, uint len);
class QByteRef;
class QString;