diff --git a/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp new file mode 100644 index 000000000000..e6a3d82b789c --- /dev/null +++ b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp @@ -0,0 +1,49 @@ +--- BZ2StreamScanner.cpp.orig 2024-11-03 23:01:39 UTC ++++ BZ2StreamScanner.cpp +@@ -49,8 +49,8 @@ int BZ2StreamScanner::init( int hInFile, size_t inBuff + + _hInFile = hInFile; + _eof = false; +- _bz2Header = bz2header; +- _bz2HeaderZero = bz2ZeroHeader; ++ _bz2Header.assign(begin(bz2header), end(bz2header)); ++ _bz2HeaderZero.assign(begin(bz2ZeroHeader), end(bz2ZeroHeader)); + _bz2HeaderFound = false; + _inBuffCapacity = 0; + _errState = 0; +@@ -361,7 +361,7 @@ BZ2StreamScanner::CharType * BZ2StreamScanner::locateH + _errState |= ERR_INVALID_FILE_FORMAT; + _inBuffSearchPtr = getInBuffEnd(); + } +- else if ( _bz2Header.compare( 0, prefixLen, getInBuffSearchPtr(), prefixLen ) == 0 ) ++ else if ( equal( _bz2Header.begin(), _bz2Header.begin() + prefixLen, getInBuffSearchPtr() ) ) + { + // header prefix found + } +@@ -416,7 +416,7 @@ BZ2StreamScanner::CharType * BZ2StreamScanner::searchN + while ( !failed() && ( getUnsearchedCount() >= getHeaderSize() ) ) + { + // _inBuffSearchPtr += prefixLen; +- basic_string * pHdr = NULL; ++ vector * pHdr = NULL; + + if ( getInBuffSearchPtr()[hsp] == _bz2Header[hsp] ) + { +@@ -441,13 +441,14 @@ BZ2StreamScanner::CharType * BZ2StreamScanner::searchN + (*pHdr)[prefixLen] = bwtSizeChar; + + // compare the remaining part of magic header +- int cmpres = pHdr->compare( hsp, pHdr->size() - hsp, +- getInBuffSearchPtr() + hsp, pHdr->size() - hsp ); ++ bool cmpres = equal( pHdr->begin() + hsp, pHdr->begin() + pHdr->size() - hsp, ++ getInBuffSearchPtr() ); + ++ + #ifdef PBZIP_DEBUG + fprintf( stderr, " searchNextHeaderInBuff:cmpres=%d\n", cmpres ); + #endif +- if ( cmpres == 0 ) ++ if ( cmpres ) + { + _searchStatus = true; + #ifdef PBZIP_DEBUG diff --git a/archivers/pbzip2/files/patch-BZ2StreamScanner.h b/archivers/pbzip2/files/patch-BZ2StreamScanner.h new file mode 100644 index 000000000000..e84924aac68b --- /dev/null +++ b/archivers/pbzip2/files/patch-BZ2StreamScanner.h @@ -0,0 +1,22 @@ +--- BZ2StreamScanner.h.orig 2015-12-17 23:32:49 UTC ++++ BZ2StreamScanner.h +@@ -44,7 +44,7 @@ class BZ2StreamScanner (public) + + size_t getInBuffSize() const { return ( _inBuffEnd - _inBuff ); } + size_t getInBuffCapacity() const { return _inBuffCapacity; } +- const basic_string & getHeader() const { return _bz2Header; } ++ const vector & getHeader() const { return _bz2Header; } + size_t getHeaderSize() const { return _bz2Header.size(); } + int getErrState() const { return _errState; } + bool failed() { return ( _errState != 0 ); } +@@ -125,8 +125,8 @@ class BZ2StreamScanner (public) + int _hInFile; // input file descriptor + bool _eof; + +- basic_string _bz2Header; +- basic_string _bz2HeaderZero; ++ vector _bz2Header; ++ vector _bz2HeaderZero; + bool _bz2HeaderFound; + bool _searchStatus; +