Hello community, here is the log from the commit of package unrar for openSUSE:Factory:NonFree checked in at 2019-09-02 13:26:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory:NonFree/unrar (Old) and /work/SRC/openSUSE:Factory:NonFree/.unrar.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "unrar" Mon Sep 2 13:26:57 2019 rev:81 rq:727212 version:5.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory:NonFree/unrar/unrar.changes 2019-04-30 13:06:55.885544994 +0200 +++ /work/SRC/openSUSE:Factory:NonFree/.unrar.new.7948/unrar.changes 2019-09-02 13:26:57.193294319 +0200 @@ -1,0 +2,6 @@ +Fri Aug 30 11:29:26 UTC 2019 - Ismail Dönmez <[email protected]> + +- Update to version 5.8.1 + * Based on WinRAR version 5.80 beta 1 + +------------------------------------------------------------------- Old: ---- unrarsrc-5.7.5.tar.gz New: ---- unrarsrc-5.8.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ unrar.spec ++++++ --- /var/tmp/diff_new_pack.dVAAO1/_old 2019-09-02 13:26:58.881294002 +0200 +++ /var/tmp/diff_new_pack.dVAAO1/_new 2019-09-02 13:26:58.881294002 +0200 @@ -18,10 +18,10 @@ # majorversion should match the major version number. %define majorversion 5 -%define libsuffix 5_7_5 +%define libsuffix 5_8_1 Name: unrar -Version: 5.7.5 +Version: 5.8.1 Release: 0 Summary: A program to extract, test, and view RAR archives License: NonFree ++++++ unrarsrc-5.0.5-soname.patch ++++++ --- /var/tmp/diff_new_pack.dVAAO1/_old 2019-09-02 13:26:58.909293996 +0200 +++ /var/tmp/diff_new_pack.dVAAO1/_new 2019-09-02 13:26:58.909293996 +0200 @@ -2,7 +2,7 @@ =================================================================== --- unrar.orig/makefile +++ unrar/makefile -@@ -146,7 +146,7 @@ lib: CXXFLAGS+=$(LIBFLAGS) +@@ -156,7 +156,7 @@ lib: CXXFLAGS+=$(LIBFLAGS) lib: clean $(OBJECTS) $(LIB_OBJ) @rm -f libunrar.so @rm -f libunrar.a ++++++ unrarsrc-5.7.5.tar.gz -> unrarsrc-5.8.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/arccmt.cpp new/unrar/arccmt.cpp --- old/unrar/arccmt.cpp 2019-04-27 22:05:14.000000000 +0200 +++ new/unrar/arccmt.cpp 2019-08-29 22:34:42.000000000 +0200 @@ -136,7 +136,7 @@ bool Archive::ReadCommentData(Array<wchar> *CmtData) { Array<byte> CmtRaw; - if (!ReadSubData(&CmtRaw,NULL)) + if (!ReadSubData(&CmtRaw,NULL,false)) return false; size_t CmtSize=CmtRaw.Size(); CmtRaw.Push(0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/archive.hpp new/unrar/archive.hpp --- old/unrar/archive.hpp 2019-04-27 22:05:14.000000000 +0200 +++ new/unrar/archive.hpp 2019-08-29 22:34:42.000000000 +0200 @@ -83,7 +83,7 @@ int64 GetStartPos(); void AddSubData(byte *SrcData,uint64 DataSize,File *SrcFile, const wchar *Name,uint Flags); - bool ReadSubData(Array<byte> *UnpData,File *DestFile); + bool ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode); HEADER_TYPE GetHeaderType() {return CurHeaderType;} RAROptions* GetRAROptions() {return Cmd;} void SetSilentOpen(bool Mode) {SilentOpen=Mode;} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/arcread.cpp new/unrar/arcread.cpp --- old/unrar/arcread.cpp 2019-04-27 22:05:14.000000000 +0200 +++ new/unrar/arcread.cpp 2019-08-29 22:34:42.000000000 +0200 @@ -268,14 +268,14 @@ uint FileTime=Raw.Get4(); hd->UnpVer=Raw.Get1(); - // RAR15 did not use the special dictionary size to mark dirs. - if (hd->UnpVer<20 && (hd->FileAttr & 0x10)!=0) - hd->Dir=true; - hd->Method=Raw.Get1()-0x30; size_t NameSize=Raw.Get2(); hd->FileAttr=Raw.Get4(); + // RAR15 did not use the special dictionary size to mark dirs. + if (hd->UnpVer<20 && (hd->FileAttr & 0x10)!=0) + hd->Dir=true; + hd->CryptMethod=CRYPT_NONE; if (hd->Encrypted) switch(hd->UnpVer) @@ -402,8 +402,8 @@ if (rmode & 4) rlt.Second++; rlt.Reminder=0; - int count=rmode&3; - for (int J=0;J<count;J++) + uint count=rmode&3; + for (uint J=0;J<count;J++) { byte CurByte=Raw.Get1(); rlt.Reminder|=(((uint)CurByte)<<((J+3-count)*8)); @@ -1414,7 +1414,7 @@ } -bool Archive::ReadSubData(Array<byte> *UnpData,File *DestFile) +bool Archive::ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode) { if (BrokenHeader) { @@ -1462,6 +1462,7 @@ SubDataIO.SetPackedSizeToRead(SubHead.PackSize); SubDataIO.EnableShowProgress(false); SubDataIO.SetFiles(this,DestFile); + SubDataIO.SetTestMode(TestMode); SubDataIO.UnpVolume=SubHead.SplitAfter; SubDataIO.SetSubHeader(&SubHead,NULL); Unpack.SetDestSize(SubHead.UnpSize); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/blake2s.hpp new/unrar/blake2s.hpp --- old/unrar/blake2s.hpp 2019-04-27 22:05:14.000000000 +0200 +++ new/unrar/blake2s.hpp 2019-08-29 22:34:42.000000000 +0200 @@ -3,6 +3,7 @@ #define _RAR_BLAKE2_ #define BLAKE2_DIGEST_SIZE 32 +#define BLAKE2_THREADS_NUMBER 8 enum blake2s_constant { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/cmddata.cpp new/unrar/cmddata.cpp --- old/unrar/cmddata.cpp 2019-04-27 22:05:15.000000000 +0200 +++ new/unrar/cmddata.cpp 2019-08-29 22:34:42.000000000 +0200 @@ -295,10 +295,13 @@ if (Switch[2]=='-' && Switch[3]==0) GenerateArcName=0; else - { - GenerateArcName=true; - wcsncpyz(GenerateMask,Switch+2,ASIZE(GenerateMask)); - } + if (toupperw(Switch[2])=='F') + wcsncpyz(DefGenerateMask,Switch+3,ASIZE(DefGenerateMask)); + else + { + GenerateArcName=true; + wcsncpyz(GenerateMask,Switch+2,ASIZE(GenerateMask)); + } break; #endif case 'I': @@ -373,11 +376,11 @@ default: if (Switch[1]=='+') { - InclFileAttr|=GetExclAttr(Switch+2); + InclFileAttr|=GetExclAttr(Switch+2,InclDir); InclAttrSet=true; } else - ExclFileAttr|=GetExclAttr(Switch+1); + ExclFileAttr|=GetExclAttr(Switch+1,ExclDir); break; } break; @@ -825,39 +828,7 @@ SetTimeFilters(Switch+2,false,false); break; case 'S': - { - EXTTIME_MODE Mode=EXTTIME_HIGH3; - bool CommonMode=Switch[2]>='0' && Switch[2]<='4'; - if (CommonMode) - Mode=(EXTTIME_MODE)(Switch[2]-'0'); - if (Mode==EXTTIME_HIGH1 || Mode==EXTTIME_HIGH2) // '2' and '3' not supported anymore. - Mode=EXTTIME_HIGH3; - if (Switch[2]=='-') - Mode=EXTTIME_NONE; - if (CommonMode || Switch[2]=='-' || Switch[2]=='+' || Switch[2]==0) - xmtime=xctime=xatime=Mode; - else - { - if (Switch[3]>='0' && Switch[3]<='4') - Mode=(EXTTIME_MODE)(Switch[3]-'0'); - if (Mode==EXTTIME_HIGH1 || Mode==EXTTIME_HIGH2) // '2' and '3' not supported anymore. - Mode=EXTTIME_HIGH3; - if (Switch[3]=='-') - Mode=EXTTIME_NONE; - switch(toupperw(Switch[2])) - { - case 'M': - xmtime=Mode; - break; - case 'C': - xctime=Mode; - break; - case 'A': - xatime=Mode; - break; - } - } - } + SetStoreTimeMode(Switch+2); break; case '-': Test=false; @@ -960,7 +931,10 @@ if (wcschr(L"AFUMD",*Command)==NULL) { if (GenerateArcName) - GenerateArchiveName(ArcName,ASIZE(ArcName),GenerateMask,false); + { + const wchar *Mask=*GenerateMask!=0 ? GenerateMask:DefGenerateMask; + GenerateArchiveName(ArcName,ASIZE(ArcName),Mask,false); + } StringList ArcMasks; ArcMasks.AddString(ArcName); @@ -1022,7 +996,7 @@ #ifndef SFX_MODULE -uint CommandData::GetExclAttr(const wchar *Str) +uint CommandData::GetExclAttr(const wchar *Str,bool &Dir) { if (IsDigit(*Str)) return wcstol(Str,NULL,0); @@ -1032,10 +1006,10 @@ { switch(toupperw(*Str)) { -#ifdef _UNIX case 'D': - Attr|=S_IFDIR; + Dir=true; break; +#ifdef _UNIX case 'V': Attr|=S_IFCHR; break; @@ -1049,9 +1023,6 @@ case 'S': Attr|=0x4; break; - case 'D': - Attr|=0x10; - break; case 'A': Attr|=0x20; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/cmddata.hpp new/unrar/cmddata.hpp --- old/unrar/cmddata.hpp 2019-04-27 22:05:15.000000000 +0200 +++ new/unrar/cmddata.hpp 2019-08-29 22:34:42.000000000 +0200 @@ -14,9 +14,10 @@ void ProcessSwitchesString(const wchar *Str); void ProcessSwitch(const wchar *Switch); void BadSwitch(const wchar *Switch); - uint GetExclAttr(const wchar *Str); + uint GetExclAttr(const wchar *Str,bool &Dir); #if !defined(SFX_MODULE) void SetTimeFilters(const wchar *Mod,bool Before,bool Age); + void SetStoreTimeMode(const wchar *S); #endif bool FileLists; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/cmdfilter.cpp new/unrar/cmdfilter.cpp --- old/unrar/cmdfilter.cpp 2019-04-27 22:05:15.000000000 +0200 +++ new/unrar/cmdfilter.cpp 2019-08-29 22:34:42.000000000 +0200 @@ -285,7 +285,10 @@ #ifndef SFX_MODULE if (TimeCheck(FileHead.mtime,FileHead.ctime,FileHead.atime)) return 0; - if ((FileHead.FileAttr & ExclFileAttr)!=0 || InclAttrSet && (FileHead.FileAttr & InclFileAttr)==0) + if ((FileHead.FileAttr & ExclFileAttr)!=0 || FileHead.Dir && ExclDir) + return 0; + if (InclAttrSet && (!FileHead.Dir && (FileHead.FileAttr & InclFileAttr)==0 || + FileHead.Dir && !InclDir)) return 0; if (!Dir && SizeCheck(FileHead.UnpSize)) return 0; @@ -303,3 +306,47 @@ } return 0; } + + +#if !defined(SFX_MODULE) +void CommandData::SetStoreTimeMode(const wchar *S) +{ + if (*S==0 || IsDigit(*S) || *S=='-' || *S=='+') + { + // Apply -ts, -ts1, -ts-, -ts+ to all 3 times. + // Handle obsolete -ts[2,3,4] as ts+. + EXTTIME_MODE Mode=EXTTIME_MAX; + if (*S=='-') + Mode=EXTTIME_NONE; + if (*S=='1') + Mode=EXTTIME_1S; + xmtime=xctime=xatime=Mode; + S++; + } + + while (*S!=0) + { + EXTTIME_MODE Mode=EXTTIME_MAX; + if (S[1]=='-') + Mode=EXTTIME_NONE; + if (S[1]=='1') + Mode=EXTTIME_1S; + switch(toupperw(*S)) + { + case 'M': + xmtime=Mode; + break; + case 'C': + xctime=Mode; + break; + case 'A': + xatime=Mode; + break; + case 'P': + PreserveAtime=true; + break; + } + S++; + } +} +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/dll.rc new/unrar/dll.rc --- old/unrar/dll.rc 2019-04-27 21:56:58.000000000 +0200 +++ new/unrar/dll.rc 2019-08-29 21:35:30.000000000 +0200 @@ -2,8 +2,8 @@ #include <commctrl.h> VS_VERSION_INFO VERSIONINFO -FILEVERSION 5, 71, 100, 3045 -PRODUCTVERSION 5, 71, 100, 3045 +FILEVERSION 5, 80, 1, 3169 +PRODUCTVERSION 5, 80, 1, 3169 FILEOS VOS__WINDOWS32 FILETYPE VFT_APP { @@ -14,8 +14,8 @@ VALUE "CompanyName", "Alexander Roshal\0" VALUE "ProductName", "RAR decompression library\0" VALUE "FileDescription", "RAR decompression library\0" - VALUE "FileVersion", "5.71.0\0" - VALUE "ProductVersion", "5.71.0\0" + VALUE "FileVersion", "5.80.1\0" + VALUE "ProductVersion", "5.80.1\0" VALUE "LegalCopyright", "Copyright � Alexander Roshal 1993-2019\0" VALUE "OriginalFilename", "Unrar.dll\0" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/file.cpp new/unrar/file.cpp --- old/unrar/file.cpp 2019-04-27 22:05:16.000000000 +0200 +++ new/unrar/file.cpp 2019-08-29 22:34:43.000000000 +0200 @@ -13,6 +13,7 @@ OpenShared=false; AllowDelete=true; AllowExceptions=true; + PreserveAtime=false; #ifdef _WIN_ALL NoSequentialRead=false; CreateMode=FMF_UNDEFINED; @@ -56,6 +57,9 @@ if (OpenShared) ShareMode|=FILE_SHARE_WRITE; uint Flags=NoSequentialRead ? 0:FILE_FLAG_SEQUENTIAL_SCAN; + FindData FD; + if (PreserveAtime) + Access|=FILE_WRITE_ATTRIBUTES; // Needed to preserve atime. hNewFile=CreateFile(Name,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); DWORD LastError; @@ -86,6 +90,11 @@ } if (hNewFile==FILE_BAD_HANDLE && LastError==ERROR_FILE_NOT_FOUND) ErrorType=FILE_NOTFOUND; + if (PreserveAtime && hNewFile!=FILE_BAD_HANDLE) + { + FILETIME ft={0xffffffff,0xffffffff}; // This value prevents atime modification. + SetFileTime(hNewFile,NULL,&ft,NULL); + } #else int flags=UpdateMode ? O_RDWR:(WriteMode ? O_WRONLY:O_RDONLY); @@ -95,6 +104,11 @@ flags|=O_LARGEFILE; #endif #endif + // NDK r20 has O_NOATIME, but fails to create files with it in Android 7+. +#if defined(O_NOATIME) + if (PreserveAtime) + flags|=O_NOATIME; +#endif char NameA[NM]; WideToChar(Name,NameA,ASIZE(NameA)); @@ -230,7 +244,7 @@ { #ifdef _WIN_ALL // We use the standard system handle for stdout in Windows - // and it must not be closed here. + // and it must not be closed here. if (HandleType==FILE_HANDLENORMAL) Success=CloseHandle(hFile)==TRUE; #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/file.hpp new/unrar/file.hpp --- old/unrar/file.hpp 2019-04-27 22:05:16.000000000 +0200 +++ new/unrar/file.hpp 2019-08-29 22:34:43.000000000 +0200 @@ -62,6 +62,7 @@ bool NoSequentialRead; uint CreateMode; #endif + bool PreserveAtime; protected: bool OpenShared; // Set by 'Archive' class. public: @@ -114,6 +115,7 @@ #ifdef _WIN_ALL void RemoveSequentialFlag() {NoSequentialRead=true;} #endif + void SetPreserveAtime(bool Preserve) {PreserveAtime=Preserve;} #ifdef _UNIX int GetFD() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/find.cpp new/unrar/find.cpp --- old/unrar/find.cpp 2019-04-27 22:05:17.000000000 +0200 +++ new/unrar/find.cpp 2019-08-29 22:34:43.000000000 +0200 @@ -63,12 +63,12 @@ } while (1) { + wchar Name[NM]; struct dirent *ent=readdir(dirp); if (ent==NULL) return false; if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0) continue; - wchar Name[NM]; if (!CharToWide(ent->d_name,Name,ASIZE(Name))) uiMsg(UIERROR_INVALIDNAME,UINULL,Name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/hash.cpp new/unrar/hash.cpp --- old/unrar/hash.cpp 2019-04-27 22:05:17.000000000 +0200 +++ new/unrar/hash.cpp 2019-08-29 22:34:43.000000000 +0200 @@ -53,7 +53,7 @@ DataHash::~DataHash() { #ifdef RAR_SMP - DestroyThreadPool(ThPool); + delete ThPool; #endif cleandata(&CurCRC32, sizeof(CurCRC32)); if (blake2ctx!=NULL) @@ -94,7 +94,7 @@ { #ifdef RAR_SMP if (MaxThreads>1 && ThPool==NULL) - ThPool=CreateThreadPool(); + ThPool=new ThreadPool(BLAKE2_THREADS_NUMBER); blake2ctx->ThPool=ThPool; blake2ctx->MaxThreads=MaxThreads; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/list.cpp new/unrar/list.cpp --- old/unrar/list.cpp 2019-04-27 22:05:18.000000000 +0200 +++ new/unrar/list.cpp 2019-08-29 22:34:43.000000000 +0200 @@ -345,7 +345,7 @@ mprintf(L"\n%12ls: %ls",St(MListHostOS),HostOS); mprintf(L"\n%12ls: RAR %ls(v%d) -m%d -md=%d%s",St(MListCompInfo), - Format==RARFMT15 ? L"3.0":L"5.0", + Format==RARFMT15 ? L"1.5":L"5.0", hd.UnpVer==VER_UNKNOWN ? 0 : hd.UnpVer,hd.Method, hd.WinSize>=0x100000 ? hd.WinSize/0x100000:hd.WinSize/0x400, hd.WinSize>=0x100000 ? L"M":L"K"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/loclang.hpp new/unrar/loclang.hpp --- old/unrar/loclang.hpp 2019-04-27 22:05:18.000000000 +0200 +++ new/unrar/loclang.hpp 2019-08-29 22:34:43.000000000 +0200 @@ -131,7 +131,7 @@ #define MCHelpSwTO L"\n to[mcao]<t> Process files older than <t> time" #define MCHelpSwTA L"\n ta[mcao]<d> Process files modified after <d> YYYYMMDDHHMMSS date" #define MCHelpSwTB L"\n tb[mcao]<d> Process files modified before <d> YYYYMMDDHHMMSS date" -#define MCHelpSwTS L"\n ts[m,c,a] Save or restore file time (modification, creation, access)" +#define MCHelpSwTS L"\n ts[m,c,a,p] Save or restore time (modification, creation, access, preserve)" #define MCHelpSwU L"\n u Update files" #define MCHelpSwV L"\n v Create volumes with size autodetection or list all volumes" #define MCHelpSwVUnr L"\n v List all volumes" @@ -203,7 +203,6 @@ #define MErrOpenFile L"file" #define MAddNoFiles L"\nWARNING: No files" #define MMdfEncrSol L"\n%s: encrypted" -#define MCannotMdfEncrSol L"\nCannot modify solid archive containing encrypted files" #define MAddAnalyze L"\nAnalyzing archived files: " #define MRepacking L"\nRepacking archived files: " #define MCRCFailed L"\n%-20s - checksum error" @@ -342,7 +341,7 @@ #define MFAT32Size L"\nWARNING: FAT32 file system does not support 4 GB or larger files" #define MErrChangeAttr L"\nWARNING: Cannot change attributes of %s" #define MWrongSFXVer L"\nERROR: default SFX module does not support RAR %d.%d archives" -#define MCannotEncName L"\nCannot encrypt archive already containing encrypted files" +#define MHeadEncMismatch L"\nCannot change the header encryption mode in already encrypted archive" #define MCannotEmail L"\nCannot email the file %s" #define MCopyrightS L"\nRAR SFX archive" #define MSHelpCmd L"\n\n<Commands>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/options.cpp new/unrar/options.cpp --- old/unrar/options.cpp 2019-04-27 22:05:18.000000000 +0200 +++ new/unrar/options.cpp 2019-08-29 22:34:43.000000000 +0200 @@ -22,7 +22,7 @@ Method=3; MsgStream=MSG_STDOUT; ConvertNames=NAMES_ORIGINALCASE; - xmtime=EXTTIME_HIGH3; + xmtime=EXTTIME_MAX; FileSizeLess=INT64NDF; FileSizeMore=INT64NDF; HashType=HASH_CRC32; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/options.hpp new/unrar/options.hpp --- old/unrar/options.hpp 2019-04-27 22:05:18.000000000 +0200 +++ new/unrar/options.hpp 2019-08-29 22:34:43.000000000 +0200 @@ -21,7 +21,7 @@ enum {ARCTIME_NONE=0,ARCTIME_KEEP,ARCTIME_LATEST}; enum EXTTIME_MODE { - EXTTIME_NONE=0,EXTTIME_1S,EXTTIME_HIGH1,EXTTIME_HIGH2,EXTTIME_HIGH3 + EXTTIME_NONE=0,EXTTIME_1S,EXTTIME_MAX }; enum {NAMES_ORIGINALCASE=0,NAMES_UPPERCASE,NAMES_LOWERCASE}; @@ -92,6 +92,12 @@ uint ExclFileAttr; uint InclFileAttr; + + // We handle -ed and -e+d with special flags instead of attribute mask, + // so it works with both Windows and Unix archives. + bool ExclDir; + bool InclDir; + bool InclAttrSet; size_t WinSize; wchar TempPath[NM]; @@ -162,6 +168,7 @@ #ifndef SFX_MODULE bool GenerateArcName; wchar GenerateMask[MAX_GENERATE_MASK]; + wchar DefGenerateMask[MAX_GENERATE_MASK]; #endif bool SyncFiles; bool ProcessEA; @@ -185,6 +192,7 @@ EXTTIME_MODE xmtime; // Extended time modes (time precision to store). EXTTIME_MODE xctime; EXTTIME_MODE xatime; + bool PreserveAtime; wchar CompressStdin[NM]; uint Threads; // We use it to init hash even if RAR_SMP is not defined. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/recvol.cpp new/unrar/recvol.cpp --- old/unrar/recvol.cpp 2019-04-27 22:05:19.000000000 +0200 +++ new/unrar/recvol.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -31,12 +31,12 @@ // handling exceptions. So it can close and delete files on Cancel. if (Fmt==RARFMT15) { - RecVolumes3 RecVol(false); + RecVolumes3 RecVol(Cmd,false); return RecVol.Restore(Cmd,Name,Silent); } else { - RecVolumes5 RecVol(false); + RecVolumes5 RecVol(Cmd,false); return RecVol.Restore(Cmd,Name,Silent); } } @@ -100,12 +100,12 @@ RevFile.Close(); if (Rev5) { - RecVolumes5 RecVol(true); + RecVolumes5 RecVol(Cmd,true); RecVol.Test(Cmd,Name); } else { - RecVolumes3 RecVol(true); + RecVolumes3 RecVol(Cmd,true); RecVol.Test(Cmd,Name); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/recvol.hpp new/unrar/recvol.hpp --- old/unrar/recvol.hpp 2019-04-27 22:05:19.000000000 +0200 +++ new/unrar/recvol.hpp 2019-08-29 22:34:44.000000000 +0200 @@ -14,7 +14,7 @@ ThreadPool *RSThreadPool; #endif public: - RecVolumes3(bool TestOnly); + RecVolumes3(RAROptions *Cmd,bool TestOnly); ~RecVolumes3(); void Make(RAROptions *Cmd,wchar *ArcName); bool Restore(RAROptions *Cmd,const wchar *Name,bool Silent); @@ -71,11 +71,12 @@ #ifdef RAR_SMP ThreadPool *RecThreadPool; #endif - RecRSThreadData ThreadData[MaxPoolThreads]; // Store thread parameters. + uint MaxUserThreads; // Maximum number of threads defined by user. + RecRSThreadData *ThreadData; // Array to store thread parameters. public: // 'public' only because called from thread functions. void ProcessAreaRS(RecRSThreadData *td); public: - RecVolumes5(bool TestOnly); + RecVolumes5(RAROptions *Cmd,bool TestOnly); ~RecVolumes5(); bool Restore(RAROptions *Cmd,const wchar *Name,bool Silent); void Test(RAROptions *Cmd,const wchar *Name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/recvol3.cpp new/unrar/recvol3.cpp --- old/unrar/recvol3.cpp 2019-04-27 22:05:19.000000000 +0200 +++ new/unrar/recvol3.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -36,7 +36,7 @@ } #endif -RecVolumes3::RecVolumes3(bool TestOnly) +RecVolumes3::RecVolumes3(RAROptions *Cmd,bool TestOnly) { memset(SrcFile,0,sizeof(SrcFile)); if (TestOnly) @@ -50,7 +50,7 @@ Buf.Alloc(TotalBufferSize); memset(SrcFile,0,sizeof(SrcFile)); #ifdef RAR_SMP - RSThreadPool=CreateThreadPool(); + RSThreadPool=new ThreadPool(Cmd->Threads); #endif } } @@ -61,7 +61,7 @@ for (size_t I=0;I<ASIZE(SrcFile);I++) delete SrcFile[I]; #ifdef RAR_SMP - DestroyThreadPool(RSThreadPool); + delete RSThreadPool; #endif } @@ -363,11 +363,10 @@ #ifdef RAR_SMP uint ThreadNumber=Cmd->Threads; - RSEncode rse[MaxPoolThreads]; #else uint ThreadNumber=1; - RSEncode rse[1]; #endif + RSEncode *rse=new RSEncode[ThreadNumber]; for (uint I=0;I<ThreadNumber;I++) rse[I].Init(RecVolNumber); @@ -438,6 +437,8 @@ if (WriteFlags[I]) SrcFile[I]->Write(&Buf[I*RecBufferSize],MaxRead); } + delete[] rse; + for (int I=0;I<RecVolNumber+FileNumber;I++) if (SrcFile[I]!=NULL) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/recvol5.cpp new/unrar/recvol5.cpp --- old/unrar/recvol5.cpp 2019-04-27 22:05:19.000000000 +0200 +++ new/unrar/recvol5.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -1,6 +1,6 @@ static const uint MaxVolumes=65535; -RecVolumes5::RecVolumes5(bool TestOnly) +RecVolumes5::RecVolumes5(RAROptions *Cmd,bool TestOnly) { RealBuf=NULL; RealReadBuffer=NULL; @@ -10,7 +10,14 @@ TotalCount=0; RecBufferSize=0; - for (uint I=0;I<ASIZE(ThreadData);I++) +#ifdef RAR_SMP + MaxUserThreads=Cmd->Threads; +#else + MaxUserThreads=1; +#endif + + ThreadData=new RecRSThreadData[MaxUserThreads]; + for (uint I=0;I<MaxUserThreads;I++) { ThreadData[I].RecRSPtr=this; ThreadData[I].RS=NULL; @@ -25,7 +32,7 @@ else { #ifdef RAR_SMP - RecThreadPool=CreateThreadPool(); + RecThreadPool=new ThreadPool(MaxUserThreads); #endif RealBuf=new byte[TotalBufferSize+SSE_ALIGNMENT]; Buf=(byte *)ALIGN_VALUE(RealBuf,SSE_ALIGNMENT); @@ -39,10 +46,11 @@ delete[] RealReadBuffer; for (uint I=0;I<RecItems.Size();I++) delete RecItems[I].f; - for (uint I=0;I<ASIZE(ThreadData);I++) + for (uint I=0;I<MaxUserThreads;I++) delete ThreadData[I].RS; + delete[] ThreadData; #ifdef RAR_SMP - DestroyThreadPool(RecThreadPool); + delete RecThreadPool; #endif } @@ -68,11 +76,7 @@ RS.UpdateECC(DataNum, I, Data, Buf+I*RecBufferSize, MaxRead); */ -#ifdef RAR_SMP - uint ThreadNumber=Cmd->Threads; -#else - uint ThreadNumber=1; -#endif + uint ThreadNumber=MaxUserThreads; const uint MinThreadBlock=0x1000; ThreadNumber=Min(ThreadNumber,MaxRead/MinThreadBlock); @@ -238,7 +242,7 @@ uiMsg(UIMSG_STRING,Item->Name); uint RevCRC; - CalcFileSum(Item->f,&RevCRC,NULL,Cmd->Threads,INT64NDF,CALCFSUM_CURPOS); + CalcFileSum(Item->f,&RevCRC,NULL,MaxUserThreads,INT64NDF,CALCFSUM_CURPOS); Item->Valid=RevCRC==Item->CRC; if (!Item->Valid) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/rijndael.cpp new/unrar/rijndael.cpp --- old/unrar/rijndael.cpp 2019-04-27 22:05:20.000000000 +0200 +++ new/unrar/rijndael.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -75,8 +75,14 @@ // Check SSE here instead of constructor, so if object is a part of some // structure memset'ed before use, this variable is not lost. int CPUInfo[4]; - __cpuid(CPUInfo, 1); - AES_NI=(CPUInfo[2] & 0x2000000)!=0; + __cpuid(CPUInfo, 0x80000000); // Get the maximum supported cpuid function. + if ((CPUInfo[0] & 0x7fffffff)>=1) + { + __cpuid(CPUInfo, 1); + AES_NI=(CPUInfo[2] & 0x2000000)!=0; + } + else + AES_NI=0; #endif // Other developers asked us to initialize it to suppress "may be used diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/system.cpp new/unrar/system.cpp --- old/unrar/system.cpp 2019-04-27 22:05:21.000000000 +0200 +++ new/unrar/system.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -187,18 +187,27 @@ SSE_VERSION GetSSEVersion() { int CPUInfo[4]; - __cpuid(CPUInfo, 7); - if ((CPUInfo[1] & 0x20)!=0) - return SSE_AVX2; - __cpuid(CPUInfo, 1); - if ((CPUInfo[2] & 0x80000)!=0) - return SSE_SSE41; - if ((CPUInfo[2] & 0x200)!=0) - return SSE_SSSE3; - if ((CPUInfo[3] & 0x4000000)!=0) - return SSE_SSE2; - if ((CPUInfo[3] & 0x2000000)!=0) - return SSE_SSE; + __cpuid(CPUInfo, 0x80000000); + uint MaxSupported=CPUInfo[0] & 0x7fffffff; // Maximum supported cpuid function. + + if (MaxSupported>=7) + { + __cpuid(CPUInfo, 7); + if ((CPUInfo[1] & 0x20)!=0) + return SSE_AVX2; + } + if (MaxSupported>=1) + { + __cpuid(CPUInfo, 1); + if ((CPUInfo[2] & 0x80000)!=0) + return SSE_SSE41; + if ((CPUInfo[2] & 0x200)!=0) + return SSE_SSSE3; + if ((CPUInfo[3] & 0x4000000)!=0) + return SSE_SSE2; + if ((CPUInfo[3] & 0x2000000)!=0) + return SSE_SSE; + } return SSE_NONE; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/threadmisc.cpp new/unrar/threadmisc.cpp --- old/unrar/threadmisc.cpp 2019-04-27 22:05:21.000000000 +0200 +++ new/unrar/threadmisc.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -1,7 +1,3 @@ -// Typically we use the same global thread pool for all RAR modules. -static ThreadPool *GlobalPool=NULL; -static uint GlobalPoolUseCount=0; - static inline bool CriticalSectionCreate(CRITSECT_HANDLE *CritSection) { #ifdef _WIN_ALL @@ -43,53 +39,6 @@ } -static struct GlobalPoolCreateSync -{ - CRITSECT_HANDLE CritSection; - GlobalPoolCreateSync() { CriticalSectionCreate(&CritSection); } - ~GlobalPoolCreateSync() { CriticalSectionDelete(&CritSection); } -} PoolCreateSync; - - -ThreadPool* CreateThreadPool() -{ -#ifdef RARDLL - // We use a simple thread pool, which does not allow to add tasks from - // different functions and threads in the same time. It is ok for RAR, - // but UnRAR.dll can be used in multithreaded environment. So we return - // a new pool for UnRAR.dll every time. - return new ThreadPool(MaxPoolThreads); -#else - // Reuse the existing pool for RAR. - CriticalSectionStart(&PoolCreateSync.CritSection); - - if (GlobalPoolUseCount++ == 0) - GlobalPool=new ThreadPool(MaxPoolThreads); - - CriticalSectionEnd(&PoolCreateSync.CritSection); - return GlobalPool; -#endif -} - - -void DestroyThreadPool(ThreadPool *Pool) -{ - if (Pool!=NULL) - { -#ifdef RARDLL - delete Pool; -#else - CriticalSectionStart(&PoolCreateSync.CritSection); - - if (Pool==GlobalPool && GlobalPoolUseCount > 0 && --GlobalPoolUseCount == 0) - delete GlobalPool; - - CriticalSectionEnd(&PoolCreateSync.CritSection); -#endif - } -} - - static THREAD_HANDLE ThreadCreate(NATIVE_THREAD_PTR Proc,void *Data) { #ifdef _UNIX diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/threadpool.hpp new/unrar/threadpool.hpp --- old/unrar/threadpool.hpp 2019-04-27 22:05:21.000000000 +0200 +++ new/unrar/threadpool.hpp 2019-08-29 22:34:44.000000000 +0200 @@ -98,9 +98,6 @@ #endif }; -ThreadPool* CreateThreadPool(); -void DestroyThreadPool(ThreadPool *Pool); - #endif // RAR_SMP #endif // _RAR_THREADPOOL_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/ui.hpp new/unrar/ui.hpp --- old/unrar/ui.hpp 2019-04-27 22:05:21.000000000 +0200 +++ new/unrar/ui.hpp 2019-08-29 22:34:44.000000000 +0200 @@ -20,7 +20,7 @@ UIERROR_SUBHEADERDATABROKEN, UIERROR_RRDAMAGED, UIERROR_UNKNOWNMETHOD, UIERROR_UNKNOWNENCMETHOD, UIERROR_RENAMING, UIERROR_NEWERRAR, UIERROR_NOTSFX, UIERROR_OLDTOSFX, - UIERROR_WRONGSFXVER, UIERROR_ALREADYENC, UIERROR_DICTOUTMEM, + UIERROR_WRONGSFXVER, UIERROR_HEADENCMISMATCH, UIERROR_DICTOUTMEM, UIERROR_USESMALLERDICT, UIERROR_MODIFYUNKNOWN, UIERROR_MODIFYOLD, UIERROR_MODIFYLOCKED, UIERROR_MODIFYVOLUME, UIERROR_NOTVOLUME, UIERROR_NOTFIRSTVOLUME, UIERROR_RECVOLLIMIT, UIERROR_RECVOLDIFFSETS, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/unpack.cpp new/unrar/unpack.cpp --- old/unrar/unpack.cpp 2019-04-27 22:05:22.000000000 +0200 +++ new/unrar/unpack.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -26,7 +26,7 @@ UnpSomeRead=false; #ifdef RAR_SMP MaxUserThreads=1; - UnpThreadPool=CreateThreadPool(); + UnpThreadPool=NULL; ReadBufMT=NULL; UnpThreadData=NULL; #endif @@ -52,13 +52,24 @@ if (Window!=NULL) free(Window); #ifdef RAR_SMP - DestroyThreadPool(UnpThreadPool); + delete UnpThreadPool; delete[] ReadBufMT; delete[] UnpThreadData; #endif } +#ifdef RAR_SMP +void Unpack::SetThreads(uint Threads) +{ + // More than 8 threads are unlikely to provide noticeable gain + // for unpacking, but would use the additional memory. + MaxUserThreads=Min(Threads,8); + UnpThreadPool=new ThreadPool(MaxUserThreads); +} +#endif + + void Unpack::Init(size_t WinSize,bool Solid) { // If 32-bit RAR unpacks an archive with 4 GB dictionary, the window size diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/unpack.hpp new/unrar/unpack.hpp --- old/unrar/unpack.hpp 2019-04-27 22:05:22.000000000 +0200 +++ new/unrar/unpack.hpp 2019-08-29 22:34:44.000000000 +0200 @@ -382,10 +382,7 @@ void SetSuspended(bool Suspended) {Unpack::Suspended=Suspended;} #ifdef RAR_SMP - // More than 8 threads are unlikely to provide a noticeable gain - // for unpacking, but would use the additional memory. - void SetThreads(uint Threads) {MaxUserThreads=Min(Threads,8);} - + void SetThreads(uint Threads); void UnpackDecode(UnpackThreadData &D); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/version.hpp new/unrar/version.hpp --- old/unrar/version.hpp 2019-04-27 22:05:22.000000000 +0200 +++ new/unrar/version.hpp 2019-08-29 22:34:44.000000000 +0200 @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 -#define RARVER_MINOR 71 -#define RARVER_BETA 0 -#define RARVER_DAY 28 -#define RARVER_MONTH 4 +#define RARVER_MINOR 80 +#define RARVER_BETA 1 +#define RARVER_DAY 30 +#define RARVER_MONTH 8 #define RARVER_YEAR 2019 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/win32acl.cpp new/unrar/win32acl.cpp --- old/unrar/win32acl.cpp 2019-04-27 22:05:22.000000000 +0200 +++ new/unrar/win32acl.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -67,7 +67,7 @@ void ExtractACL(Archive &Arc,const wchar *FileName) { Array<byte> SubData; - if (!Arc.ReadSubData(&SubData,NULL)) + if (!Arc.ReadSubData(&SubData,NULL,false)) return; SetACLPrivileges(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/win32stm.cpp new/unrar/win32stm.cpp --- old/unrar/win32stm.cpp 2019-04-27 22:05:23.000000000 +0200 +++ new/unrar/win32stm.cpp 2019-08-29 22:34:44.000000000 +0200 @@ -104,7 +104,8 @@ if (TestMode) { - Arc.ReadSubData(NULL,NULL); + File CurFile; + Arc.ReadSubData(NULL,&CurFile,true); return; } @@ -116,7 +117,7 @@ if ((fd.FileAttr & FILE_ATTRIBUTE_READONLY)!=0) SetFileAttr(FileName,fd.FileAttr & ~FILE_ATTRIBUTE_READONLY); File CurFile; - if (CurFile.WCreate(FullName) && Arc.ReadSubData(NULL,&CurFile)) + if (CurFile.WCreate(FullName) && Arc.ReadSubData(NULL,&CurFile,false)) CurFile.Close(); File HostFile; if (Found && HostFile.Open(FileName,FMF_OPENSHARED|FMF_UPDATE))
