commit:     207859482e3cca4d24bbb1d96e7a0f3511725d38
Author:     Jesus P Rey (Chuso) <gentoo <AT> chuso <DOT> net>
AuthorDate: Thu Jul 15 18:56:30 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 16 01:33:18 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20785948

net-p2p/mldonkey: Patch for C++17 support.

Signed-off-by: Jesus P Rey <gentoo <AT> chuso.net>
Closes: https://bugs.gentoo.org/790134
Closes: https://github.com/gentoo/gentoo/pull/21663
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-p2p/mldonkey/files/cpp17-byte-namespace.patch | 63 +++++++++++++++++++++++
 net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild         |  2 +
 2 files changed, 65 insertions(+)

diff --git a/net-p2p/mldonkey/files/cpp17-byte-namespace.patch 
b/net-p2p/mldonkey/files/cpp17-byte-namespace.patch
new file mode 100644
index 00000000000..0b1ca44e8ee
--- /dev/null
+++ b/net-p2p/mldonkey/files/cpp17-byte-namespace.patch
@@ -0,0 +1,63 @@
+diff -ur a/src/utils/lib/CryptoPP.cc b/src/utils/lib/CryptoPP.cc
+--- a/src/utils/lib/CryptoPP.cc        2021-07-06 22:20:46.675183781 +0200
++++ b/src/utils/lib/CryptoPP.cc        2021-07-06 22:20:51.025182789 +0200
+@@ -9482,7 +9482,7 @@
+ #define PRIVKEYSIZE 384
+ 
+ static Signer* s_signer = NULL;   
+-static byte m_publicKey[MAXPUBKEYSIZE+1];
++static CryptoPP::byte m_publicKey[MAXPUBKEYSIZE+1];
+ static unsigned long m_publicKeyLen = 0;
+ 
+ void cc_lprintf_nl(const char * msg, bool verb);
+@@ -9555,7 +9555,7 @@
+ 
+ 
+ // return signatureSize (buf)
+-int createSignature(byte *buf, int maxLen, byte *key, int keyLen, uint32_t 
cInt, uint8_t ipType, uint32_t ip) {
++int createSignature(CryptoPP::byte *buf, int maxLen, CryptoPP::byte *key, int 
keyLen, uint32_t cInt, uint8_t ipType, uint32_t ip) {
+ 
+       int result = 0;
+ 
+@@ -9570,7 +9570,7 @@
+               CryptoPP::SecByteBlock sBB(s_signer->SignatureLength());
+               CryptoPP::AutoSeededRandomPool rng;
+       
+-              byte bArray[MAXPUBKEYSIZE+9];
++              CryptoPP::byte bArray[MAXPUBKEYSIZE+9];
+ 
+               memcpy(bArray,key,keyLen);
+               PokeUInt32(bArray+keyLen,cInt);   
+@@ -9597,7 +9597,7 @@
+ 
+ }
+ 
+-int verifySignature(byte *key, int keyLen, byte *sig, int sigLen, uint32_t 
cInt, uint8_t ipType, uint32_t ip) {
++int verifySignature(CryptoPP::byte *key, int keyLen, CryptoPP::byte *sig, int 
sigLen, uint32_t cInt, uint8_t ipType, uint32_t ip) {
+   using namespace CryptoPP;
+ 
+       bool result = false;
+@@ -9607,7 +9607,7 @@
+               StringSource ss_Pubkey(key, keyLen,true,0);
+               Verifier pubKey(ss_Pubkey);
+ 
+-              byte bArray[MAXPUBKEYSIZE+9];
++              CryptoPP::byte bArray[MAXPUBKEYSIZE+9];
+       
+               memcpy(bArray,m_publicKey,m_publicKeyLen);
+               PokeUInt32(bArray+m_publicKeyLen,cInt); 
+diff -ur a/src/utils/lib/CryptoPP.h b/src/utils/lib/CryptoPP.h
+--- a/src/utils/lib/CryptoPP.h 2021-07-06 22:20:46.675183781 +0200
++++ b/src/utils/lib/CryptoPP.h 2021-07-06 22:20:56.271848200 +0200
+@@ -181,10 +181,9 @@
+ #     define __USE_W32_SOCKETS
+ #endif
+ 
+-typedef unsigned char byte;           // put in global namespace to avoid 
ambiguity with other byte typedefs
+-
+ NAMESPACE_BEGIN(CryptoPP)
+ 
++typedef unsigned char byte;           // put in global namespace to avoid 
ambiguity with other byte typedefs
+ typedef unsigned short word16;
+ typedef unsigned int word32;
+ 

diff --git a/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild 
b/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
index 8557ea1a285..c1bb19df5b6 100644
--- a/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
+++ b/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
@@ -51,6 +51,8 @@ DEPEND="${COMMON_DEPEND}
 
 RESTRICT="!ocamlopt? ( strip )"
 
+PATCHES=( "${FILESDIR}/cpp17-byte-namespace.patch" )
+
 S="${WORKDIR}/${P}-2"
 
 pkg_setup() {

Reply via email to