diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2014-04-08 09:41:42 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2014-04-12 19:27:19 +0400 |
commit | da2bc91949a54865a684bcd059402a9aae8a3339 (patch) | |
tree | 0c0e8e706d488c37ca8721f41e8cd7486e7b51f3 /src/thirdparty/unrar | |
parent | 35a4d8b096cb86d1b4fc261352037b62fd30a0e8 (diff) |
Update Unrar to v5.1.2.
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r-- | src/thirdparty/unrar/arcread.cpp | 3 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.cpp | 16 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.rc | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/extract.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/hardlinks.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/unrar/rawread.hpp | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/sha1.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadpool.cpp | 34 | ||||
-rw-r--r-- | src/thirdparty/unrar/threadpool.hpp | 4 | ||||
-rw-r--r-- | src/thirdparty/unrar/timefn.cpp | 1 | ||||
-rw-r--r-- | src/thirdparty/unrar/ulinks.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack.cpp | 7 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack.hpp | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack50.cpp | 225 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack50frag.cpp | 11 | ||||
-rw-r--r-- | src/thirdparty/unrar/unpack50mt.cpp | 11 | ||||
-rw-r--r-- | src/thirdparty/unrar/version.hpp | 6 |
17 files changed, 87 insertions, 271 deletions
diff --git a/src/thirdparty/unrar/arcread.cpp b/src/thirdparty/unrar/arcread.cpp index 8395d460d..5b70988ea 100644 --- a/src/thirdparty/unrar/arcread.cpp +++ b/src/thirdparty/unrar/arcread.cpp @@ -1049,6 +1049,9 @@ void Archive::ProcessExtra50(RawRead *Raw,size_t ExtraSize,BaseBlock *bb) Raw->GetB(UtfName,NameSize); UtfName[NameSize]=0; } +#ifdef _WIN_ALL + UnixSlashToDos(UtfName,UtfName,ASIZE(UtfName)); +#endif UtfToWide(UtfName,hd->RedirName,ASIZE(hd->RedirName)); } break; diff --git a/src/thirdparty/unrar/dll.cpp b/src/thirdparty/unrar/dll.cpp index d8962d147..5617f45b2 100644 --- a/src/thirdparty/unrar/dll.cpp +++ b/src/thirdparty/unrar/dll.cpp @@ -311,10 +311,12 @@ int PASCAL ProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestNa if (DestPath!=NULL) { char ExtrPathA[NM]; -#ifdef _WIN_ALL - OemToCharBuffA(DestPath,ExtrPathA,ASIZE(ExtrPathA)-2); -#else strncpyz(ExtrPathA,DestPath,ASIZE(ExtrPathA)-2); +#ifdef _WIN_ALL + // We must not apply OemToCharBuffA directly to DestPath, + // because we do not know DestPath length and OemToCharBuffA + // does not stop at 0. + OemToCharA(ExtrPathA,ExtrPathA); #endif CharToWide(ExtrPathA,Data->Cmd.ExtrPath,ASIZE(Data->Cmd.ExtrPath)); AddEndSlash(Data->Cmd.ExtrPath,ASIZE(Data->Cmd.ExtrPath)); @@ -322,10 +324,12 @@ int PASCAL ProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestNa if (DestName!=NULL) { char DestNameA[NM]; -#ifdef _WIN_ALL - OemToCharBuffA(DestName,DestNameA,ASIZE(DestNameA)-2); -#else strncpyz(DestNameA,DestName,ASIZE(DestNameA)-2); +#ifdef _WIN_ALL + // We must not apply OemToCharBuffA directly to DestName, + // because we do not know DestName length and OemToCharBuffA + // does not stop at 0. + OemToCharA(DestNameA,DestNameA); #endif CharToWide(DestNameA,Data->Cmd.DllDestName,ASIZE(Data->Cmd.DllDestName)); } diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc index b9caa867d..05132c9b1 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, 1, 1173
-PRODUCTVERSION 5, 10, 1, 1173
+FILEVERSION 5, 10, 2, 1192
+PRODUCTVERSION 5, 10, 2, 1192
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.1\0"
- VALUE "ProductVersion", "5.10.1\0"
+ VALUE "FileVersion", "5.10.2\0"
+ VALUE "ProductVersion", "5.10.2\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 8daabfaf5..ac2bbe43b 100644 --- a/src/thirdparty/unrar/extract.cpp +++ b/src/thirdparty/unrar/extract.cpp @@ -735,7 +735,7 @@ void CmdExtract::UnstoreFile(ComprDataIO &DataIO,int64 DestUnpSize) bool CmdExtract::ExtractFileCopy(File &New,wchar *ArcName,wchar *NameNew,wchar *NameExisting,size_t NameExistingSize)
{
- SlashToNative(NameExisting,NameExisting,NameExistingSize);
+ SlashToNative(NameExisting,NameExisting,NameExistingSize); // Not needed for RAR 5.1+ archives.
File Existing;
if (!Existing.WOpen(NameExisting))
diff --git a/src/thirdparty/unrar/hardlinks.cpp b/src/thirdparty/unrar/hardlinks.cpp index d13ad9ef7..cf0b25a91 100644 --- a/src/thirdparty/unrar/hardlinks.cpp +++ b/src/thirdparty/unrar/hardlinks.cpp @@ -1,12 +1,12 @@ bool ExtractHardlink(wchar *NameNew,wchar *NameExisting,size_t NameExistingSize) { + SlashToNative(NameExisting,NameExisting,NameExistingSize); // Not needed for RAR 5.1+ archives. + if (!FileExist(NameExisting)) return false; CreatePath(NameNew,true); #ifdef _WIN_ALL - UnixSlashToDos(NameExisting,NameExisting,NameExistingSize); - bool Success=CreateHardLink(NameNew,NameExisting,NULL)!=0; if (!Success) { @@ -16,8 +16,6 @@ bool ExtractHardlink(wchar *NameNew,wchar *NameExisting,size_t NameExistingSize) } return Success; #elif defined(_UNIX) - DosSlashToUnix(NameExisting,NameExisting,NameExistingSize); - char NameExistingA[NM],NameNewA[NM]; WideToChar(NameExisting,NameExistingA,ASIZE(NameExistingA)); WideToChar(NameNew,NameNewA,ASIZE(NameNewA)); diff --git a/src/thirdparty/unrar/rawread.hpp b/src/thirdparty/unrar/rawread.hpp index 3bdf81256..646faf79d 100644 --- a/src/thirdparty/unrar/rawread.hpp +++ b/src/thirdparty/unrar/rawread.hpp @@ -51,7 +51,11 @@ inline uint RawGet2(const void *Data) inline uint RawGet4(const void *Data) { byte *D=(byte *)Data; +#if defined(BIG_ENDIAN) || !defined(ALLOW_MISALIGNED) || !defined(PRESENT_INT32) return D[0]+(D[1]<<8)+(D[2]<<16)+(D[3]<<24); +#else + return GET_UINT32(*(uint32 *)D); +#endif } inline uint64 RawGet8(const void *Data) @@ -74,10 +78,14 @@ inline void RawPut2(uint Field,void *Data) inline void RawPut4(uint Field,void *Data) { byte *D=(byte *)Data; +#if defined(BIG_ENDIAN) || !defined(ALLOW_MISALIGNED) || !defined(PRESENT_INT32) D[0]=(byte)(Field); D[1]=(byte)(Field>>8); D[2]=(byte)(Field>>16); D[3]=(byte)(Field>>24); +#else + *(uint32 *)D=Field; +#endif } diff --git a/src/thirdparty/unrar/sha1.cpp b/src/thirdparty/unrar/sha1.cpp index 5f182e563..647a827ae 100644 --- a/src/thirdparty/unrar/sha1.cpp +++ b/src/thirdparty/unrar/sha1.cpp @@ -193,7 +193,7 @@ uint blen = ((uint)len)<<3; #ifdef BIG_ENDIAN if (!handsoff) { - unsigned char *d=data+i; + unsigned char *d=(unsigned char *)(data+i); for (int k=0;k<64;k+=4) { byte b0=d[k],b1=d[k+1]; diff --git a/src/thirdparty/unrar/threadpool.cpp b/src/thirdparty/unrar/threadpool.cpp index 5bff0201e..732dd7537 100644 --- a/src/thirdparty/unrar/threadpool.cpp +++ b/src/thirdparty/unrar/threadpool.cpp @@ -15,6 +15,8 @@ ThreadPool::ThreadPool(uint MaxThreads) if (MaxAllowedThreads==0) MaxAllowedThreads=1; + ThreadsCreatedCount=0; + // If we have more threads than queue size, we'll hang on pool destroying, // not releasing all waiting threads. if (MaxAllowedThreads>ASIZE(TaskQueue)) @@ -41,15 +43,6 @@ ThreadPool::ThreadPool(uint MaxThreads) ErrHandler.Exit(RARX_FATAL); } - for(uint I=0;I<MaxAllowedThreads;I++) - { - ThreadHandles[I] = ThreadCreate(PoolThread, this); -#ifdef _WIN_ALL - if (ThreadPool::ThreadPriority!=THREAD_PRIORITY_NORMAL) - SetThreadPriority(ThreadHandles[I],ThreadPool::ThreadPriority); -#endif - } - QueueTop = 0; QueueBottom = 0; ActiveThreads = 0; @@ -73,13 +66,13 @@ ThreadPool::~ThreadPool() pthread_cond_broadcast(&QueuedTasksCntCond); #endif - for(uint I=0;I<MaxAllowedThreads;I++) + for(uint I=0;I<ThreadsCreatedCount;I++) { #ifdef _WIN_ALL // Waiting until the thread terminates. CWaitForSingleObject(ThreadHandles[I]); #endif - // Close the thread handle. In Unix it is results in pthread_join call, + // Close the thread handle. In Unix it results in pthread_join call, // which also waits for thread termination. ThreadClose(ThreadHandles[I]); } @@ -97,6 +90,20 @@ ThreadPool::~ThreadPool() } +void ThreadPool::CreateThreads() +{ + for(uint I=0;I<MaxAllowedThreads;I++) + { + ThreadHandles[I] = ThreadCreate(PoolThread, this); + ThreadsCreatedCount++; +#ifdef _WIN_ALL + if (ThreadPool::ThreadPriority!=THREAD_PRIORITY_NORMAL) + SetThreadPriority(ThreadHandles[I],ThreadPool::ThreadPriority); +#endif + } +} + + NATIVE_THREAD_TYPE ThreadPool::PoolThread(void *Param) { ((ThreadPool*)Param)->PoolThreadLoop(); @@ -156,9 +163,12 @@ bool ThreadPool::GetQueuedTask(QueueEntry *Task) // Add task to queue. We assume that it is always called from main thread, // it allows to avoid any locks here. We process collected tasks only -// when StartWait is called. +// when WaitDone is called. void ThreadPool::AddTask(PTHREAD_PROC Proc,void *Data) { + if (ThreadsCreatedCount == 0) + CreateThreads(); + // If queue is full, wait until it is empty. if ((QueueTop + 1) % ASIZE(TaskQueue) == QueueBottom) WaitDone(); diff --git a/src/thirdparty/unrar/threadpool.hpp b/src/thirdparty/unrar/threadpool.hpp index af3a01cdc..cdfc665e5 100644 --- a/src/thirdparty/unrar/threadpool.hpp +++ b/src/thirdparty/unrar/threadpool.hpp @@ -47,6 +47,7 @@ class ThreadPool void *Param; }; + void CreateThreads(); static NATIVE_THREAD_TYPE PoolThread(void *Param); void PoolThreadLoop(); bool GetQueuedTask(QueueEntry *Task); @@ -55,6 +56,9 @@ class ThreadPool uint MaxAllowedThreads; THREAD_HANDLE ThreadHandles[MaxPoolThreads]; + // Number of actually created threads. + uint ThreadsCreatedCount; + uint ActiveThreads; QueueEntry TaskQueue[MaxPoolThreads]; diff --git a/src/thirdparty/unrar/timefn.cpp b/src/thirdparty/unrar/timefn.cpp index 352a2d3ed..46f7d28b4 100644 --- a/src/thirdparty/unrar/timefn.cpp +++ b/src/thirdparty/unrar/timefn.cpp @@ -260,7 +260,6 @@ void RarTime::SetAgeText(const wchar *TimeText) } } SetCurrentTime(); - int64 RawTime=GetRaw(); SetRaw(itime-uint64(Seconds)*10000000); } #endif diff --git a/src/thirdparty/unrar/ulinks.cpp b/src/thirdparty/unrar/ulinks.cpp index cbbd8ad1c..f36d6afe3 100644 --- a/src/thirdparty/unrar/ulinks.cpp +++ b/src/thirdparty/unrar/ulinks.cpp @@ -55,8 +55,10 @@ bool ExtractUnixLink50(const wchar *Name,FileHeader *hd) if (hd->RedirType==FSREDIR_WINSYMLINK || hd->RedirType==FSREDIR_JUNCTION) { // Cannot create Windows absolute path symlinks in Unix. Only relative path - // Windows symlinks can be created here. - if (strncmp(Target,"\\??\\",4)==0) + // Windows symlinks can be created here. RAR 5.0 used \??\ prefix + // for Windows absolute symlinks, since RAR 5.1 /??/ is used. + // We escape ? as \? to avoid "trigraph" warning + if (strncmp(Target,"\\??\\",4)==0 || strncmp(Target,"/\?\?/",4)==0) return false; DosSlashToUnix(Target,Target,ASIZE(Target)); } diff --git a/src/thirdparty/unrar/unpack.cpp b/src/thirdparty/unrar/unpack.cpp index be9ff7da6..a7f19805c 100644 --- a/src/thirdparty/unrar/unpack.cpp +++ b/src/thirdparty/unrar/unpack.cpp @@ -91,7 +91,7 @@ void Unpack::Init(size_t WinSize,bool Solid) if (Grow && Fragmented) throw std::bad_alloc(); - byte *NewWindow=(byte *)malloc(WinSize); + byte *NewWindow=Fragmented ? NULL : (byte *)malloc(WinSize); if (NewWindow==NULL) if (Grow || WinSize<0x1000000) @@ -102,6 +102,11 @@ void Unpack::Init(size_t WinSize,bool Solid) } else { + if (Window!=NULL) // If allocated by preceding files. + { + free(Window); + Window=NULL; + } FragWindow.Init(WinSize); Fragmented=true; } diff --git a/src/thirdparty/unrar/unpack.hpp b/src/thirdparty/unrar/unpack.hpp index 2907e8c80..b051866f8 100644 --- a/src/thirdparty/unrar/unpack.hpp +++ b/src/thirdparty/unrar/unpack.hpp @@ -133,8 +133,8 @@ struct UnpackFilter uint BlockStart; uint BlockLength; byte Channels; - uint Width; - byte PosR; +// uint Width; +// byte PosR; bool NextWindow; }; @@ -171,6 +171,8 @@ class FragmentedWindow { private: enum {MAX_MEM_BLOCKS=32}; + + void Reset(); byte *Mem[MAX_MEM_BLOCKS]; size_t MemSize[MAX_MEM_BLOCKS]; public: @@ -192,8 +194,6 @@ class Unpack:PackDef void Unpack5MT(bool Solid); bool UnpReadBuf(); void UnpWriteBuf(); - uint FilterItanium_GetBits(byte *Data,int BitPos,int BitCount); - void FilterItanium_SetBits(byte *Data,uint BitField,int BitPos,int BitCount); byte* ApplyFilter(byte *Data,uint DataSize,UnpackFilter *Flt); void UnpWriteArea(size_t StartPtr,size_t EndPtr); void UnpWriteData(byte *Data,size_t Size); diff --git a/src/thirdparty/unrar/unpack50.cpp b/src/thirdparty/unrar/unpack50.cpp index 1b184c4f1..d1188ee85 100644 --- a/src/thirdparty/unrar/unpack50.cpp +++ b/src/thirdparty/unrar/unpack50.cpp @@ -177,21 +177,12 @@ bool Unpack::ReadFilter(BitInput &Inp,UnpackFilter &Filter) Filter.Type=Inp.fgetbits()>>13; Inp.faddbits(3); - if (Filter.Type==FILTER_DELTA || Filter.Type==FILTER_AUDIO) + if (Filter.Type==FILTER_DELTA) { Filter.Channels=(Inp.fgetbits()>>11)+1; Inp.faddbits(5); } - if (Filter.Type==FILTER_RGB) - { - Filter.Channels=3; - Filter.Width=Inp.fgetbits()+1; - Inp.faddbits(16); - Filter.PosR=Inp.fgetbits()>>14; - Inp.faddbits(2); - } - return true; } @@ -392,62 +383,6 @@ void Unpack::UnpWriteBuf() } -uint Unpack::FilterItanium_GetBits(byte *Data,int BitPos,int BitCount) -{ - int InAddr=BitPos/8; - int InBit=BitPos&7; - uint BitField=(uint)Data[InAddr++]; - BitField|=(uint)Data[InAddr++] << 8; - BitField|=(uint)Data[InAddr++] << 16; - BitField|=(uint)Data[InAddr] << 24; - BitField >>= InBit; - return(BitField & (0xffffffff>>(32-BitCount))); -} - - -void Unpack::FilterItanium_SetBits(byte *Data,uint BitField,int BitPos,int BitCount) -{ - int InAddr=BitPos/8; - int InBit=BitPos&7; - uint AndMask=0xffffffff>>(32-BitCount); - AndMask=~(AndMask<<InBit); - - BitField<<=InBit; - - for (uint I=0;I<4;I++) - { - Data[InAddr+I]&=AndMask; - Data[InAddr+I]|=BitField; - AndMask=(AndMask>>8)|0xff000000; - BitField>>=8; - } -} - - -inline uint GetFiltData32(byte *Data) -{ -#if defined(BIG_ENDIAN) || !defined(ALLOW_MISALIGNED) || !defined(PRESENT_INT32) - uint Value=GET_UINT32((uint)Data[0]|((uint)Data[1]<<8)|((uint)Data[2]<<16)|((uint)Data[3]<<24)); -#else - uint Value=GET_UINT32(*(uint32 *)Data); -#endif - return Value; -} - - -inline void SetFiltData32(byte *Data,uint Value) -{ -#if defined(BIG_ENDIAN) || !defined(ALLOW_MISALIGNED) || !defined(PRESENT_INT32) - Data[0]=(byte)Value; - Data[1]=(byte)(Value>>8); - Data[2]=(byte)(Value>>16); - Data[3]=(byte)(Value>>24); -#else - *(int32 *)Data=Value; -#endif -} - - byte* Unpack::ApplyFilter(byte *Data,uint DataSize,UnpackFilter *Flt) { byte *SrcData=Data; @@ -467,18 +402,18 @@ byte* Unpack::ApplyFilter(byte *Data,uint DataSize,UnpackFilter *Flt) if (CurByte==0xe8 || CurByte==CmpByte2) { uint Offset=(CurPos+FileOffset)%FileSize; - uint Addr=GetFiltData32(Data); + uint Addr=RawGet4(Data); // We check 0x80000000 bit instead of '< 0' comparison // not assuming int32 presence or uint size and endianness. if ((Addr & 0x80000000)!=0) // Addr<0 { if (((Addr+Offset) & 0x80000000)==0) // Addr+Offset>=0 - SetFiltData32(Data,Addr+FileSize); + RawPut4(Addr+FileSize,Data); } else if (((Addr-FileSize) & 0x80000000)!=0) // Addr<FileSize - SetFiltData32(Data,Addr-Offset); + RawPut4(Addr-Offset,Data); Data+=4; CurPos+=4; @@ -503,109 +438,6 @@ byte* Unpack::ApplyFilter(byte *Data,uint DataSize,UnpackFilter *Flt) } } return SrcData; - case FILTER_ITANIUM: - { - uint FileOffset=(uint)WrittenFileSize; - - uint CurPos=0; - - FileOffset>>=4; - - while ((int)CurPos<(int)DataSize-21) - { - int Byte=(Data[0]&0x1f)-0x10; - if (Byte>=0) - { - static byte Masks[16]={4,4,6,6,0,0,7,7,4,4,0,0,4,4,0,0}; - byte CmdMask=Masks[Byte]; - if (CmdMask!=0) - for (int I=0;I<=2;I++) - if (CmdMask & (1<<I)) - { - int StartPos=I*41+5; - int OpType=FilterItanium_GetBits(Data,StartPos+37,4); - if (OpType==5) - { - int Offset=FilterItanium_GetBits(Data,StartPos+13,20); - FilterItanium_SetBits(Data,(Offset-FileOffset)&0xfffff,StartPos+13,20); - } - } - } - Data+=16; - CurPos+=16; - FileOffset++; - } - } - return SrcData; - case FILTER_AUDIO: - { - uint Channels=Flt->Channels; - - byte *SrcData=Data; - - FilterDstMemory.Alloc(DataSize); - byte *DstData=&FilterDstMemory[0]; - - for (uint CurChannel=0;CurChannel<Channels;CurChannel++) - { - uint PrevByte=0,PrevDelta=0,Dif[7]; - int D1=0,D2=0,D3; - int K1=0,K2=0,K3=0; - memset(Dif,0,sizeof(Dif)); - - for (uint I=CurChannel,ByteCount=0;I<DataSize;I+=Channels,ByteCount++) - { - D3=D2; - D2=PrevDelta-D1; - D1=PrevDelta; - - uint Predicted=8*PrevByte+K1*D1+K2*D2+K3*D3; - Predicted=(Predicted>>3) & 0xff; - - uint CurByte=*(SrcData++); - - Predicted-=CurByte; - DstData[I]=Predicted; - PrevDelta=(signed char)(Predicted-PrevByte); - PrevByte=Predicted; - - int D=((signed char)CurByte)<<3; - - Dif[0]+=abs(D); - Dif[1]+=abs(D-D1); - Dif[2]+=abs(D+D1); - Dif[3]+=abs(D-D2); - Dif[4]+=abs(D+D2); - Dif[5]+=abs(D-D3); - Dif[6]+=abs(D+D3); - - if ((ByteCount & 0x1f)==0) - { - uint MinDif=Dif[0],NumMinDif=0; - Dif[0]=0; - for (uint J=1;J<ASIZE(Dif);J++) - { - if (Dif[J]<MinDif) - { - MinDif=Dif[J]; - NumMinDif=J; - } - Dif[J]=0; - } - switch(NumMinDif) - { - case 1: if (K1>=-16) K1--; break; - case 2: if (K1 < 16) K1++; break; - case 3: if (K2>=-16) K2--; break; - case 4: if (K2 < 16) K2++; break; - case 5: if (K3>=-16) K3--; break; - case 6: if (K3 < 16) K3++; break; - } - } - } - } - return DstData; - } case FILTER_DELTA: { uint Channels=Flt->Channels,SrcPos=0; @@ -623,55 +455,6 @@ byte* Unpack::ApplyFilter(byte *Data,uint DataSize,UnpackFilter *Flt) } return DstData; } - case FILTER_RGB: - { - uint Width=Flt->Width,PosR=Flt->PosR; - - byte *SrcData=Data; - - FilterDstMemory.Alloc(DataSize); - byte *DstData=&FilterDstMemory[0]; - - const int Channels=3; - - for (uint CurChannel=0;CurChannel<Channels;CurChannel++) - { - uint PrevByte=0; - - for (uint I=CurChannel;I<DataSize;I+=Channels) - { - uint Predicted; - int UpperPos=I-Width; - if (UpperPos>=3) - { - byte *UpperData=DstData+UpperPos; - uint UpperByte=*UpperData; - uint UpperLeftByte=*(UpperData-3); - Predicted=PrevByte+UpperByte-UpperLeftByte; - int pa=abs((int)(Predicted-PrevByte)); - int pb=abs((int)(Predicted-UpperByte)); - int pc=abs((int)(Predicted-UpperLeftByte)); - if (pa<=pb && pa<=pc) - Predicted=PrevByte; - else - if (pb<=pc) - Predicted=UpperByte; - else - Predicted=UpperLeftByte; - } - else - Predicted=PrevByte; - DstData[I]=PrevByte=(byte)(Predicted-*(SrcData++)); - } - } - for (uint I=PosR,Border=DataSize-2;I<Border;I+=3) - { - byte G=DstData[I+1]; - DstData[I]+=G; - DstData[I+2]+=G; - } - return DstData; - } } return NULL; diff --git a/src/thirdparty/unrar/unpack50frag.cpp b/src/thirdparty/unrar/unpack50frag.cpp index 149e182fb..745b1b308 100644 --- a/src/thirdparty/unrar/unpack50frag.cpp +++ b/src/thirdparty/unrar/unpack50frag.cpp @@ -7,14 +7,25 @@ FragmentedWindow::FragmentedWindow() FragmentedWindow::~FragmentedWindow() { + Reset(); +} + + +void FragmentedWindow::Reset() +{ for (uint I=0;I<ASIZE(Mem);I++) if (Mem[I]!=NULL) + { free(Mem[I]); + Mem[I]=NULL; + } } void FragmentedWindow::Init(size_t WinSize) { + Reset(); + uint BlockNum=0; size_t TotalSize=0; // Already allocated. while (TotalSize<WinSize && BlockNum<ASIZE(Mem)) diff --git a/src/thirdparty/unrar/unpack50mt.cpp b/src/thirdparty/unrar/unpack50mt.cpp index 98891ba15..6015379cc 100644 --- a/src/thirdparty/unrar/unpack50mt.cpp +++ b/src/thirdparty/unrar/unpack50mt.cpp @@ -415,12 +415,6 @@ void Unpack::UnpackDecode(UnpackThreadData &D) CurItem->Length=Filter.Channels; CurItem->Distance=Filter.BlockLength; - CurItem=D.Decoded+D.DecodedSize++; - - CurItem->Type=UNPDT_FILTER; - CurItem->Length=Filter.PosR; - CurItem->Distance=Filter.Width; - continue; } if (MainSlot==257) @@ -504,11 +498,6 @@ bool Unpack::ProcessDecoded(UnpackThreadData &D) Filter.Channels=(byte)Item->Length; Filter.BlockLength=Item->Distance; - Item++; - - Filter.PosR=(byte)Item->Length; - Filter.Width=Item->Distance; - AddFilter(Filter); } Item++; diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp index 4dd805fcb..827c14da5 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 1 -#define RARVER_DAY 17 -#define RARVER_MONTH 3 +#define RARVER_BETA 2 +#define RARVER_DAY 5 +#define RARVER_MONTH 4 #define RARVER_YEAR 2014 |