mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 07:25:11 +00:00
rar: import unrarsrc-5.5.8 for reference
this will allow us to diff against newer version of unrarsrc if we wish to update our port
This commit is contained in:
37
reference/unrar/log.cpp
Normal file
37
reference/unrar/log.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "rar.hpp"
|
||||
|
||||
|
||||
static wchar LogName[NM];
|
||||
static RAR_CHARSET LogCharset=RCH_DEFAULT;
|
||||
|
||||
void InitLogOptions(const wchar *LogFileName,RAR_CHARSET CSet)
|
||||
{
|
||||
wcsncpyz(LogName,LogFileName,ASIZE(LogName));
|
||||
LogCharset=CSet;
|
||||
}
|
||||
|
||||
|
||||
#ifndef SILENT
|
||||
void Log(const wchar *ArcName,const wchar *fmt,...)
|
||||
{
|
||||
// Preserve the error code for possible following system error message.
|
||||
int Code=ErrHandler.GetSystemErrorCode();
|
||||
|
||||
uiAlarm(UIALARM_ERROR);
|
||||
|
||||
// This buffer is for format string only, not for entire output,
|
||||
// so it can be short enough.
|
||||
wchar fmtw[1024];
|
||||
PrintfPrepareFmt(fmt,fmtw,ASIZE(fmtw));
|
||||
|
||||
safebuf wchar Msg[2*NM+1024];
|
||||
va_list arglist;
|
||||
va_start(arglist,fmt);
|
||||
vswprintf(Msg,ASIZE(Msg),fmtw,arglist);
|
||||
va_end(arglist);
|
||||
eprintf(L"%ls",Msg);
|
||||
ErrHandler.SetSystemErrorCode(Code);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user