diff options
author | XhmikosR <xhmikosr@gmail.com> | 2014-11-03 20:58:35 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2014-11-11 22:54:31 +0300 |
commit | 7c45b2cd031940bce1315f34a51424e9625b2080 (patch) | |
tree | 596ebb8dfd067e7f74229a0d2a29ceae4245e3f7 /src/thirdparty/unrar | |
parent | adf4331c84b71e130a0f7b260f7942b99ef2f3f7 (diff) |
Update Unrar to v5.2.2.
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r-- | src/thirdparty/unrar/arcread.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.rc | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/extract.cpp | 16 | ||||
-rw-r--r-- | src/thirdparty/unrar/file.cpp | 38 | ||||
-rw-r--r-- | src/thirdparty/unrar/file.hpp | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/filefn.cpp | 23 | ||||
-rw-r--r-- | src/thirdparty/unrar/list.cpp | 4 | ||||
-rw-r--r-- | src/thirdparty/unrar/version.hpp | 6 |
8 files changed, 64 insertions, 41 deletions
diff --git a/src/thirdparty/unrar/arcread.cpp b/src/thirdparty/unrar/arcread.cpp index 284fa0c25..e4c3f87d5 100644 --- a/src/thirdparty/unrar/arcread.cpp +++ b/src/thirdparty/unrar/arcread.cpp @@ -811,7 +811,7 @@ size_t Archive::ReadHeader50() Raw.GetB((byte *)FileName,ReadNameSize); FileName[ReadNameSize]=0; - UtfToWide(FileName,hd->FileName,ASIZE(hd->FileName)-1); + UtfToWide(FileName,hd->FileName,ASIZE(hd->FileName)); // Should do it before converting names, because extra fields can // affect name processing, like in case of NTFS streams. diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc index fe5cd4f06..4c378030b 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, 20, 1, 1376
-PRODUCTVERSION 5, 20, 1, 1376
+FILEVERSION 5, 20, 3, 1404
+PRODUCTVERSION 5, 20, 3, 1404
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.20.1\0"
- VALUE "ProductVersion", "5.20.1\0"
+ VALUE "FileVersion", "5.20.3\0"
+ VALUE "ProductVersion", "5.20.3\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 f2b695bf3..cab669fe9 100644 --- a/src/thirdparty/unrar/extract.cpp +++ b/src/thirdparty/unrar/extract.cpp @@ -50,6 +50,10 @@ void CmdExtract::DoExtract() DataIO.ProcessedArcSize+=FD.Size;
}
+ // Clean user entered password. Not really required, just for extra safety.
+ if (Cmd->ManualPassword)
+ Cmd->Password.Clean();
+
if (TotalFileCount==0 && Cmd->Command[0]!='I' &&
ErrHandler.GetErrorCode()!=RARX_BADPWD) // Not in case of wrong archive password.
{
@@ -256,15 +260,11 @@ bool CmdExtract::ExtractCurrentFile(Archive &Arc,size_t HeaderSize,bool &Repeat) int MatchNumber=Cmd->IsProcessFile(Arc.FileHead,&EqualNames,MatchType);
bool ExactMatch=MatchNumber!=0;
#ifndef SFX_MODULE
- if (*Cmd->ArcPath==0 && Cmd->ExclPath==EXCL_BASEPATH)
+ if (*Cmd->ArcPath==0 && Cmd->ExclPath==EXCL_BASEPATH && ExactMatch)
{
- *Cmd->ArcPath=0;
- if (ExactMatch)
- {
- Cmd->FileArgs.Rewind();
- if (Cmd->FileArgs.GetString(Cmd->ArcPath,ASIZE(Cmd->ArcPath),MatchNumber-1))
- *PointToName(Cmd->ArcPath)=0;
- }
+ Cmd->FileArgs.Rewind();
+ if (Cmd->FileArgs.GetString(Cmd->ArcPath,ASIZE(Cmd->ArcPath),MatchNumber-1))
+ *PointToName(Cmd->ArcPath)=0;
}
#endif
if (ExactMatch && !EqualNames)
diff --git a/src/thirdparty/unrar/file.cpp b/src/thirdparty/unrar/file.cpp index 4c4b9485f..8fba34adb 100644 --- a/src/thirdparty/unrar/file.cpp +++ b/src/thirdparty/unrar/file.cpp @@ -2,7 +2,7 @@ File::File() { - hFile=BAD_HANDLE; + hFile=FILE_BAD_HANDLE; *FileName=0; NewFile=false; LastWrite=false; @@ -22,7 +22,7 @@ File::File() File::~File() { - if (hFile!=BAD_HANDLE && !SkipClose) + if (hFile!=FILE_BAD_HANDLE && !SkipClose) if (NewFile) Delete(); else @@ -59,7 +59,7 @@ bool File::Open(const wchar *Name,uint Mode) hNewFile=CreateFile(Name,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); DWORD LastError; - if (hNewFile==BAD_HANDLE) + if (hNewFile==FILE_BAD_HANDLE) { LastError=GetLastError(); @@ -85,7 +85,7 @@ bool File::Open(const wchar *Name,uint Mode) } } - if (hNewFile==BAD_HANDLE && LastError==ERROR_FILE_NOT_FOUND) + if (hNewFile==FILE_BAD_HANDLE && LastError==ERROR_FILE_NOT_FOUND) ErrorType=FILE_NOTFOUND; #else int flags=UpdateMode ? O_RDWR:(WriteMode ? O_WRONLY:O_RDONLY); @@ -112,7 +112,7 @@ bool File::Open(const wchar *Name,uint Mode) } #endif if (handle==-1) - hNewFile=BAD_HANDLE; + hNewFile=FILE_BAD_HANDLE; else { #ifdef FILE_USE_OPEN @@ -121,13 +121,13 @@ bool File::Open(const wchar *Name,uint Mode) hNewFile=fdopen(handle,UpdateMode ? UPDATEBINARY:READBINARY); #endif } - if (hNewFile==BAD_HANDLE && errno==ENOENT) + if (hNewFile==FILE_BAD_HANDLE && errno==ENOENT) ErrorType=FILE_NOTFOUND; #endif NewFile=false; HandleType=FILE_HANDLENORMAL; SkipClose=false; - bool Success=hNewFile!=BAD_HANDLE; + bool Success=hNewFile!=FILE_BAD_HANDLE; if (Success) { hFile=hNewFile; @@ -174,11 +174,11 @@ bool File::Create(const wchar *Name,uint Mode) bool Special=*LastChar=='.' || *LastChar==' '; if (Special) - hFile=BAD_HANDLE; + hFile=FILE_BAD_HANDLE; else hFile=CreateFile(Name,Access,ShareMode,NULL,CREATE_ALWAYS,0,NULL); - if (hFile==BAD_HANDLE) + if (hFile==FILE_BAD_HANDLE) { wchar LongName[NM]; if (GetWinLongPath(Name,LongName,ASIZE(LongName))) @@ -190,6 +190,10 @@ bool File::Create(const wchar *Name,uint Mode) WideToChar(Name,NameA,ASIZE(NameA)); #ifdef FILE_USE_OPEN hFile=open(NameA,(O_CREAT|O_TRUNC) | (WriteMode ? O_WRONLY : O_RDWR)); +#ifdef _ANDROID + if (hFile==FILE_BAD_HANDLE) + hFile=JniCreateFile(Name); // If external card is read-only for usual file API. +#endif #else hFile=fopen(NameA,WriteMode ? WRITEBINARY:CREATEBINARY); #endif @@ -198,7 +202,7 @@ bool File::Create(const wchar *Name,uint Mode) HandleType=FILE_HANDLENORMAL; SkipClose=false; wcsncpyz(FileName,Name,ASIZE(FileName)); - return hFile!=BAD_HANDLE; + return hFile!=FILE_BAD_HANDLE; } @@ -224,7 +228,7 @@ bool File::Close() { bool Success=true; - if (hFile!=BAD_HANDLE) + if (hFile!=FILE_BAD_HANDLE) { if (!SkipClose) { @@ -241,7 +245,7 @@ bool File::Close() #endif #endif } - hFile=BAD_HANDLE; + hFile=FILE_BAD_HANDLE; } HandleType=FILE_HANDLENORMAL; if (!Success && AllowExceptions) @@ -254,7 +258,7 @@ bool File::Delete() { if (HandleType!=FILE_HANDLENORMAL) return false; - if (hFile!=BAD_HANDLE) + if (hFile!=FILE_BAD_HANDLE) Close(); if (!AllowDelete) return false; @@ -287,7 +291,7 @@ void File::Write(const void *Data,size_t Size) hFile=GetStdHandle(STD_OUTPUT_HANDLE); #else // Cannot use the standard stdout here, because it already has wide orientation. - if (hFile==BAD_HANDLE) + if (hFile==FILE_BAD_HANDLE) { #ifdef FILE_USE_OPEN hFile=dup(STDOUT_FILENO); // Open new stdout stream. @@ -465,7 +469,7 @@ void File::Seek(int64 Offset,int Method) bool File::RawSeek(int64 Offset,int Method) { - if (hFile==BAD_HANDLE) + if (hFile==FILE_BAD_HANDLE) return true; if (Offset<0 && Method!=SEEK_SET) { @@ -496,7 +500,7 @@ bool File::RawSeek(int64 Offset,int Method) int64 File::Tell() { - if (hFile==BAD_HANDLE) + if (hFile==FILE_BAD_HANDLE) if (AllowExceptions) ErrHandler.SeekError(FileName); else @@ -647,7 +651,7 @@ int64 File::FileLength() bool File::IsDevice() { - if (hFile==BAD_HANDLE) + if (hFile==FILE_BAD_HANDLE) return false; #ifdef _WIN_ALL uint Type=GetFileType(hFile); diff --git a/src/thirdparty/unrar/file.hpp b/src/thirdparty/unrar/file.hpp index 350537a05..93aac89f3 100644 --- a/src/thirdparty/unrar/file.hpp +++ b/src/thirdparty/unrar/file.hpp @@ -7,13 +7,13 @@ #ifdef _WIN_ALL typedef HANDLE FileHandle; - #define BAD_HANDLE INVALID_HANDLE_VALUE + #define FILE_BAD_HANDLE INVALID_HANDLE_VALUE #elif defined(FILE_USE_OPEN) typedef off_t FileHandle; - #define BAD_HANDLE -1 + #define FILE_BAD_HANDLE -1 #else typedef FILE* FileHandle; - #define BAD_HANDLE NULL + #define FILE_BAD_HANDLE NULL #endif class RAROptions; @@ -94,7 +94,7 @@ class File void SetCloseFileTime(RarTime *ftm,RarTime *fta=NULL); static void SetCloseFileTimeByName(const wchar *Name,RarTime *ftm,RarTime *fta); void GetOpenFileTime(RarTime *ft); - bool IsOpened() {return hFile!=BAD_HANDLE;}; + bool IsOpened() {return hFile!=FILE_BAD_HANDLE;}; int64 FileLength(); void SetHandleType(FILE_HANDLETYPE Type) {HandleType=Type;} FILE_HANDLETYPE GetHandleType() {return HandleType;} diff --git a/src/thirdparty/unrar/filefn.cpp b/src/thirdparty/unrar/filefn.cpp index e1baca9ab..6526f4337 100644 --- a/src/thirdparty/unrar/filefn.cpp +++ b/src/thirdparty/unrar/filefn.cpp @@ -29,6 +29,10 @@ MKDIR_CODE MakeDir(const wchar *Name,bool SetAttr,uint Attr) WideToChar(Name,NameA,ASIZE(NameA)); mode_t uattr=SetAttr ? (mode_t)Attr:0777; int ErrCode=mkdir(NameA,uattr); +#ifdef _ANDROID + if (ErrCode==-1 && errno!=ENOENT) + ErrCode=JniMkdir(Name) ? 0 : -1; // If external card is read-only for usual file API. +#endif if (ErrCode==-1) return errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR; return MKDIR_SUCCESS; @@ -58,8 +62,9 @@ bool CreatePath(const wchar *Path,bool SkipLastName) break; // Process all kinds of path separators, so user can enter Unix style - // path in Windows or Windows in Unix. - if (IsPathDiv(*s)) + // path in Windows or Windows in Unix. s>Path check avoids attempting + // creating an empty directory for paths starting from path separator. + if (IsPathDiv(*s) && s>Path) { #ifdef _WIN_ALL // We must not attempt to create "D:" directory, because first @@ -411,7 +416,12 @@ bool RenameFile(const wchar *SrcName,const wchar *DestName) char SrcNameA[NM],DestNameA[NM]; WideToChar(SrcName,SrcNameA,ASIZE(SrcNameA)); WideToChar(DestName,DestNameA,ASIZE(DestNameA)); - return rename(SrcNameA,DestNameA)==0; + bool Success=rename(SrcNameA,DestNameA)==0; +#ifdef _ANDROID + if (!Success) + Success=JniRename(SrcName,DestName); // If external card is read-only for usual file API. +#endif + return Success; #endif } @@ -430,7 +440,12 @@ bool DelFile(const wchar *Name) #else char NameA[NM]; WideToChar(Name,NameA,ASIZE(NameA)); - return remove(NameA)==0; + bool Success=remove(NameA)==0; +#ifdef _ANDROID + if (!Success) + Success=JniDelete(Name); +#endif + return Success; #endif } diff --git a/src/thirdparty/unrar/list.cpp b/src/thirdparty/unrar/list.cpp index 5825c7bf5..d64e274a6 100644 --- a/src/thirdparty/unrar/list.cpp +++ b/src/thirdparty/unrar/list.cpp @@ -165,6 +165,10 @@ void ListArchive(CommandData *Cmd) } } + // Clean user entered password. Not really required, just for extra safety. + if (Cmd->ManualPassword) + Cmd->Password.Clean(); + if (ArcCount>1 && !Bare && !Technical) { wchar UnpSizeText[20],PackSizeText[20]; diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp index a70850bb9..0d4175c5c 100644 --- a/src/thirdparty/unrar/version.hpp +++ b/src/thirdparty/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 #define RARVER_MINOR 20 -#define RARVER_BETA 1 -#define RARVER_DAY 6 -#define RARVER_MONTH 10 +#define RARVER_BETA 3 +#define RARVER_DAY 3 +#define RARVER_MONTH 11 #define RARVER_YEAR 2014 |