Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2014-05-03 12:11:47 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2014-05-05 01:16:15 +0400
commitf52409d3c04bf5dfa501798e88d536074cdde1d9 (patch)
tree5ac43b4fb6ccca3204c57bbe763fb6987b9099b0 /src/thirdparty/unrar
parent0b2ede906f21b4e19bf14a8c1cf916c61ef795a4 (diff)
Update unrar to v5.1.4.
5.1.4.tar.gz - 5.10.3 in the rc file...
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r--src/thirdparty/unrar/consio.cpp4
-rw-r--r--src/thirdparty/unrar/dll.rc8
-rw-r--r--src/thirdparty/unrar/pathfn.cpp8
-rw-r--r--src/thirdparty/unrar/rdwrfn.cpp48
-rw-r--r--src/thirdparty/unrar/timefn.cpp18
-rw-r--r--src/thirdparty/unrar/uiconsole.cpp6
-rw-r--r--src/thirdparty/unrar/version.hpp4
-rw-r--r--src/thirdparty/unrar/volume.cpp19
8 files changed, 89 insertions, 26 deletions
diff --git a/src/thirdparty/unrar/consio.cpp b/src/thirdparty/unrar/consio.cpp
index f372db398..55cb5ce50 100644
--- a/src/thirdparty/unrar/consio.cpp
+++ b/src/thirdparty/unrar/consio.cpp
@@ -243,6 +243,10 @@ bool getwstr(wchar *str,size_t n)
#ifndef SILENT
+// We allow this function to return 0 in case of invalid input,
+// because it might be convenient to press Enter to some not dangerous
+// prompts like "insert disk with next volume". We should call this function
+// again in case of 0 in dangerous prompt such as overwriting file.
int Ask(const wchar *AskStr)
{
uiAlarm(UIALARM_QUESTION);
diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc
index 05132c9b1..a2883159b 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, 2, 1192
-PRODUCTVERSION 5, 10, 2, 1192
+FILEVERSION 5, 10, 3, 1216
+PRODUCTVERSION 5, 10, 3, 1216
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.2\0"
- VALUE "ProductVersion", "5.10.2\0"
+ VALUE "FileVersion", "5.10.3\0"
+ VALUE "ProductVersion", "5.10.3\0"
VALUE "LegalCopyright", "Copyright © Alexander Roshal 1993-2014\0"
VALUE "OriginalFilename", "Unrar.dll\0"
}
diff --git a/src/thirdparty/unrar/pathfn.cpp b/src/thirdparty/unrar/pathfn.cpp
index 9f55f480c..44259ed49 100644
--- a/src/thirdparty/unrar/pathfn.cpp
+++ b/src/thirdparty/unrar/pathfn.cpp
@@ -766,7 +766,15 @@ static void GenArcName(wchar *ArcName,wchar *GenerateMask,uint ArcNumber,bool &A
}
const wchar *ChPtr=wcschr(MaskChars,toupperw(Mask[I]));
if (ChPtr==NULL || QuoteMode)
+ {
DateText[J]=Mask[I];
+#ifdef _WIN_ALL
+ // We do not allow ':' in Windows because of NTFS streams.
+ // Users had problems after specifying hh:mm mask.
+ if (DateText[J]==':')
+ DateText[J]='_';
+#endif
+ }
else
{
size_t FieldPos=ChPtr-MaskChars;
diff --git a/src/thirdparty/unrar/rdwrfn.cpp b/src/thirdparty/unrar/rdwrfn.cpp
index eb561481e..50c715d3c 100644
--- a/src/thirdparty/unrar/rdwrfn.cpp
+++ b/src/thirdparty/unrar/rdwrfn.cpp
@@ -44,8 +44,9 @@ int ComprDataIO::UnpRead(byte *Addr,size_t Count)
// block size. We can do it by simple masking, because unpack read code
// always reads more than CRYPT_BLOCK_SIZE, so we do not risk to make it 0.
if (Decryption)
- Count&=~CRYPT_BLOCK_MASK;
+ Count &= ~CRYPT_BLOCK_MASK;
#endif
+
int ReadSize=0,TotalRead=0;
byte *ReadAddr;
ReadAddr=Addr;
@@ -62,14 +63,30 @@ int ComprDataIO::UnpRead(byte *Addr,size_t Count)
else
{
size_t SizeToRead=((int64)Count>UnpPackedSize) ? (size_t)UnpPackedSize:Count;
- if (SizeToRead==0)
- return 0;
- if (!SrcFile->IsOpened())
- return(-1);
- ReadSize=SrcFile->Read(ReadAddr,SizeToRead);
- FileHeader *hd=SubHead!=NULL ? SubHead:&SrcArc->FileHead;
- if (hd->SplitAfter)
- PackedDataHash.Update(ReadAddr,ReadSize);
+ if (SizeToRead > 0)
+ {
+ if (UnpVolume && Decryption && (int64)Count>UnpPackedSize)
+ {
+ // We need aligned blocks for decryption and we want "Keep broken
+ // files" to work efficiently with missing encrypted volumes.
+ // So for last data block in volume we adjust the size to read to
+ // next equal or smaller block producing aligned total block size.
+ // So we'll ask for next volume only when processing few unaligned
+ // bytes left in the end, when most of data is already extracted.
+ size_t NewTotalRead = TotalRead + SizeToRead;
+ size_t Adjust = NewTotalRead - (NewTotalRead & ~CRYPT_BLOCK_MASK);
+ size_t NewSizeToRead = SizeToRead - Adjust;
+ if ((int)NewSizeToRead > 0)
+ SizeToRead = NewSizeToRead;
+ }
+
+ if (!SrcFile->IsOpened())
+ return -1;
+ ReadSize=SrcFile->Read(ReadAddr,SizeToRead);
+ FileHeader *hd=SubHead!=NULL ? SubHead:&SrcArc->FileHead;
+ if (hd->SplitAfter)
+ PackedDataHash.Update(ReadAddr,ReadSize);
+ }
}
CurUnpRead+=ReadSize;
TotalRead+=ReadSize;
@@ -80,14 +97,23 @@ int ComprDataIO::UnpRead(byte *Addr,size_t Count)
Count-=ReadSize;
#endif
UnpPackedSize-=ReadSize;
- if (UnpPackedSize == 0 && UnpVolume)
+
+ // Do not ask for next volume if we read something from current volume.
+ // If next volume is missing, we need to process all data from current
+ // volume before aborting. It helps to recover all possible data
+ // in "Keep broken files" mode. But if we process encrypted data,
+ // we ask for next volume also if we have non-aligned encryption block.
+ // Since we adjust data size for decryption earlier above,
+ // it does not hurt "Keep broken files" mode efficiency.
+ if (UnpVolume && UnpPackedSize == 0 &&
+ (ReadSize==0 || Decryption && (TotalRead & CRYPT_BLOCK_MASK) != 0) )
{
#ifndef NOVOLUME
if (!MergeArchive(*SrcArc,this,true,CurrentCommand))
#endif
{
NextVolumeMissing=true;
- return(-1);
+ return -1;
}
}
else
diff --git a/src/thirdparty/unrar/timefn.cpp b/src/thirdparty/unrar/timefn.cpp
index 46f7d28b4..217df0328 100644
--- a/src/thirdparty/unrar/timefn.cpp
+++ b/src/thirdparty/unrar/timefn.cpp
@@ -50,6 +50,15 @@ void RarTime::GetLocal(RarLocalTime *lt)
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);
lt->Year=st.wYear;
@@ -119,6 +128,15 @@ void RarTime::SetLocal(RarLocalTime *lt)
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);
+
*this=ft;
}
else
diff --git a/src/thirdparty/unrar/uiconsole.cpp b/src/thirdparty/unrar/uiconsole.cpp
index d242cce3d..5ddaf09f4 100644
--- a/src/thirdparty/unrar/uiconsole.cpp
+++ b/src/thirdparty/unrar/uiconsole.cpp
@@ -3,7 +3,11 @@ UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTi
{
bool AllowRename=(Flags & UIASKREP_F_NORENAME)==0;
eprintf(St(MFileExists),Name);
- int Choice=Ask(St(AllowRename ? MYesNoAllRenQ : MYesNoAllQ));
+ int Choice=0;
+ do
+ {
+ Choice=Ask(St(AllowRename ? MYesNoAllRenQ : MYesNoAllQ));
+ } while (Choice==0); // 0 means invalid input.
switch(Choice)
{
case 1:
diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp
index 827c14da5..6d7066baa 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 2
-#define RARVER_DAY 5
+#define RARVER_BETA 3
+#define RARVER_DAY 29
#define RARVER_MONTH 4
#define RARVER_YEAR 2014
diff --git a/src/thirdparty/unrar/volume.cpp b/src/thirdparty/unrar/volume.cpp
index 566c6f94c..d89c4db7c 100644
--- a/src/thirdparty/unrar/volume.cpp
+++ b/src/thirdparty/unrar/volume.cpp
@@ -188,25 +188,28 @@ bool DllVolChange(RAROptions *Cmd,wchar *NextName,size_t NameSize)
if (Cmd->Callback!=NULL)
{
- wchar CurName[NM];
- wcscpy(CurName,NextName);
+ wchar OrgNextName[NM];
+ wcscpy(OrgNextName,NextName);
if (Cmd->Callback(UCM_CHANGEVOLUMEW,Cmd->UserData,(LPARAM)NextName,RAR_VOL_ASK)==-1)
DllVolAborted=true;
else
- if (wcscmp(CurName,NextName)!=0)
+ if (wcscmp(OrgNextName,NextName)!=0)
DllVolChanged=true;
else
{
- char NextNameA[NM];
+ char NextNameA[NM],OrgNextNameA[NM];
WideToChar(NextName,NextNameA,ASIZE(NextNameA));
+ strcpy(OrgNextNameA,NextNameA);
if (Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextNameA,RAR_VOL_ASK)==-1)
DllVolAborted=true;
else
- {
- CharToWide(NextNameA,NextName,NameSize);
- if (wcscmp(CurName,NextName)!=0)
+ if (strcmp(OrgNextNameA,NextNameA)!=0)
+ {
+ // We can damage some Unicode characters by U->A->U conversion,
+ // so set Unicode name only if we see that ANSI name is changed.
+ CharToWide(NextNameA,NextName,NameSize);
DllVolChanged=true;
- }
+ }
}
}
if (!DllVolChanged && Cmd->ChangeVolProc!=NULL)