Skip to content

Commit 8754ec3

Browse files
Update unrar from 5.91 to 6.02 (#2384)
1 parent ae6caa9 commit 8754ec3

35 files changed

+425
-376
lines changed

vendor/unrar/acknow.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
* RAR uses CRC32 function based on Intel Slicing-by-8 algorithm.
5252
Original Intel Slicing-by-8 code is available here:
5353

54-
http://sourceforge.net/projects/slicing-by-8/
54+
https://sourceforge.net/projects/slicing-by-8/
5555

5656
Original Intel Slicing-by-8 code is licensed under BSD License
5757
available at http://www.opensource.org/licenses/bsd-license.html

vendor/unrar/arcread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ size_t Archive::ReadHeader50()
785785
case HEAD_SERVICE:
786786
{
787787
FileHeader *hd=ShortBlock.HeaderType==HEAD_FILE ? &FileHead:&SubHead;
788-
hd->Reset();
788+
hd->Reset(); // Clear hash, time fields and other stuff like flags.
789789
*(BaseBlock *)hd=ShortBlock;
790790

791791
bool FileBlock=ShortBlock.HeaderType==HEAD_FILE;

vendor/unrar/cmddata.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ void CommandData::ParseCommandLine(bool Preprocess,int argc, char *argv[])
5656
// In Windows we may prefer to implement our own command line parser
5757
// to avoid replacing \" by " in standard parser. Such replacing corrupts
5858
// destination paths like "dest path\" in extraction commands.
59-
// Also our own parser is Unicode compatible.
6059
const wchar *CmdLine=GetCommandLine();
6160

6261
wchar *Par;
@@ -288,7 +287,10 @@ void CommandData::ProcessSwitch(const wchar *Switch)
288287
AppendArcNameToPath=APPENDARCNAME_DESTPATH;
289288
else
290289
if (Switch[2]=='1')
291-
AppendArcNameToPath=APPENDARCNAME_OWNDIR;
290+
AppendArcNameToPath=APPENDARCNAME_OWNSUBDIR;
291+
else
292+
if (Switch[2]=='2')
293+
AppendArcNameToPath=APPENDARCNAME_OWNDIR;
292294
break;
293295
#ifndef SFX_MODULE
294296
case 'G':
@@ -436,9 +438,9 @@ void CommandData::ProcessSwitch(const wchar *Switch)
436438
wcsncpyz(EmailTo,Switch[4]!=0 ? Switch+4:L"@",ASIZE(EmailTo));
437439
break;
438440
}
439-
if (wcsicomp(Switch+1,L"M")==0)
441+
if (wcsicomp(Switch+1,L"M")==0) // For compatibility with pre-WinRAR 6.0 -im syntax. Replaced with -idv.
440442
{
441-
MoreInfo=true;
443+
VerboseOutput=true;
442444
break;
443445
}
444446
if (wcsicomp(Switch+1,L"NUL")==0)
@@ -465,6 +467,12 @@ void CommandData::ProcessSwitch(const wchar *Switch)
465467
case 'P':
466468
DisablePercentage=true;
467469
break;
470+
case 'N':
471+
DisableNames=true;
472+
break;
473+
case 'V':
474+
VerboseOutput=true;
475+
break;
468476
}
469477
break;
470478
}
@@ -539,7 +547,6 @@ void CommandData::ProcessSwitch(const wchar *Switch)
539547
case 'D': Type=FILTER_DELTA; break;
540548
case 'A': Type=FILTER_AUDIO; break;
541549
case 'C': Type=FILTER_RGB; break;
542-
case 'I': Type=FILTER_ITANIUM; break;
543550
case 'R': Type=FILTER_ARM; break;
544551
}
545552
if (*Str=='+' || *Str=='-')

vendor/unrar/cmddata.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ enum IS_PROCESS_FILE_FLAGS {IPFF_EXCLUDE_PARENT=1};
1111
class CommandData:public RAROptions
1212
{
1313
private:
14-
void ProcessSwitchesString(const wchar *Str);
1514
void ProcessSwitch(const wchar *Switch);
1615
void BadSwitch(const wchar *Switch);
1716
uint GetExclAttr(const wchar *Str,bool &Dir);
@@ -34,6 +33,7 @@ class CommandData:public RAROptions
3433
void ParseEnvVar();
3534
void ReadConfig();
3635
void PreprocessArg(const wchar *Arg);
36+
void ProcessSwitchesString(const wchar *Str);
3737
void OutTitle();
3838
void OutHelp(RAR_EXIT ExitCode);
3939
bool IsSwitch(int Ch);

vendor/unrar/consio.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void GetPasswordText(wchar *Str,uint MaxLength)
164164
SetConsoleMode(hConIn,ConInMode);
165165
SetConsoleMode(hConOut,ConOutMode);
166166
#else
167-
char StrA[MAXPASSWORD];
167+
char StrA[MAXPASSWORD*4]; // "*4" for multibyte UTF-8 characters.
168168
#if defined(_EMX) || defined (__VMS)
169169
fgets(StrA,ASIZE(StrA)-1,stdin);
170170
#elif defined(__sun)
@@ -248,6 +248,12 @@ bool getwstr(wchar *str,size_t n)
248248
ErrHandler.Exit(RARX_USERBREAK);
249249
}
250250
StrA[ReadSize]=0;
251+
252+
// We expect ANSI encoding here, but "echo text|rar ..." to pipe to RAR,
253+
// such as send passwords, we get OEM encoding by default, unless we
254+
// use "chcp" in console. But we avoid OEM to ANSI conversion,
255+
// because we also want to handle ANSI files redirection correctly,
256+
// like "rar ... < ansifile.txt".
251257
CharToWide(&StrA[0],str,n);
252258
cleandata(&StrA[0],StrA.Size()); // We can use this function to enter passwords.
253259
}
@@ -305,7 +311,7 @@ int Ask(const wchar *AskStr)
305311

306312
for (int I=0;I<NumItems;I++)
307313
{
308-
eprintf(I==0 ? (NumItems>4 ? L"\n":L" "):L", ");
314+
eprintf(I==0 ? (NumItems>3 ? L"\n":L" "):L", ");
309315
int KeyPos=ItemKeyPos[I];
310316
for (int J=0;J<KeyPos;J++)
311317
eprintf(L"%c",Item[I][J]);

vendor/unrar/dll.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ static int RarErrorToDll(RAR_EXIT ErrCode)
474474
switch(ErrCode)
475475
{
476476
case RARX_FATAL:
477+
case RARX_READ:
477478
return ERAR_EREAD;
478479
case RARX_CRC:
479480
return ERAR_BAD_DATA;

vendor/unrar/dll.def

Lines changed: 0 additions & 13 deletions
This file was deleted.

vendor/unrar/dll.rc

Lines changed: 0 additions & 28 deletions
This file was deleted.

vendor/unrar/dll_nocrypt.def

Lines changed: 0 additions & 13 deletions
This file was deleted.

vendor/unrar/errhnd.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void ErrorHandler::Clean()
1515
UserBreak=false;
1616
MainExit=false;
1717
DisableShutdown=false;
18+
ReadErrIgnoreAll=false;
1819
}
1920

2021

@@ -56,24 +57,34 @@ void ErrorHandler::ReadError(const wchar *FileName)
5657
ReadErrorMsg(FileName);
5758
#endif
5859
#if !defined(SILENT) || defined(RARDLL)
59-
Exit(RARX_FATAL);
60+
Exit(RARX_READ);
6061
#endif
6162
}
6263

6364

64-
bool ErrorHandler::AskRepeatRead(const wchar *FileName)
65+
void ErrorHandler::AskRepeatRead(const wchar *FileName,bool &Ignore,bool &Retry,bool &Quit)
6566
{
67+
SetErrorCode(RARX_READ);
6668
#if !defined(SILENT) && !defined(SFX_MODULE)
6769
if (!Silent)
6870
{
71+
uiMsg(UIERROR_FILEREAD,UINULL,FileName);
6972
SysErrMsg();
70-
bool Repeat=uiAskRepeatRead(FileName);
71-
if (!Repeat) // Disable shutdown if user pressed Cancel in error dialog.
72-
DisableShutdown=true;
73-
return Repeat;
73+
if (ReadErrIgnoreAll)
74+
Ignore=true;
75+
else
76+
{
77+
bool All=false;
78+
uiAskRepeatRead(FileName,Ignore,All,Retry,Quit);
79+
if (All)
80+
ReadErrIgnoreAll=Ignore=true;
81+
if (Quit) // Disable shutdown if user select Quit in read error prompt.
82+
DisableShutdown=true;
83+
}
84+
return;
7485
}
7586
#endif
76-
return false;
87+
Ignore=true; // Saving the file part for -y or -inul or "Ignore all" choice.
7788
}
7889

7990

@@ -189,7 +200,7 @@ void ErrorHandler::ReadErrorMsg(const wchar *ArcName,const wchar *FileName)
189200
{
190201
uiMsg(UIERROR_FILEREAD,ArcName,FileName);
191202
SysErrMsg();
192-
SetErrorCode(RARX_FATAL);
203+
SetErrorCode(RARX_READ);
193204
}
194205

195206

@@ -356,7 +367,7 @@ bool ErrorHandler::GetSysErrMsg(wchar *Msg,size_t Size)
356367

357368
void ErrorHandler::SysErrMsg()
358369
{
359-
#if !defined(SFX_MODULE) && !defined(SILENT)
370+
#ifndef SILENT
360371
wchar Msg[1024];
361372
if (!GetSysErrMsg(Msg,ASIZE(Msg)))
362373
return;

0 commit comments

Comments
 (0)