From ca4bd0c38770e9ef5a28ea85def949f7057c8735 Mon Sep 17 00:00:00 2001 From: Force Charlie Date: Sat, 9 Dec 2023 16:14:59 +0800 Subject: [PATCH] unrar 7.0.4 --- CMakeLists.txt | 2 +- unrar/cmdfilter.cpp | 32 ++++++++++++++++++++------------ unrar/dll.rc | 8 ++++---- unrar/list.cpp | 2 +- unrar/loclang.hpp | 3 ++- unrar/makefile | 2 +- unrar/pathfn.cpp | 27 ++++++++++++++------------- unrar/rardefs.hpp | 4 ++++ unrar/scantree.cpp | 2 +- unrar/ui.hpp | 17 +++++++++-------- unrar/version.hpp | 4 ++-- 11 files changed, 59 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a44aa66..bacba04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ endif() set(UNRAR_VERSION_MAJOR 7) set(UNRAR_VERSION_MINOR 0) -set(UNRAR_VERSION_PATCH 3) +set(UNRAR_VERSION_PATCH 4) set(PACKAGE_VERSION "${UNRAR_VERSION_MAJOR}.${UNRAR_VERSION_MINOR}.${UNRAR_VERSION_PATCH}") string(TOLOWER "${CMAKE_C_COMPILER_ARCHITECTURE_ID}" UNRAR_ARCH_NAME) diff --git a/unrar/cmdfilter.cpp b/unrar/cmdfilter.cpp index 2a6ff6e..c20d8d6 100644 --- a/unrar/cmdfilter.cpp +++ b/unrar/cmdfilter.cpp @@ -35,20 +35,28 @@ bool CommandData::CheckArgs(StringList *Args,bool Dir,const std::wstring &CheckN } else { + // This code doesn't allow to apply -n and -x wildcard masks without + // trailing slash to folders unless these masks are * and *.*. + // See the changes history below. // 2023.03.26: Previously we removed this code completely to let - // -npath\* include empty folders in 'path' too. But then we received - // an email from user not willing -x*.avi to exclude folders like - // dir.avi with non-avi files. Also rar.txt mentions that masks like - // *.avi exclude only files. Initially we wanted masks like -npath\* - // or -xpath\* to match the entire contents of path including empty - // folders and added the special check for "*" and "*.*". - // But this is not very straightforward, when *.* and *.avi are - // processed differently, especially taking into account that - // we can specify the exact folder name without wildcards to process - // it and masks like 'dir*\' can be used to exclude folders. - // So we decided to skip all usual wildcard masks for folders. + // 'rar a arc dir -ndir\path\*' include empty folders in 'path' too. + // But then we received an email from user not willing -x*.avi to + // exclude folders like dir.avi with non-avi files. Also rar.txt + // mentions that masks like *.avi exclude only files. Initially + // we wanted masks like -npath\* or -xpath\* to match the entire + // contents of path including empty folders and added the special + // check for "*" and "*.*". But this is not very straightforward, + // when *.* and *.avi are processed differently, especially taking + // into account that we can specify the exact folder name without + // wildcards to process it and masks like 'dir*\' can be used to + // exclude folders. So we decided to skip all usual wildcard masks + // for folders. + // 2023.11.22: We returned the special check for "*" and "*.*", + // because users expected 'rar a arc dir -xdir\*' to exclude + // everything including subfolders in 'dir'. For now we returned it + // both for -n and -x, but we can limit it to -x only if needed. std::wstring Name=PointToName(CurMask); - if (IsWildcard(Name)/* && wcscmp(Name,L"*")!=0 && wcscmp(Name,L"*.*")!=0*/) + if (IsWildcard(Name) && Name!=L"*" && Name!=L"*.*") continue; } } diff --git a/unrar/dll.rc b/unrar/dll.rc index 3931d44..26d5e24 100644 --- a/unrar/dll.rc +++ b/unrar/dll.rc @@ -2,8 +2,8 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7, 0, 1, 1043 -PRODUCTVERSION 7, 0, 1, 1043 +FILEVERSION 7, 0, 2, 1058 +PRODUCTVERSION 7, 0, 2, 1058 FILEOS VOS__WINDOWS32 FILETYPE VFT_APP { @@ -14,8 +14,8 @@ FILETYPE VFT_APP VALUE "CompanyName", "Alexander Roshal\0" VALUE "ProductName", "RAR decompression library\0" VALUE "FileDescription", "RAR decompression library\0" - VALUE "FileVersion", "7.0.1\0" - VALUE "ProductVersion", "7.0.1\0" + VALUE "FileVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.2\0" VALUE "LegalCopyright", "Copyright \xA9 Alexander Roshal 1993-2023\0" VALUE "OriginalFilename", "Unrar.dll\0" } diff --git a/unrar/list.cpp b/unrar/list.cpp index 8292e69..ad8843b 100644 --- a/unrar/list.cpp +++ b/unrar/list.cpp @@ -431,7 +431,7 @@ void ListFileHeader(Archive &Arc,FileHeader &hd,bool &TitleShown,bool Verbose,bo mprintf(L"%02x%02x..%02x ",S[0],S[1],S[31]); } else - mprintf(L"???????? "); + mprintf(hd.Dir ? L" ":L"???????? "); // Missing checksum is ok for folder, not for file. } mprintf(L"%ls",Name); } diff --git a/unrar/loclang.hpp b/unrar/loclang.hpp index 8a61ed0..8e4ac59 100644 --- a/unrar/loclang.hpp +++ b/unrar/loclang.hpp @@ -385,7 +385,7 @@ #define MDictOutMem L"\nNot enough memory for %d MB compression dictionary, changed to %d MB." #define MUseSmalllerDict L"\nPlease use a smaller compression dictionary." #define MExtrDictOutMem L"\nNot enough memory to unpack the archive with %u GB compression dictionary." -#define MSuggest64bit L"\n64 bit RAR version is necessary." +#define MSuggest64bit L"\n64-bit RAR version is necessary." #define MOpenErrAtime L"\nYou may need to remove -tsp switch to open this file." #define MErrReadInfo L"\nChoose 'Ignore' to continue with the already read file part only, 'Ignore all' to do it for all read errors, 'Retry' to repeat read and 'Quit' to abort." #define MErrReadTrunc L"\n%s is archived incompletely because of read error.\n" @@ -402,3 +402,4 @@ #define MDictNotAllowed L"\n%u GB dictionary exceeds %u GB limit and needs more than %u GB memory to unpack." #define MDictExtrAnyway L"\nUse -md%ug or -mdx%ug switches to extract anyway." #define MDictComprLimit L"\n%u GB dictionary exceeds %u GB limit and not allowed when compressing data." +#define MNeedSFX64 L"\n64-bit self-extracting module is necessary for %u GB compression dictionary." diff --git a/unrar/makefile b/unrar/makefile index 6561bf0..ce54a02 100644 --- a/unrar/makefile +++ b/unrar/makefile @@ -3,7 +3,7 @@ # Linux using GCC CXX=c++ -CXXFLAGS=-march=native -O2 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else +CXXFLAGS=-march=native -O2 -std=c++11 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else LIBFLAGS=-fPIC DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP STRIP=strip diff --git a/unrar/pathfn.cpp b/unrar/pathfn.cpp index f9f0c4b..1ed0d2f 100644 --- a/unrar/pathfn.cpp +++ b/unrar/pathfn.cpp @@ -800,7 +800,7 @@ static void GenArcName(std::wstring &ArcName,const std::wstring &GenerateMask,ui Pos++; // Skip '+' in the beginning of time mask. } - std::wstring Mask=!GenerateMask.empty() ? GenerateMask:L"yyyymmddhhmmss"; + std::wstring Mask=!GenerateMask.empty() ? GenerateMask.substr(Pos):L"yyyymmddhhmmss"; bool QuoteMode=false; uint MAsMinutes=0; // By default we treat 'M' as months. @@ -870,18 +870,19 @@ static void GenArcName(std::wstring &ArcName,const std::wstring &GenerateMask,ui if (StartWeekDay%7>=4) CurWeek++; - char Field[10][11]; - - sprintf(Field[0],"%04u",rlt.Year); - sprintf(Field[1],"%02u",rlt.Month); - sprintf(Field[2],"%02u",rlt.Day); - sprintf(Field[3],"%02u",rlt.Hour); - sprintf(Field[4],"%02u",rlt.Minute); - sprintf(Field[5],"%02u",rlt.Second); - sprintf(Field[6],"%02u",(uint)CurWeek); - sprintf(Field[7],"%u",(uint)WeekDay+1); - sprintf(Field[8],"%03u",rlt.yDay+1); - sprintf(Field[9],"%05u",ArcNumber); + const size_t FieldSize=11; + char Field[10][FieldSize]; + + snprintf(Field[0],FieldSize,"%04u",rlt.Year); + snprintf(Field[1],FieldSize,"%02u",rlt.Month); + snprintf(Field[2],FieldSize,"%02u",rlt.Day); + snprintf(Field[3],FieldSize,"%02u",rlt.Hour); + snprintf(Field[4],FieldSize,"%02u",rlt.Minute); + snprintf(Field[5],FieldSize,"%02u",rlt.Second); + snprintf(Field[6],FieldSize,"%02u",(uint)CurWeek); + snprintf(Field[7],FieldSize,"%u",(uint)WeekDay+1); + snprintf(Field[8],FieldSize,"%03u",rlt.yDay+1); + snprintf(Field[9],FieldSize,"%05u",ArcNumber); const wchar *MaskChars=L"YMDHISWAEN"; diff --git a/unrar/rardefs.hpp b/unrar/rardefs.hpp index 5be04e0..433010f 100644 --- a/unrar/rardefs.hpp +++ b/unrar/rardefs.hpp @@ -25,7 +25,11 @@ #define MAXCMTSIZE 0x40000 +#ifdef _WIN_32 +#define DefSFXName L"default32.sfx" +#else #define DefSFXName L"default.sfx" +#endif #define DefSortListName L"rarfiles.lst" // Maximum dictionary allowed by compression. Can be less than diff --git a/unrar/scantree.cpp b/unrar/scantree.cpp index 2b92fee..a617961 100644 --- a/unrar/scantree.cpp +++ b/unrar/scantree.cpp @@ -65,7 +65,7 @@ SCAN_CODE ScanTree::GetNext(FindData *FD) if (FindCode==SCAN_DONE && GetNextMask()) continue; if (FilterList.ItemsCount()>0 && FindCode==SCAN_SUCCESS) - if (!CommandData::CheckArgs(&FilterList,FD->IsDir,FD->Name.c_str(),false,MATCH_WILDSUBPATH)) + if (!CommandData::CheckArgs(&FilterList,FD->IsDir,FD->Name,false,MATCH_WILDSUBPATH)) continue; break; } diff --git a/unrar/ui.hpp b/unrar/ui.hpp index d0a90de..6788bc7 100644 --- a/unrar/ui.hpp +++ b/unrar/ui.hpp @@ -32,14 +32,15 @@ enum UIMESSAGE_CODE { UIERROR_NOFILESTOADD, UIERROR_NOFILESTODELETE, UIERROR_NOFILESTOEXTRACT, UIERROR_MISSINGVOL, UIERROR_NEEDPREVVOL, UIERROR_UNKNOWNEXTRA, UIERROR_CORRUPTEXTRA, UIERROR_NTFSREQUIRED, UIERROR_ZIPVOLSFX, - UIERROR_FILERO, UIERROR_TOOLARGESFX, UIERROR_NOZIPSFX, UIERROR_EMAIL, - UIERROR_ACLGET, UIERROR_ACLBROKEN, UIERROR_ACLUNKNOWN, UIERROR_ACLSET, - UIERROR_STREAMBROKEN, UIERROR_STREAMUNKNOWN, UIERROR_INCOMPATSWITCH, - UIERROR_PATHTOOLONG, UIERROR_DIRSCAN, UIERROR_UOWNERGET, - UIERROR_UOWNERBROKEN, UIERROR_UOWNERGETOWNERID, UIERROR_UOWNERGETGROUPID, - UIERROR_UOWNERSET, UIERROR_ULINKREAD, UIERROR_ULINKEXIST, - UIERROR_OPENPRESERVEATIME, UIERROR_READERRTRUNCATED, UIERROR_READERRCOUNT, - UIERROR_DIRNAMEEXISTS,UIERROR_TRUNCPSW,UIERROR_ADJUSTVALUE, + UIERROR_FILERO, UIERROR_TOOLARGESFX, UIERROR_NOZIPSFX, UIERROR_NEEEDSFX64, + UIERROR_EMAIL, UIERROR_ACLGET, UIERROR_ACLBROKEN, UIERROR_ACLUNKNOWN, + UIERROR_ACLSET, UIERROR_STREAMBROKEN, UIERROR_STREAMUNKNOWN, + UIERROR_INCOMPATSWITCH, UIERROR_PATHTOOLONG, UIERROR_DIRSCAN, + UIERROR_UOWNERGET, UIERROR_UOWNERBROKEN, UIERROR_UOWNERGETOWNERID, + UIERROR_UOWNERGETGROUPID, UIERROR_UOWNERSET, UIERROR_ULINKREAD, + UIERROR_ULINKEXIST, UIERROR_OPENPRESERVEATIME, UIERROR_READERRTRUNCATED, + UIERROR_READERRCOUNT, UIERROR_DIRNAMEEXISTS,UIERROR_TRUNCPSW, + UIERROR_ADJUSTVALUE, UIMSG_FIRST, UIMSG_STRING, UIMSG_BUILD, UIMSG_RRSEARCH, UIMSG_ANALYZEFILEDATA, diff --git a/unrar/version.hpp b/unrar/version.hpp index 8e4173f..edc56a3 100644 --- a/unrar/version.hpp +++ b/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 7 #define RARVER_MINOR 0 -#define RARVER_BETA 1 -#define RARVER_DAY 8 +#define RARVER_BETA 2 +#define RARVER_DAY 23 #define RARVER_MONTH 11 #define RARVER_YEAR 2023