From 11f55842b588848ce61675fb03006a910b41bf2e Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Feb 13 2020 04:00:15 +0000 Subject: Fix test failures on s390x --- diff --git a/fix-sha2engine-big-endian.patch b/fix-sha2engine-big-endian.patch new file mode 100644 index 0000000..6d52533 --- /dev/null +++ b/fix-sha2engine-big-endian.patch @@ -0,0 +1,74 @@ +From ed2f6b813eeabc9461fc307bd6213cfbb54d7f65 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= +Date: Sat, 8 Feb 2020 16:09:37 +0100 +Subject: [PATCH] GH #2909: fix SHA2Engine for big-endian architectures + +--- + Foundation/src/SHA2Engine.cpp | 47 ----------------------------------- + 1 file changed, 47 deletions(-) + +diff --git a/Foundation/src/SHA2Engine.cpp b/Foundation/src/SHA2Engine.cpp +index 7ab454218e..b09b30a796 100644 +--- a/Foundation/src/SHA2Engine.cpp ++++ b/Foundation/src/SHA2Engine.cpp +@@ -151,52 +151,6 @@ static const unsigned char padding[128] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + temp2 = S642(a) + F640(a,b,c); \ + d += temp1; h = temp1 + temp2; \ + } +-#ifdef POCO_ARCH_BIG_ENDIAN +-#ifndef GET_UINT32 +-#define GET_UINT32(n,b,i) \ +-do { \ +- (n) = ( (Poco::UInt32) (b)[(i) ] ) \ +- | ( (Poco::UInt32) (b)[(i) + 1] << 8 ) \ +- | ( (Poco::UInt32) (b)[(i) + 2] << 16 ) \ +- | ( (Poco::UInt32) (b)[(i) + 3] << 24 ); \ +-} while( 0 ) +-#endif +-#ifndef PUT_UINT32 +-#define PUT_UINT32(n,b,i) \ +-do { \ +- (b)[(i) ] = (unsigned char) ( (n) ); \ +- (b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \ +- (b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \ +- (b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \ +-} while( 0 ) +-#endif +-#ifndef GET_UINT64 +-#define GET_UINT64(n,b,i) \ +-{ \ +- (n) = ( (Poco::UInt64) (b)[(i) ] ) \ +- | ( (Poco::UInt64) (b)[(i) + 1] << 8 ) \ +- | ( (Poco::UInt64) (b)[(i) + 2] << 16 ) \ +- | ( (Poco::UInt64) (b)[(i) + 3] << 24 ) \ +- | ( (Poco::UInt64) (b)[(i) + 4] << 32 ) \ +- | ( (Poco::UInt64) (b)[(i) + 5] << 40 ) \ +- | ( (Poco::UInt64) (b)[(i) + 6] << 48 ) \ +- | ( (Poco::UInt64) (b)[(i) + 7] << 56 ); \ +-} +-#endif +-#ifndef PUT_UINT64 +-#define PUT_UINT64(n,b,i) \ +-{ \ +- (b)[(i) ] = (unsigned char) ( (n) ); \ +- (b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \ +- (b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \ +- (b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \ +- (b)[(i) + 4] = (unsigned char) ( (n) >> 32 ); \ +- (b)[(i) + 5] = (unsigned char) ( (n) >> 40 ); \ +- (b)[(i) + 6] = (unsigned char) ( (n) >> 48 ); \ +- (b)[(i) + 7] = (unsigned char) ( (n) >> 56 ); \ +-} +-#endif +-#else + #ifndef GET_UINT32 + #define GET_UINT32(n,b,i) \ + do { \ +@@ -241,7 +195,6 @@ do { \ + (b)[(i) + 7] = (unsigned char) ( (n) ); \ + } + #endif +-#endif + + + SHA2Engine::SHA2Engine(ALGORITHM algorithm): diff --git a/fix-utf1632encoding-big-endian.patch b/fix-utf1632encoding-big-endian.patch new file mode 100644 index 0000000..bb2426f --- /dev/null +++ b/fix-utf1632encoding-big-endian.patch @@ -0,0 +1,237 @@ +From 40929842565a5c4cac4886317ef4ab9de64a3ba7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= +Date: Sat, 8 Feb 2020 20:25:00 +0100 +Subject: [PATCH] fix UTF16/UTF32Encoding wrong byte order handling on + bigendian + +--- + Foundation/src/UTF16Encoding.cpp | 58 +++++++++++++++++--------------- + Foundation/src/UTF32Encoding.cpp | 50 ++++++++++++++------------- + 2 files changed, 57 insertions(+), 51 deletions(-) + +diff --git a/Foundation/src/UTF16Encoding.cpp b/Foundation/src/UTF16Encoding.cpp +index ea2ee8fe4f..ae7ac88733 100644 +--- a/Foundation/src/UTF16Encoding.cpp ++++ b/Foundation/src/UTF16Encoding.cpp +@@ -28,24 +28,24 @@ const char* UTF16Encoding::_names[] = + }; + + +-const TextEncoding::CharacterMap UTF16Encoding::_charMap = ++const TextEncoding::CharacterMap UTF16Encoding::_charMap = + { +- /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + }; + + +@@ -54,13 +54,13 @@ UTF16Encoding::UTF16Encoding(ByteOrderType byteOrder) + setByteOrder(byteOrder); + } + +- ++ + UTF16Encoding::UTF16Encoding(int byteOrderMark) + { + setByteOrder(byteOrderMark); + } + +- ++ + UTF16Encoding::~UTF16Encoding() + { + } +@@ -75,7 +75,7 @@ UTF16Encoding::ByteOrderType UTF16Encoding::getByteOrder() const + #endif + } + +- ++ + void UTF16Encoding::setByteOrder(ByteOrderType byteOrder) + { + #if defined(POCO_ARCH_BIG_ENDIAN) +@@ -85,7 +85,7 @@ void UTF16Encoding::setByteOrder(ByteOrderType byteOrder) + #endif + } + +- ++ + void UTF16Encoding::setByteOrder(int byteOrderMark) + { + _flipBytes = byteOrderMark != 0xFEFF; +@@ -124,7 +124,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const + + if (_flipBytes) + { +- ByteOrder::flipBytes(uc); ++ uc = ByteOrder::flipBytes(uc); + } + + if (uc >= 0xd800 && uc < 0xdc00) +@@ -136,7 +136,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const + + if (_flipBytes) + { +- ByteOrder::flipBytes(uc2); ++ uc2 = ByteOrder::flipBytes(uc2); + } + if (uc2 >= 0xdc00 && uc2 < 0xe000) + { +@@ -201,8 +201,10 @@ int UTF16Encoding::queryConvert(const unsigned char* bytes, int length) const + unsigned char* p = (unsigned char*) &uc; + *p++ = *bytes++; + *p++ = *bytes++; +- if (_flipBytes) +- ByteOrder::flipBytes(uc); ++ if (_flipBytes) ++ { ++ uc = ByteOrder::flipBytes(uc); ++ } + if (uc >= 0xd800 && uc < 0xdc00) + { + if (length >= 4) +@@ -211,8 +213,10 @@ int UTF16Encoding::queryConvert(const unsigned char* bytes, int length) const + p = (unsigned char*) &uc2; + *p++ = *bytes++; + *p++ = *bytes++; +- if (_flipBytes) +- ByteOrder::flipBytes(uc2); ++ if (_flipBytes) ++ { ++ uc2 = ByteOrder::flipBytes(uc2); ++ } + if (uc2 >= 0xdc00 && uc < 0xe000) + { + ret = ((uc & 0x3ff) << 10) + (uc2 & 0x3ff) + 0x10000; +diff --git a/Foundation/src/UTF32Encoding.cpp b/Foundation/src/UTF32Encoding.cpp +index ff07006a4f..47a0156b0e 100644 +--- a/Foundation/src/UTF32Encoding.cpp ++++ b/Foundation/src/UTF32Encoding.cpp +@@ -28,24 +28,24 @@ const char* UTF32Encoding::_names[] = + }; + + +-const TextEncoding::CharacterMap UTF32Encoding::_charMap = ++const TextEncoding::CharacterMap UTF32Encoding::_charMap = + { +- /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, +- /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, ++ /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + }; + + +@@ -54,13 +54,13 @@ UTF32Encoding::UTF32Encoding(ByteOrderType byteOrder) + setByteOrder(byteOrder); + } + +- ++ + UTF32Encoding::UTF32Encoding(int byteOrderMark) + { + setByteOrder(byteOrderMark); + } + +- ++ + UTF32Encoding::~UTF32Encoding() + { + } +@@ -75,7 +75,7 @@ UTF32Encoding::ByteOrderType UTF32Encoding::getByteOrder() const + #endif + } + +- ++ + void UTF32Encoding::setByteOrder(ByteOrderType byteOrder) + { + #if defined(POCO_ARCH_BIG_ENDIAN) +@@ -85,7 +85,7 @@ void UTF32Encoding::setByteOrder(ByteOrderType byteOrder) + #endif + } + +- ++ + void UTF32Encoding::setByteOrder(int byteOrderMark) + { + _flipBytes = byteOrderMark != 0xFEFF; +@@ -126,7 +126,7 @@ int UTF32Encoding::convert(const unsigned char* bytes) const + + if (_flipBytes) + { +- ByteOrder::flipBytes(uc); ++ uc = ByteOrder::flipBytes(uc); + } + + return uc; +@@ -160,8 +160,10 @@ int UTF32Encoding::queryConvert(const unsigned char* bytes, int length) const + *p++ = *bytes++; + *p++ = *bytes++; + *p++ = *bytes++; +- if (_flipBytes) +- ByteOrder::flipBytes(uc); ++ if (_flipBytes) ++ { ++ uc = ByteOrder::flipBytes(uc); ++ } + return uc; + } + diff --git a/poco.spec b/poco.spec index 464426e..09371a1 100644 --- a/poco.spec +++ b/poco.spec @@ -38,6 +38,8 @@ Patch2: poco-1.10.0-fix-unbundled-build2.patch Patch3: set-sqlite-thread-mode.patch Patch4: use-lib-suffix.patch Patch5: dont-install-cppunit.patch +Patch6: fix-sha2engine-big-endian.patch +Patch7: fix-utf1632encoding-big-endian.patch BuildRequires: cmake BuildRequires: gcc-c++