diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-31 20:31:36 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-06-01 09:33:19 +0400 |
commit | 3df7c8e4f9d3671b635a5c25a78699cd69d2a2b9 (patch) | |
tree | c9a664701b5918ef662a1fa850cbeb438470193d /src/thirdparty/unrar | |
parent | 8aae7805d5f464184ca6fd8a38209822fb0ec4da (diff) |
Update Unrar to v5.0.5.
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r-- | src/thirdparty/unrar/arcread.cpp | 11 | ||||
-rw-r--r-- | src/thirdparty/unrar/cmddata.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/unrar/crypt.cpp | 9 | ||||
-rw-r--r-- | src/thirdparty/unrar/crypt.hpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.rc | 4 | ||||
-rw-r--r-- | src/thirdparty/unrar/rdwrfn.cpp | 14 | ||||
-rw-r--r-- | src/thirdparty/unrar/recvol3.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadmisc.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadpool.cpp | 5 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadpool.hpp | 14 | ||||
-rw-r--r-- | src/thirdparty/unrar/version.hpp | 2 |
11 files changed, 39 insertions, 40 deletions
diff --git a/src/thirdparty/unrar/arcread.cpp b/src/thirdparty/unrar/arcread.cpp index 3fa4f80fb..5c6549cf4 100644 --- a/src/thirdparty/unrar/arcread.cpp +++ b/src/thirdparty/unrar/arcread.cpp @@ -358,7 +358,11 @@ size_t Archive::ReadHeader15() byte *D=&hd->SubData[8]; RecoverySize=D[0]+((uint)D[1]<<8)+((uint)D[2]<<16)+((uint)D[3]<<24); RecoverySize*=512; // Sectors to size. - RecoveryPercent=ToPercent(RecoverySize,Tell()); + int64 CurPos=Tell(); + RecoveryPercent=ToPercent(RecoverySize,CurPos); + // Round fractional percent exceeding .5 to upper value. + if (ToPercent(RecoverySize+CurPos/200,CurPos)>RecoveryPercent) + RecoveryPercent++; } } } @@ -1275,9 +1279,10 @@ void Archive::ConvertFileHeader(FileHeader *hd) // This code must be performed only after other path separator checks, // because it produces backslashes illegal for some of checks above. // Backslash is allowed in file names in Unix, but not in Windows. + // Still, RAR 4.x use backslashes as path separator even in Unix. // Forward slash is not allowed in both systems. In RAR 5.0 we use - // the backslash as universal path separator. - if (*s=='/' || *s=='\\' && hd->HSType!=HSYS_UNIX && Format!=RARFMT50) + // the forward slash as universal path separator. + if (*s=='/' || *s=='\\' && Format!=RARFMT50) *s=CPATHDIVIDER; } } diff --git a/src/thirdparty/unrar/cmddata.cpp b/src/thirdparty/unrar/cmddata.cpp index d34b6033d..e0190911a 100644 --- a/src/thirdparty/unrar/cmddata.cpp +++ b/src/thirdparty/unrar/cmddata.cpp @@ -918,12 +918,12 @@ void CommandData::OutTitle() inline bool CmpMSGID(MSGID i1,MSGID i2) { #ifdef MSGID_INT - return(i1==i2); + return i1==i2; #else // If MSGID is const char*, we cannot compare pointers only. // Pointers to different instances of same string can differ, // so we need to compare complete strings. - return(strcmp(i1,i2)==0); + return strcmp(i1,i2)==0; #endif } @@ -954,7 +954,7 @@ void CommandData::OutHelp(RAR_EXIT ExitCode) for (uint I=0;I<ASIZE(Help);I++) { #ifndef SFX_MODULE - if (Help[I]==MCHelpSwV) + if (CmpMSGID(Help[I],MCHelpSwV)) continue; #ifndef _WIN_ALL static MSGID Win32Only[]={ diff --git a/src/thirdparty/unrar/crypt.cpp b/src/thirdparty/unrar/crypt.cpp index 3ebc9dc12..ef2e68a11 100644 --- a/src/thirdparty/unrar/crypt.cpp +++ b/src/thirdparty/unrar/crypt.cpp @@ -49,12 +49,12 @@ void CryptData::DecryptBlock(byte *Buf,size_t Size) } -void CryptData::SetCryptKeys(bool Encrypt,CRYPT_METHOD Method, +bool CryptData::SetCryptKeys(bool Encrypt,CRYPT_METHOD Method, SecPassword *Password,const byte *Salt, const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck) { if (!Password->IsSet() || Method==CRYPT_NONE) - return; + return false; CryptData::Method=Method; @@ -78,13 +78,14 @@ void CryptData::SetCryptKeys(bool Encrypt,CRYPT_METHOD Method, #endif case CRYPT_RAR30: SetKey30(Encrypt,Password,PwdW,Salt); - return; + break; case CRYPT_RAR50: SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck); - return; + break; } cleandata(PwdA,sizeof(PwdA)); cleandata(PwdW,sizeof(PwdW)); + return true; } diff --git a/src/thirdparty/unrar/crypt.hpp b/src/thirdparty/unrar/crypt.hpp index cb21100e6..1dc244600 100644 --- a/src/thirdparty/unrar/crypt.hpp +++ b/src/thirdparty/unrar/crypt.hpp @@ -65,7 +65,7 @@ class CryptData public: CryptData(); ~CryptData(); - void SetCryptKeys(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, + bool SetCryptKeys(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, const byte *Salt,const byte *InitV,uint Lg2Cnt, byte *HashKey,byte *PswCheck); void SetAV15Encryption(); diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc index e8e8ad184..4858a0bec 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, 0, 4, 871
-PRODUCTVERSION 5, 0, 4, 871
+FILEVERSION 5, 0, 4, 878
+PRODUCTVERSION 5, 0, 4, 878
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
diff --git a/src/thirdparty/unrar/rdwrfn.cpp b/src/thirdparty/unrar/rdwrfn.cpp index 736dc3b33..18be483de 100644 --- a/src/thirdparty/unrar/rdwrfn.cpp +++ b/src/thirdparty/unrar/rdwrfn.cpp @@ -245,20 +245,12 @@ void ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method, SecPassword *Password,const byte *Salt,const byte *InitV, uint Lg2Cnt,byte *PswCheck,byte *HashKey) { - if (Encrypt) - { - Encryption=Password->IsSet(); #ifndef RAR_NOCRYPT - Crypt.SetCryptKeys(true,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); -#endif - } + if (Encrypt) + Encryption=Crypt.SetCryptKeys(true,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); else - { - Decryption=Password->IsSet(); -#ifndef RAR_NOCRYPT - Decrypt.SetCryptKeys(false,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + Decryption=Decrypt.SetCryptKeys(false,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); #endif - } } diff --git a/src/thirdparty/unrar/recvol3.cpp b/src/thirdparty/unrar/recvol3.cpp index 7ccacff0f..5c6a7d9b9 100644 --- a/src/thirdparty/unrar/recvol3.cpp +++ b/src/thirdparty/unrar/recvol3.cpp @@ -50,7 +50,7 @@ RecVolumes3::RecVolumes3() RecVolumes3::~RecVolumes3() { - for (int I=0;I<ASIZE(SrcFile);I++) + for (size_t I=0;I<ASIZE(SrcFile);I++) delete SrcFile[I]; #ifdef RAR_SMP DestroyThreadPool(RSThreadPool); @@ -207,7 +207,7 @@ bool RecVolumes3::Restore(RAROptions *Cmd,const wchar *Name,bool Silent) if (Dot==NULL) continue; bool WrongParam=false; - for (int I=0;I<ASIZE(P);I++) + for (size_t I=0;I<ASIZE(P);I++) { do { @@ -397,7 +397,7 @@ bool RecVolumes3::Restore(RAROptions *Cmd,const wchar *Name,bool Silent) else { int ReadSize=SrcFile[I]->Read(&Buf[I*RecBufferSize],RecBufferSize); - if (ReadSize!=RecBufferSize) + if ((size_t)ReadSize!=RecBufferSize) memset(&Buf[I*RecBufferSize+ReadSize],0,RecBufferSize-ReadSize); if (ReadSize>MaxRead) MaxRead=ReadSize; diff --git a/src/thirdparty/unrar/threadmisc.cpp b/src/thirdparty/unrar/threadmisc.cpp index c069fc185..d35f956a7 100644 --- a/src/thirdparty/unrar/threadmisc.cpp +++ b/src/thirdparty/unrar/threadmisc.cpp @@ -17,7 +17,7 @@ void DestroyThreadPool(ThreadPool *Pool) } -static THREAD_HANDLE ThreadCreate(PTHREAD_PROC Proc,void *Data) +static THREAD_HANDLE ThreadCreate(NATIVE_THREAD_PTR Proc,void *Data) { #ifdef _UNIX pthread_attr_t attr; @@ -25,7 +25,7 @@ static THREAD_HANDLE ThreadCreate(PTHREAD_PROC Proc,void *Data) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_t pt; - int Code=pthread_create(&pt,&attr,Proc,(void*)Data); + int Code=pthread_create(&pt,&attr,Proc,Data); if (Code!=0) { wchar Msg[100]; @@ -37,7 +37,7 @@ static THREAD_HANDLE ThreadCreate(PTHREAD_PROC Proc,void *Data) return pt; #else DWORD ThreadId; - HANDLE hThread=CreateThread(NULL,0x10000,(LPTHREAD_START_ROUTINE)Proc,Data,0,&ThreadId); + HANDLE hThread=CreateThread(NULL,0x10000,Proc,Data,0,&ThreadId); if (hThread==NULL) { ErrHandler.GeneralErrMsg(L"CreateThread failed"); diff --git a/src/thirdparty/unrar/threadpool.cpp b/src/thirdparty/unrar/threadpool.cpp index 16e697c77..6c62e327b 100644 --- a/src/thirdparty/unrar/threadpool.cpp +++ b/src/thirdparty/unrar/threadpool.cpp @@ -45,7 +45,7 @@ ThreadPool::ThreadPool(uint MaxThreads) for(uint I=0;I<MaxAllowedThreads;I++) { - ThreadHandles[I] = ThreadCreate( PoolThread, this); + ThreadHandles[I] = ThreadCreate(PoolThread, this); #ifdef _WIN_ALL if (ThreadPool::ThreadPriority!=THREAD_PRIORITY_NORMAL) SetThreadPriority(ThreadHandles[I],ThreadPool::ThreadPriority); @@ -100,9 +100,10 @@ ThreadPool::~ThreadPool() } -THREAD_TYPE THREAD_ATTR ThreadPool::PoolThread(void *Param) +NATIVE_THREAD_TYPE ThreadPool::PoolThread(void *Param) { ((ThreadPool*)Param)->PoolThreadLoop(); + return 0; } diff --git a/src/thirdparty/unrar/threadpool.hpp b/src/thirdparty/unrar/threadpool.hpp index 817d61a2d..86c0d7450 100644 --- a/src/thirdparty/unrar/threadpool.hpp +++ b/src/thirdparty/unrar/threadpool.hpp @@ -16,19 +16,19 @@ const uint MaxPoolThreads=32; #define USE_THREADS #ifdef _UNIX - #define THREAD_ATTR - #define THREAD_TYPE void* + #define NATIVE_THREAD_TYPE void* + typedef void* (*NATIVE_THREAD_PTR)(void *Data); typedef pthread_t THREAD_HANDLE; typedef pthread_mutex_t CRITSECT_HANDLE; #else - #define THREAD_ATTR WINAPI - #define THREAD_TYPE void + #define NATIVE_THREAD_TYPE DWORD WINAPI + typedef DWORD (WINAPI *NATIVE_THREAD_PTR)(void *Data); typedef HANDLE THREAD_HANDLE; typedef CRITICAL_SECTION CRITSECT_HANDLE; #endif -typedef THREAD_TYPE (THREAD_ATTR *PTHREAD_PROC)(void *Data); -#define THREAD_PROC(fn) THREAD_TYPE THREAD_ATTR fn(void *Data) +typedef void (*PTHREAD_PROC)(void *Data); +#define THREAD_PROC(fn) void fn(void *Data) uint GetNumberOfCPU(); uint GetNumberOfThreads(); @@ -43,7 +43,7 @@ class ThreadPool void *Param; }; - static THREAD_TYPE THREAD_ATTR PoolThread(void *Param); + static NATIVE_THREAD_TYPE PoolThread(void *Param); void PoolThreadLoop(); bool GetQueuedTask(QueueEntry *Task); diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp index f34a08f54..078369ce2 100644 --- a/src/thirdparty/unrar/version.hpp +++ b/src/thirdparty/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 #define RARVER_MINOR 0 #define RARVER_BETA 4 -#define RARVER_DAY 20 +#define RARVER_DAY 27 #define RARVER_MONTH 5 #define RARVER_YEAR 2013 |