diff options
author | XhmikosR <xhmikosr@gmail.com> | 2014-08-06 20:43:53 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2014-08-19 21:59:22 +0400 |
commit | b56235a26018a98ac6a9de549dd96d9c49f2703b (patch) | |
tree | 31d5425eefd0069a8654702ee2b9e3a9f3047960 /src/thirdparty/unrar | |
parent | 1918fb5fee04de2df3acb884d20896739b8f9e18 (diff) |
Update unrar to v5.1.7.
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r-- | src/thirdparty/unrar/dll.rc | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/extract.cpp | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/file.cpp | 20 | ||||
-rw-r--r-- | src/thirdparty/unrar/filestr.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/os.hpp | 5 | ||||
-rw-r--r-- | src/thirdparty/unrar/pathfn.cpp | 4 | ||||
-rw-r--r-- | src/thirdparty/unrar/pathfn.hpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/rarvm.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/recvol3.cpp | 1 | ||||
-rw-r--r-- | src/thirdparty/unrar/recvol5.cpp | 1 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadmisc.cpp | 5 | ||||
-rw-r--r-- | src/thirdparty/unrar/timefn.cpp | 75 | ||||
-rw-r--r-- | src/thirdparty/unrar/ui.hpp | 1 | ||||
-rw-r--r-- | src/thirdparty/unrar/ulinks.cpp | 18 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack.hpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack30.cpp | 4 | ||||
-rw-r--r-- | src/thirdparty/unrar/version.hpp | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/volume.cpp | 2 |
18 files changed, 111 insertions, 57 deletions
diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc index 97cb9efe8..aedb0fc5e 100644 --- a/src/thirdparty/unrar/dll.rc +++ b/src/thirdparty/unrar/dll.rc @@ -2,8 +2,8 @@ #include <commctrl.h>
VS_VERSION_INFO VERSIONINFO
-FILEVERSION 5, 10, 100, 1258
-PRODUCTVERSION 5, 10, 100, 1258
+FILEVERSION 5, 11, 1, 1315
+PRODUCTVERSION 5, 11, 1, 1315
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", "5.10.0\0"
- VALUE "ProductVersion", "5.10.0\0"
+ VALUE "FileVersion", "5.11.1\0"
+ VALUE "ProductVersion", "5.11.1\0"
VALUE "LegalCopyright", "Copyright © Alexander Roshal 1993-2014\0"
VALUE "OriginalFilename", "Unrar.dll\0"
}
diff --git a/src/thirdparty/unrar/extract.cpp b/src/thirdparty/unrar/extract.cpp index ac2bbe43b..770cae4d7 100644 --- a/src/thirdparty/unrar/extract.cpp +++ b/src/thirdparty/unrar/extract.cpp @@ -613,7 +613,13 @@ bool CmdExtract::ExtractCurrentFile(Archive &Arc,size_t HeaderSize,bool &Repeat) Arc.SeekToNext();
- bool ValidCRC=DataIO.UnpHash.Cmp(&Arc.FileHead.FileHash,Arc.FileHead.UseHashKey ? Arc.FileHead.HashKey:NULL);
+ // We check for "split after" flag to detect partially extracted files
+ // from incomplete volume sets. For them file header contains packed
+ // data hash, which must not be compared against unpacked data hash
+ // to prevent accidental match. Moreover, for -m0 volumes packed data
+ // hash would match truncated unpacked data hash and lead to fake "OK"
+ // in incomplete volume set.
+ bool ValidCRC=!Arc.FileHead.SplitAfter && DataIO.UnpHash.Cmp(&Arc.FileHead.FileHash,Arc.FileHead.UseHashKey ? Arc.FileHead.HashKey:NULL);
// We set AnySolidDataUnpackedWell to true if we found at least one
// valid non-zero solid file in preceding solid stream. If it is true
diff --git a/src/thirdparty/unrar/file.cpp b/src/thirdparty/unrar/file.cpp index 4524fbeed..51100acd6 100644 --- a/src/thirdparty/unrar/file.cpp +++ b/src/thirdparty/unrar/file.cpp @@ -658,10 +658,26 @@ int64 File::Copy(File &Dest,int64 Length) { Wait(); size_t SizeToRead=(!CopyAll && Length<(int64)Buffer.Size()) ? (size_t)Length:Buffer.Size(); - int ReadSize=Read(&Buffer[0],SizeToRead); + char *Buf=&Buffer[0]; + int ReadSize=Read(Buf,SizeToRead); if (ReadSize==0) break; - Dest.Write(&Buffer[0],ReadSize); + size_t WriteSize=ReadSize; +#ifdef _WIN_ALL + // For FAT32 USB flash drives in Windows if first write is 4 KB or more, + // write caching is disabled and "write through" is enabled, resulting + // in bad performance, especially for many small files. It happens when + // we create SFX archive on USB drive, because SFX module is writetn first. + // So we split the first write to small 1 KB followed by rest of data. + if (CopySize==0 && WriteSize>=4096) + { + const size_t FirstWrite=1024; + Dest.Write(Buf,FirstWrite); + Buf+=FirstWrite; + WriteSize-=FirstWrite; + } +#endif + Dest.Write(Buf,WriteSize); CopySize+=ReadSize; if (!CopyAll) Length-=ReadSize; diff --git a/src/thirdparty/unrar/filestr.cpp b/src/thirdparty/unrar/filestr.cpp index 74d8977a4..b719206c7 100644 --- a/src/thirdparty/unrar/filestr.cpp +++ b/src/thirdparty/unrar/filestr.cpp @@ -22,7 +22,7 @@ bool ReadTextFile( wcsncpyz(FileName,Name,ASIZE(FileName)); File SrcFile; - if (FileName!=NULL && *FileName!=0) + if (*FileName!=0) { bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName):SrcFile.Open(FileName,0); diff --git a/src/thirdparty/unrar/os.hpp b/src/thirdparty/unrar/os.hpp index 95fa5d6d3..84f8fc92a 100644 --- a/src/thirdparty/unrar/os.hpp +++ b/src/thirdparty/unrar/os.hpp @@ -158,6 +158,11 @@ #define SAVE_LINKS #endif +#if defined(__linux) && !defined (_ANDROID) || defined(__FreeBSD__) +#include <sys/time.h> +#define USE_LUTIMES +#endif + #define ENABLE_ACCESS #define DefConfigName L".rarrc" diff --git a/src/thirdparty/unrar/pathfn.cpp b/src/thirdparty/unrar/pathfn.cpp index 44259ed49..016a0e824 100644 --- a/src/thirdparty/unrar/pathfn.cpp +++ b/src/thirdparty/unrar/pathfn.cpp @@ -643,7 +643,7 @@ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,size_t MaxSize,b #ifndef SFX_MODULE -static void GenArcName(wchar *ArcName,wchar *GenerateMask,uint ArcNumber,bool &ArcNumPresent) +static void GenArcName(wchar *ArcName,const wchar *GenerateMask,uint ArcNumber,bool &ArcNumPresent) { bool Prefix=false; if (*GenerateMask=='+') @@ -809,7 +809,7 @@ static void GenArcName(wchar *ArcName,wchar *GenerateMask,uint ArcNumber,bool &A } -void GenerateArchiveName(wchar *ArcName,size_t MaxSize,wchar *GenerateMask,bool Archiving) +void GenerateArchiveName(wchar *ArcName,size_t MaxSize,const wchar *GenerateMask,bool Archiving) { // Must be enough space for archive name plus all stuff in mask plus // extra overhead produced by mask 'N' (archive number) characters. diff --git a/src/thirdparty/unrar/pathfn.hpp b/src/thirdparty/unrar/pathfn.hpp index ba8f07c5f..b34727355 100644 --- a/src/thirdparty/unrar/pathfn.hpp +++ b/src/thirdparty/unrar/pathfn.hpp @@ -58,7 +58,7 @@ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,size_t MaxSize,b wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize); #ifndef SFX_MODULE -void GenerateArchiveName(wchar *ArcName,size_t MaxSize,wchar *GenerateMask,bool Archiving); +void GenerateArchiveName(wchar *ArcName,size_t MaxSize,const wchar *GenerateMask,bool Archiving); #endif #ifdef _WIN_ALL diff --git a/src/thirdparty/unrar/rarvm.cpp b/src/thirdparty/unrar/rarvm.cpp index f458eecb0..0dd38928a 100644 --- a/src/thirdparty/unrar/rarvm.cpp +++ b/src/thirdparty/unrar/rarvm.cpp @@ -984,7 +984,7 @@ void RarVM::ExecuteStandardFilter(VM_StandardFilters FilterType) byte *SrcData=Mem,*DestData=SrcData+DataSize; const int Channels=3; SET_VALUE(false,&Mem[VM_GLOBALMEMADDR+0x20],DataSize); - if ((uint)DataSize>=VM_GLOBALMEMADDR/2 || PosR<0) + if ((uint)DataSize>=VM_GLOBALMEMADDR/2 || Width<0 || PosR<0) break; for (int CurChannel=0;CurChannel<Channels;CurChannel++) { diff --git a/src/thirdparty/unrar/recvol3.cpp b/src/thirdparty/unrar/recvol3.cpp index c733c63e0..3c77eba37 100644 --- a/src/thirdparty/unrar/recvol3.cpp +++ b/src/thirdparty/unrar/recvol3.cpp @@ -309,6 +309,7 @@ bool RecVolumes3::Restore(RAROptions *Cmd,const wchar *Name,bool Silent) wcscpy(LastVolName,ArcName); uiMsg(UIMSG_MISSINGVOL,ArcName); + uiMsg(UIEVENT_NEWARCHIVE,ArcName); } SrcFile[CurArcNum]=(File*)NewFile; NextVolumeName(ArcName,ASIZE(ArcName),!NewNumbering); diff --git a/src/thirdparty/unrar/recvol5.cpp b/src/thirdparty/unrar/recvol5.cpp index 4fafac501..4cb0fc72d 100644 --- a/src/thirdparty/unrar/recvol5.cpp +++ b/src/thirdparty/unrar/recvol5.cpp @@ -292,6 +292,7 @@ bool RecVolumes5::Restore(RAROptions *Cmd,const wchar *Name,bool Silent) { wcsncpyz(Item->Name,FirstVolName,ASIZE(Item->Name)); uiMsg(UIMSG_CREATING,Item->Name); + uiMsg(UIEVENT_NEWARCHIVE,Item->Name); File *NewVol=new File; bool UserReject; if (!FileCreate(Cmd,NewVol,Item->Name,ASIZE(Item->Name),&UserReject)) diff --git a/src/thirdparty/unrar/threadmisc.cpp b/src/thirdparty/unrar/threadmisc.cpp index 90133f983..d56867be4 100644 --- a/src/thirdparty/unrar/threadmisc.cpp +++ b/src/thirdparty/unrar/threadmisc.cpp @@ -77,12 +77,13 @@ void DestroyThreadPool(ThreadPool *Pool) static THREAD_HANDLE ThreadCreate(NATIVE_THREAD_PTR Proc,void *Data) { #ifdef _UNIX +/* pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - +*/ pthread_t pt; - int Code=pthread_create(&pt,&attr,Proc,Data); + int Code=pthread_create(&pt,NULL/*&attr*/,Proc,Data); if (Code!=0) { wchar Msg[100]; diff --git a/src/thirdparty/unrar/timefn.cpp b/src/thirdparty/unrar/timefn.cpp index 217df0328..3fa535f4c 100644 --- a/src/thirdparty/unrar/timefn.cpp +++ b/src/thirdparty/unrar/timefn.cpp @@ -42,22 +42,30 @@ void RarTime::GetLocal(RarLocalTime *lt) GetWin32(&ft); FILETIME lft; - // We use these functions instead of FileTimeToLocalFileTime according to - // MSDN recommendation: "To account for daylight saving time - // when converting a file time to a local time ..." - SYSTEMTIME st1,st2; - FileTimeToSystemTime(&ft,&st1); - SystemTimeToTzSpecificLocalTime(NULL,&st1,&st2); - SystemTimeToFileTime(&st2,&lft); - - // Correct precision loss (low 4 decimal digits) in FileTimeToSystemTime. - FILETIME rft; - SystemTimeToFileTime(&st1,&rft); - int64 Corrected=INT32TO64(ft.dwHighDateTime,ft.dwLowDateTime)- - INT32TO64(rft.dwHighDateTime,rft.dwLowDateTime)+ - INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime); - lft.dwLowDateTime=(DWORD)Corrected; - lft.dwHighDateTime=(DWORD)(Corrected>>32); + if (WinNT() < WNT_VISTA) + { + // SystemTimeToTzSpecificLocalTime based code produces 1 hour error on XP. + FileTimeToLocalFileTime(&ft,&lft); + } + else + { + // We use these functions instead of FileTimeToLocalFileTime according to + // MSDN recommendation: "To account for daylight saving time + // when converting a file time to a local time ..." + SYSTEMTIME st1,st2; + FileTimeToSystemTime(&ft,&st1); + SystemTimeToTzSpecificLocalTime(NULL,&st1,&st2); + SystemTimeToFileTime(&st2,&lft); + + // Correct precision loss (low 4 decimal digits) in FileTimeToSystemTime. + FILETIME rft; + SystemTimeToFileTime(&st1,&rft); + int64 Corrected=INT32TO64(ft.dwHighDateTime,ft.dwLowDateTime)- + INT32TO64(rft.dwHighDateTime,rft.dwLowDateTime)+ + INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime); + lft.dwLowDateTime=(DWORD)Corrected; + lft.dwHighDateTime=(DWORD)(Corrected>>32); + } SYSTEMTIME st; FileTimeToSystemTime(&lft,&st); @@ -121,21 +129,30 @@ void RarTime::SetLocal(RarLocalTime *lt) if (lft.dwLowDateTime<lt->Reminder) lft.dwHighDateTime++; - // Reverse procedure which we do in GetLocal. - SYSTEMTIME st1,st2; - FileTimeToSystemTime(&lft,&st2); - TzSpecificLocalTimeToSystemTime(NULL,&st2,&st1); FILETIME ft; - SystemTimeToFileTime(&st1,&ft); - // Correct precision loss (low 4 decimal digits) in FileTimeToSystemTime. - FILETIME rft; - SystemTimeToFileTime(&st2,&rft); - int64 Corrected=INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime)- - INT32TO64(rft.dwHighDateTime,rft.dwLowDateTime)+ - INT32TO64(ft.dwHighDateTime,ft.dwLowDateTime); - ft.dwLowDateTime=(DWORD)Corrected; - ft.dwHighDateTime=(DWORD)(Corrected>>32); + if (WinNT() < WNT_VISTA) + { + // TzSpecificLocalTimeToSystemTime based code produces 1 hour error on XP. + LocalFileTimeToFileTime(&lft,&ft); + } + else + { + // Reverse procedure which we do in GetLocal. + SYSTEMTIME st1,st2; + FileTimeToSystemTime(&lft,&st2); + TzSpecificLocalTimeToSystemTime(NULL,&st2,&st1); + SystemTimeToFileTime(&st1,&ft); + + // Correct precision loss (low 4 decimal digits) in FileTimeToSystemTime. + FILETIME rft; + SystemTimeToFileTime(&st2,&rft); + int64 Corrected=INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime)- + INT32TO64(rft.dwHighDateTime,rft.dwLowDateTime)+ + INT32TO64(ft.dwHighDateTime,ft.dwLowDateTime); + ft.dwLowDateTime=(DWORD)Corrected; + ft.dwHighDateTime=(DWORD)(Corrected>>32); + } *this=ft; } diff --git a/src/thirdparty/unrar/ui.hpp b/src/thirdparty/unrar/ui.hpp index ce054aaa2..9803b78ab 100644 --- a/src/thirdparty/unrar/ui.hpp +++ b/src/thirdparty/unrar/ui.hpp @@ -56,6 +56,7 @@ enum UIMESSAGE_CODE { UIEVENT_ERASEDISK, UIEVENT_FILESUMSTART, UIEVENT_FILESUMPROGRESS, UIEVENT_FILESUMEND, UIEVENT_PROTECTSTART, UIEVENT_PROTECTEND, UIEVENT_TESTADDEDSTART, UIEVENT_TESTADDEDEND, UIEVENT_RRTESTING, + UIEVENT_NEWARCHIVE, UIEVENT_NEWREVFILE }; diff --git a/src/thirdparty/unrar/ulinks.cpp b/src/thirdparty/unrar/ulinks.cpp index f36d6afe3..b51ff6282 100644 --- a/src/thirdparty/unrar/ulinks.cpp +++ b/src/thirdparty/unrar/ulinks.cpp @@ -1,6 +1,6 @@ -static bool UnixSymlink(const char *Target,const wchar *LinkName) +static bool UnixSymlink(const char *Target,const wchar *LinkName,RarTime *ftm,RarTime *fta) { CreatePath(LinkName,true); DelFile(LinkName); @@ -17,9 +17,15 @@ static bool UnixSymlink(const char *Target,const wchar *LinkName) } return false; } - // We do not set time of created symlink, because utime changes - // time of link target and lutimes is not available on all Linux - // systems at the moment of writing this code. +#ifdef USE_LUTIMES + struct timeval tv[2]; + tv[0].tv_sec=fta->GetUnix(); + tv[0].tv_usec=long(fta->GetRaw()%10000000/10); + tv[1].tv_sec=ftm->GetUnix(); + tv[1].tv_usec=long(ftm->GetRaw()%10000000/10); + lutimes(LinkNameA,tv); +#endif + return true; } @@ -42,7 +48,7 @@ bool ExtractUnixLink30(ComprDataIO &DataIO,Archive &Arc,const wchar *LinkName) if (!DataIO.UnpHash.Cmp(&Arc.FileHead.FileHash,Arc.FileHead.UseHashKey ? Arc.FileHead.HashKey:NULL)) return true; - return UnixSymlink(Target,LinkName); + return UnixSymlink(Target,LinkName,&Arc.FileHead.mtime,&Arc.FileHead.atime); } return false; } @@ -62,5 +68,5 @@ bool ExtractUnixLink50(const wchar *Name,FileHeader *hd) return false; DosSlashToUnix(Target,Target,ASIZE(Target)); } - return UnixSymlink(Target,Name); + return UnixSymlink(Target,Name,&hd->mtime,&hd->atime); } diff --git a/src/thirdparty/unrar/unpack.hpp b/src/thirdparty/unrar/unpack.hpp index b051866f8..2c0ed48dd 100644 --- a/src/thirdparty/unrar/unpack.hpp +++ b/src/thirdparty/unrar/unpack.hpp @@ -325,7 +325,7 @@ class Unpack:PackDef ModelPPM PPM; int PPMEscChar; - byte UnpOldTable[HUFF_TABLE_SIZE]; + byte UnpOldTable[HUFF_TABLE_SIZE30]; int UnpBlockType; bool TablesRead; diff --git a/src/thirdparty/unrar/unpack30.cpp b/src/thirdparty/unrar/unpack30.cpp index 33fb27aa4..980df0244 100644 --- a/src/thirdparty/unrar/unpack30.cpp +++ b/src/thirdparty/unrar/unpack30.cpp @@ -798,13 +798,13 @@ bool Unpack::ReadTables30() } TablesRead=true; if (Inp.InAddr>ReadTop) - return(false); + return false; MakeDecodeTables(&Table[0],&BlockTables.LD,NC30); MakeDecodeTables(&Table[NC30],&BlockTables.DD,DC30); MakeDecodeTables(&Table[NC30+DC30],&BlockTables.LDD,LDC30); MakeDecodeTables(&Table[NC30+DC30+LDC30],&BlockTables.RD,RC30); memcpy(UnpOldTable,Table,sizeof(UnpOldTable)); - return(true); + return true; } diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp index 4f859616b..ef0b664db 100644 --- a/src/thirdparty/unrar/version.hpp +++ b/src/thirdparty/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 -#define RARVER_MINOR 10 -#define RARVER_BETA 0 -#define RARVER_DAY 10 -#define RARVER_MONTH 6 +#define RARVER_MINOR 11 +#define RARVER_BETA 1 +#define RARVER_DAY 6 +#define RARVER_MONTH 8 #define RARVER_YEAR 2014 diff --git a/src/thirdparty/unrar/volume.cpp b/src/thirdparty/unrar/volume.cpp index d89c4db7c..8e317ba3f 100644 --- a/src/thirdparty/unrar/volume.cpp +++ b/src/thirdparty/unrar/volume.cpp @@ -241,7 +241,7 @@ bool DllVolChange(RAROptions *Cmd,wchar *NextName,size_t NameSize) if (RetCode==0) DllVolAborted=true; else - CharToWide(NextNameA,NextName,ASIZE(NextName)); + CharToWide(NextNameA,NextName,NameSize); } // We quit only on 'abort' condition, but not on 'name not changed'. |