diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-05 11:39:47 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-06 02:56:22 +0400 |
commit | 00f8520475b119d50d40b8a4b2298f04afa821b9 (patch) | |
tree | e389319284c45b5305bb5156e1d8f8310849902a /src/thirdparty/unrar/rar.cpp | |
parent | b18faab4208d8368d28c7b51afe5a73bbc90b05e (diff) |
update unrar to v5.0.2
Diffstat (limited to 'src/thirdparty/unrar/rar.cpp')
-rw-r--r-- | src/thirdparty/unrar/rar.cpp | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/src/thirdparty/unrar/rar.cpp b/src/thirdparty/unrar/rar.cpp index e487cc639..bf3b6c83e 100644 --- a/src/thirdparty/unrar/rar.cpp +++ b/src/thirdparty/unrar/rar.cpp @@ -8,31 +8,15 @@ int main(int argc, char *argv[]) setlocale(LC_ALL,""); #endif -#if defined(_EMX) && !defined(_DJGPP) - uni_init(0); -#endif - -#if !defined(_SFX_RTL_) && !defined(_WIN_ALL) - setbuf(stdout,NULL); -#endif - -#if !defined(SFX_MODULE) && defined(_EMX) - EnumConfigPaths(argv[0],-1); -#endif - + InitConsole(); ErrHandler.SetSignalHandlers(true); - RARInitData(); - #ifdef SFX_MODULE - char ModuleNameA[NM]; - wchar ModuleNameW[NM]; + wchar ModuleName[NM]; #ifdef _WIN_ALL - GetModuleFileNameW(NULL,ModuleNameW,ASIZE(ModuleNameW)); - WideToChar(ModuleNameW,ModuleNameA); + GetModuleFileName(NULL,ModuleName,ASIZE(ModuleName)); #else - strcpy(ModuleNameA,argv[0]); - *ModuleNameW=0; + CharToWide(argv[0],ModuleName,ASIZE(ModuleName)); #endif #endif @@ -48,14 +32,12 @@ int main(int argc, char *argv[]) bool ShutdownOnClose=false; #endif -#ifdef ALLOW_EXCEPTIONS try -#endif { - CommandData Cmd; + CommandData *Cmd=new CommandData; #ifdef SFX_MODULE - strcpy(Cmd.Command,"X"); + wcscpy(Cmd->Command,L"X"); char *Switch=NULL; #ifdef _SFX_RTL_ char *CmdLine=GetCommandLineA(); @@ -70,74 +52,64 @@ int main(int argc, char *argv[]) #else Switch=argc>1 ? argv[1]:NULL; #endif - if (Switch!=NULL && Cmd.IsSwitch(Switch[0])) + if (Switch!=NULL && Cmd->IsSwitch(Switch[0])) { int UpperCmd=etoupper(Switch[1]); switch(UpperCmd) { case 'T': case 'V': - Cmd.Command[0]=UpperCmd; + Cmd->Command[0]=UpperCmd; break; case '?': - Cmd.OutHelp(RARX_SUCCESS); + Cmd->OutHelp(RARX_SUCCESS); break; } } - Cmd.AddArcName(ModuleNameA,ModuleNameW); - Cmd.ParseDone(); + Cmd->AddArcName(ModuleName); + Cmd->ParseDone(); #else // !SFX_MODULE - Cmd.PreprocessCommandLine(argc,argv); - if (!Cmd.ConfigDisabled) + Cmd->ParseCommandLine(true,argc,argv); + if (!Cmd->ConfigDisabled) { - Cmd.ReadConfig(); - Cmd.ParseEnvVar(); + Cmd->ReadConfig(); + Cmd->ParseEnvVar(); } - Cmd.ParseCommandLine(argc,argv); + Cmd->ParseCommandLine(false,argc,argv); #endif #if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SHELL_EXT) - ShutdownOnClose=Cmd.Shutdown; + ShutdownOnClose=Cmd->Shutdown; #endif - InitConsoleOptions(Cmd.MsgStream,Cmd.Sound); - InitLogOptions(Cmd.LogName); - ErrHandler.SetSilent(Cmd.AllYes || Cmd.MsgStream==MSG_NULL); - ErrHandler.SetShutdown(Cmd.Shutdown); + InitConsoleOptions(Cmd->MsgStream,Cmd->Sound); + InitLogOptions(Cmd->LogName); + ErrHandler.SetSilent(Cmd->AllYes || Cmd->MsgStream==MSG_NULL); + ErrHandler.SetShutdown(Cmd->Shutdown); - Cmd.OutTitle(); - Cmd.ProcessCommand(); + Cmd->OutTitle(); + Cmd->ProcessCommand(); + delete Cmd; } -#ifdef ALLOW_EXCEPTIONS catch (RAR_EXIT ErrCode) { ErrHandler.SetErrorCode(ErrCode); } -#ifdef ENABLE_BAD_ALLOC catch (std::bad_alloc) { ErrHandler.MemoryErrorMsg(); ErrHandler.SetErrorCode(RARX_MEMORY); } -#endif catch (...) { ErrHandler.SetErrorCode(RARX_FATAL); } -#endif - File::RemoveCreated(); -#if defined(SFX_MODULE) && defined(_DJGPP) - _chmod(ModuleNameA,1,0x20); -#endif -#if defined(_EMX) && !defined(_DJGPP) - uni_done(); -#endif #if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SHELL_EXT) if (ShutdownOnClose) Shutdown(); #endif - return(ErrHandler.GetErrorCode()); + return ErrHandler.GetErrorCode(); } #endif |