From 51ba50369d682508ca1b8842fa4331e3501bf517 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 7 Jul 2023 11:15:37 -0700 Subject: [PATCH] graphics/libecwj2: patches to compile in C++17 mode --- graphics/libecwj2/Makefile | 3 +- graphics/libecwj2/files/patch-unique_ptr | 36 +++++++++++ graphics/libecwj2/files/patch-unregister | 76 ++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 graphics/libecwj2/files/patch-unique_ptr create mode 100644 graphics/libecwj2/files/patch-unregister diff --git a/graphics/libecwj2/Makefile b/graphics/libecwj2/Makefile index b4310c6eddaeb..f42cbf860b2a5 100644 --- a/graphics/libecwj2/Makefile +++ b/graphics/libecwj2/Makefile @@ -1,6 +1,6 @@ PORTNAME= libecwj2 PORTVERSION= 3.3 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= graphics MASTER_SITES= http://glebi.us/tmp/403/ DISTFILES= ecw_jpeg_2000_sdk_3_3_source.zip @@ -17,7 +17,6 @@ LICENSE_TEXT= Registration required to download sources,\ LICENSE_PERMS= auto-accept USES= gmake libtool zip -USE_CXXSTD= c++11 USE_LDCONFIG= yes GNU_CONFIGURE= yes INSTALL_TARGET= install-strip diff --git a/graphics/libecwj2/files/patch-unique_ptr b/graphics/libecwj2/files/patch-unique_ptr new file mode 100644 index 0000000000000..a1228b6235d67 --- /dev/null +++ b/graphics/libecwj2/files/patch-unique_ptr @@ -0,0 +1,36 @@ +--- Source/include/NCSJPCNode.h.orig 2023-06-26 20:16:29.710073000 -0700 ++++ Source/include/NCSJPCNode.h 2023-06-27 06:42:55.697501000 -0700 +@@ -136,17 +136,7 @@ + CNCSError GetError(ContextID nCtx); + + protected: +- class ContextAutoPtr: public std::auto_ptr { +- public: +- ContextAutoPtr() {}; +- ContextAutoPtr(Context *s): std::auto_ptr(s) {}; +- ContextAutoPtr(const ContextAutoPtr &s) { +- ContextAutoPtr P(s.get()); +- *this = P; +- }; +- ~ContextAutoPtr() {}; +- }; +- std::map *m_pContext;/*std::auto_ptr*/ ++ std::map> *m_pContext; + + /** + * Get the context for the given ContextID +--- Source/C/NCSEcw/NCSJP2/NCSJPCNode.cpp.orig 2023-06-26 20:32:03.064056000 -0700 ++++ Source/C/NCSEcw/NCSJP2/NCSJPCNode.cpp 2023-06-26 20:59:13.970978000 -0700 +@@ -209,10 +209,9 @@ + void CNCSJPCNode::SetContext(ContextID nCtx, Context *pCtx) + { + if(!m_pContext) { +- m_pContext = new std::map; ++ m_pContext = new std::map>; + } +- ContextAutoPtr P(pCtx); +- (*m_pContext)[nCtx] = P; ++ (*m_pContext)[nCtx] = std::unique_ptr(pCtx); + }; + + CNCSJPCNode::Context::Context() diff --git a/graphics/libecwj2/files/patch-unregister b/graphics/libecwj2/files/patch-unregister new file mode 100644 index 0000000000000..80ad6fa62ef5c --- /dev/null +++ b/graphics/libecwj2/files/patch-unregister @@ -0,0 +1,76 @@ +--- Source/C/NCSEcw/NCSJP2/NCSJP2FileView.cpp.orig 2023-06-26 20:13:13.572938000 -0700 ++++ Source/C/NCSEcw/NCSJP2/NCSJP2FileView.cpp 2023-06-26 20:13:28.835768000 -0700 +@@ -2863,9 +2863,9 @@ + IEEE4 *NCS_RESTRICT pB = ppInputLines[2]; + + for(i = 0; i < nInOutSizeX; i++) { +- register IEEE4 fRed = *(pR++); +- register IEEE4 fGreen = *(pG++); +- register IEEE4 fBlue = *(pB++); ++ IEEE4 fRed = *(pR++); ++ IEEE4 fGreen = *(pG++); ++ IEEE4 fBlue = *(pB++); + + *(pY++) = ((0.299f * fRed) + (0.587f * fGreen) + (0.114f * fBlue)); + *(pU++) = ((-0.1687f * fRed) + (-0.3313f * fGreen) + (0.5f * fBlue)); +@@ -2877,9 +2877,9 @@ + UINT8 *NCS_RESTRICT pB = (UINT8*)ppInputLines[2]; + + for(i = 0; i < nInOutSizeX; i++) { +- register IEEE4 fRed = *(pR++); +- register IEEE4 fGreen = *(pG++); +- register IEEE4 fBlue = *(pB++); ++ IEEE4 fRed = *(pR++); ++ IEEE4 fGreen = *(pG++); ++ IEEE4 fBlue = *(pB++); + + *(pY++) = ((0.299f * fRed) + (0.587f * fGreen) + (0.114f * fBlue)); + *(pU++) = ((-0.1687f * fRed) + (-0.3313f * fGreen) + (0.5f * fBlue)); +--- Source/C/NCSEcw/NCSEcw/NCSHuffmanCoder.cpp.orig 2023-06-26 20:29:32.610922000 -0700 ++++ Source/C/NCSEcw/NCSEcw/NCSHuffmanCoder.cpp 2023-06-26 20:29:50.210010000 -0700 +@@ -275,7 +275,7 @@ + UINT32 nRawLength) + { + UINT8 *pOutput = pPacked; +- register UINT32 nWordCount = nRawLength / 2; ++ UINT32 nWordCount = nRawLength / 2; + + m_pTree = new CTree(); + m_pTree->Pack(&pOutput, pUnPacked, nWordCount); +@@ -311,9 +311,9 @@ + INT16 *pUnPacked, + UINT32 nRawLength) + { +- register UINT32 nWordCount = nRawLength / 2; +- register INT16 *pOutput = (INT16*)pUnPacked; +- register UINT32 nBitsUsed = 0; ++ UINT32 nWordCount = nRawLength / 2; ++ INT16 *pOutput = (INT16*)pUnPacked; ++ UINT32 nBitsUsed = 0; + + m_pTree = new CTree(&pPacked); + +@@ -330,8 +330,8 @@ + } + + if(pNode->m_Symbol.bZeroRun) { +- register UINT16 nZero; +- register UINT16 nZeroRun = pNode->m_Symbol.nValue; ++ UINT16 nZero; ++ UINT16 nZeroRun = pNode->m_Symbol.nValue; + + if( nZeroRun >= nWordCount ) { + nZero = (UINT16)nWordCount + 1; +@@ -378,9 +378,9 @@ + extern "C" NCSHuffmanSymbol *unpack_huffman_symbol(UINT8 **ppPacked, + NCSHuffmanState *pState) + { +- register UINT32 nBitsUsed = pState->nBitsUsed; +- register CNCSHuffmanCoder::CCodeNode *pNode = ((CNCSHuffmanCoder::CTree*)pState->pTree)->m_pRoot; +- register UINT8 *pEncoded = *ppPacked; ++ UINT32 nBitsUsed = pState->nBitsUsed; ++ CNCSHuffmanCoder::CCodeNode *pNode = ((CNCSHuffmanCoder::CTree*)pState->pTree)->m_pRoot; ++ UINT8 *pEncoded = *ppPacked; + + while (pNode->m_Children.m_P.m_p0Child != 0) { + pNode = pNode->m_Children.m_Children[(pEncoded[nBitsUsed >> 3] >> (nBitsUsed & 0x7)) & 0x1];