a bit of refactoring

svn path=/trunk/; revision=6770
This commit is contained in:
Martin Fuchs
2003-11-23 23:03:03 +00:00
parent cfb3861175
commit b732658891
4 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -64,7 +64,7 @@ ExplorerGlobals::ExplorerGlobals()
}
void log(LPCTSTR txt)
void _log_(LPCTSTR txt)
{
FmtString msg(TEXT("%s\n"), txt);
@@ -256,7 +256,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
g_Globals._log = fdopen(1, "w");
setvbuf(g_Globals._log, 0, _IONBF, 0);
LOG("starting explore debug log\n");
LOG(TEXT("starting explore debug log\n"));
}
#endif
@@ -67,7 +67,7 @@ String COMException::toString() const
TCHAR msg[4*BUFFER_LEN];
LPTSTR p = msg;
p += _stprintf(p, TEXT("%s\nContext: %s"), super::ErrorMessage(), (LPCTSTR)_ctx.toString());
p += _stprintf(p, TEXT("%s\nContext: %s"), super::ErrorMessage(), (LPCTSTR)_context.toString());
if (_file)
p += _stprintf(p, TEXT("\nLocation: %hs:%d"), _file, _line);
@@ -102,7 +102,7 @@ struct COMException : public COMExceptionBase
COMException(HRESULT hr)
: super(hr),
_ctx(CURRENT_CONTEXT),
_context(CURRENT_CONTEXT),
_file(NULL), _line(0)
{
LOG(toString());
@@ -111,7 +111,7 @@ struct COMException : public COMExceptionBase
COMException(HRESULT hr, const char* file, int line)
: super(hr),
_ctx(CURRENT_CONTEXT),
_context(CURRENT_CONTEXT),
_file(file), _line(line)
{
LOG(toString());
@@ -120,17 +120,16 @@ struct COMException : public COMExceptionBase
COMException(HRESULT hr, const String& obj)
: super(hr),
_ctx(CURRENT_CONTEXT),
_context(CURRENT_CONTEXT),
_file(NULL), _line(0)
{
_ctx = CURRENT_CONTEXT;
LOG(toString());
LOG(CURRENT_CONTEXT.getStackTrace());
}
COMException(HRESULT hr, const String& obj, const char* file, int line)
: super(hr),
_ctx(CURRENT_CONTEXT),
_context(CURRENT_CONTEXT),
_file(file), _line(line)
{
LOG(toString());
@@ -139,7 +138,7 @@ struct COMException : public COMExceptionBase
String toString() const;
Context _ctx;
Context _context;
const char* _file;
int _line;
@@ -66,9 +66,9 @@ extern "C" {
#define BUFFER_LEN 1024
extern void log(LPCTSTR txt);
extern void _log_(LPCTSTR txt);
#define LOG(txt) log(txt)
#define LOG(txt) _log_(txt)
#ifdef _MSC_VER