From a6c6f264eabb98b482ca4df83c148c5c87aacfb4 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 18 Oct 2020 20:56:17 +0300 Subject: [PATCH] replace qToUnaligned() with its body internal and not documented Signed-off-by: Ivailo Monev --- CMakeLists.txt | 2 +- src/core/global/qendian.h | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbabb9ae5..552832e97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,7 +256,7 @@ set_package_properties(ZSTD PROPERTIES TYPE REQUIRED ) -# v0.9.8+ required for SHA-224 to SHA-512 support +# v0.9.8+ required for SHA-224...SHA-512 support find_package(OpenSSL 0.9.8) set_package_properties(OpenSSL PROPERTIES PURPOSE "Required for HTTPS support" diff --git a/src/core/global/qendian.h b/src/core/global/qendian.h index 412496eec..9732d8a9f 100644 --- a/src/core/global/qendian.h +++ b/src/core/global/qendian.h @@ -64,13 +64,6 @@ template inline void qbswap(const T src, uchar *dest) qbswap_helper(reinterpret_cast(&src), dest, sizeof(T)); } -// Used to implement a type-safe and alignment-safe copy operation -// If you want to avoid the memcopy, you must write specializations for this function -template inline void qToUnaligned(const T src, uchar *dest) -{ - memcpy(dest, &src, sizeof(T)); -} - /* T qFromLittleEndian(const uchar *src) * This function will read a little-endian encoded value from \a src * and return the value in host-endian encoding. @@ -243,7 +236,7 @@ template inline T qToLittleEndian(const T source) template inline T qFromLittleEndian(const T source) { return qbswap(source); } template inline void qToBigEndian(const T src, uchar *dest) -{ qToUnaligned(src, dest); } +{ ::memcpy(dest, &src, sizeof(T)); } template inline void qToLittleEndian(const T src, uchar *dest) { qbswap(src, dest); } #else // Q_LITTLE_ENDIAN @@ -259,7 +252,7 @@ template inline T qFromLittleEndian(const T source) template inline void qToBigEndian(const T src, uchar *dest) { qbswap(src, dest); } template inline void qToLittleEndian(const T src, uchar *dest) -{ qToUnaligned(src, dest); } +{ ::memcpy(dest, &src, sizeof(T)); } #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN -- 2.11.0