silence some warnings.
[reactos.git] / reactos / lib / packet / trace.c
1 /////////////////////////////////////////////////////////////////////////////
2 // Diagnostic Trace
3 //
4 #include <stdio.h>
5 #include <stdarg.h>
6 #include <windows.h>
7 //#include <tchar.h>
8 #include "trace.h"
9
10 #ifdef _DEBUG
11
12 #undef THIS_FILE
13 //static char THIS_FILE[] = __FILE__;
14
15 void _DebugBreak(void)
16 {
17 DebugBreak();
18 }
19
20 //void Trace(TCHAR* lpszFormat, ...)
21 void Trace(char* lpszFormat, ...)
22 {
23 va_list args;
24 int nBuf;
25 char szBuffer[512];
26
27 va_start(args, lpszFormat);
28 nBuf = _vsnprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
29 OutputDebugStringA(szBuffer);
30 // was there an error? was the expanded string too long?
31 //ASSERT(nBuf >= 0);
32 va_end(args);
33 }
34
35 void Assert(void* assert, const char* file, int line, void* msg)
36 {
37 if (msg == NULL) {
38 printf("ASSERT -- %s occured on line %u of file %s.\n",
39 (CHAR *)assert, line, file);
40 } else {
41 printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
42 (CHAR *)assert, line, file, (CHAR *)msg);
43 }
44 }
45
46 #else
47
48 //void Trace(TCHAR* lpszFormat, ...) { };
49 void Trace(char* lpszFormat, ...) { };
50 void Assert(void* assert, const char* file, int line, void* msg) { };
51
52 #endif //_DEBUG
53 /////////////////////////////////////////////////////////////////////////////