Updated unrar source from 5.9.4 to 6.0.5

This commit is contained in:
Jens Steube
2021-05-15 11:31:42 +02:00
parent ce90f83b65
commit f4ca10b116
32 changed files with 400 additions and 94 deletions
+45 -5
View File
@@ -1,3 +1,5 @@
static bool AnyMessageDisplayed=false; // For console -idn switch.
// Purely user interface function. Gets and returns user input.
UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags)
{
@@ -83,6 +85,19 @@ void uiProcessProgress(const char *Command,int64 CurSize,int64 TotalSize)
void uiMsgStore::Msg()
{
// When creating volumes, AnyMessageDisplayed must be reset for UIEVENT_NEWARCHIVE,
// so it ignores this and all earlier messages like UIEVENT_PROTECTEND
// and UIEVENT_PROTECTEND, because they precede "Creating archive" message
// and do not interfere with -idn and file names. If we do not ignore them,
// uiEolAfterMsg() in uiStartFileAddit() can cause unneeded carriage return
// in archiving percent after creating a new volume with -v -idn (and -rr
// for UIEVENT_PROTECT*) switches. AnyMessageDisplayed is set for messages
// after UIEVENT_NEWARCHIVE, so archiving percent with -idn is moved to
// next line and does not delete their last characters.
// Similarly we ignore UIEVENT_RRTESTINGEND for volumes, because it is issued
// before "Testing archive" and would add an excessive \n otherwise.
AnyMessageDisplayed=(Code!=UIEVENT_NEWARCHIVE && Code!=UIEVENT_RRTESTINGEND);
switch(Code)
{
case UIERROR_SYSERRMSG:
@@ -121,6 +136,7 @@ void uiMsgStore::Msg()
Log(NULL,St(MErrSeek),Str[0]);
break;
case UIERROR_FILEREAD:
mprintf(L"\n");
Log(Str[0],St(MErrRead),Str[1]);
break;
case UIERROR_FILEWRITE:
@@ -304,7 +320,15 @@ void uiMsgStore::Msg()
case UIERROR_ULINKEXIST:
Log(NULL,St(MSymLinkExists),Str[0]);
break;
case UIERROR_READERRTRUNCATED:
Log(NULL,St(MErrReadTrunc),Str[0]);
break;
case UIERROR_READERRCOUNT:
Log(NULL,St(MErrReadCount),Num[0]);
break;
case UIERROR_DIRNAMEEXISTS:
Log(NULL,St(MDirNameExists));
break;
#ifndef SFX_MODULE
case UIMSG_STRING:
@@ -397,11 +421,15 @@ bool uiAskNextVolume(wchar *VolName,size_t MaxSize)
}
bool uiAskRepeatRead(const wchar *FileName)
void uiAskRepeatRead(const wchar *FileName,bool &Ignore,bool &All,bool &Retry,bool &Quit)
{
mprintf(L"\n");
Log(NULL,St(MErrRead),FileName);
return Ask(St(MRetryAbort))==1;
eprintf(St(MErrReadInfo));
int Code=Ask(St(MIgnoreAllRetryQuit));
Ignore=(Code==1);
All=(Code==2);
Quit=(Code==4);
Retry=!Ignore && !All && !Quit; // Default also for invalid input, not just for 'Retry'.
}
@@ -423,3 +451,15 @@ const wchar *uiGetMonthName(int Month)
return St(MonthID[Month]);
}
#endif
void uiEolAfterMsg()
{
if (AnyMessageDisplayed)
{
// Avoid deleting several last characters of any previous error message
// with percentage indicator in -idn mode.
AnyMessageDisplayed=false;
mprintf(L"\n");
}
}