| 5 | |
| 6 | #ifdef _DEBUG |
| 7 | void _DBGPRINT( const char* kwszFunction, int iLineNumber, const wchar_t* kwszDebugFormatString, ... ) \ |
| 8 | { |
| 9 | INT cbFormatString = 0; |
| 10 | va_list args; |
| 11 | PWCHAR wszDebugString = NULL; |
| 12 | size_t st_Offset = 0; |
| 13 | |
| 14 | va_start( args, kwszDebugFormatString ); |
| 15 | |
| 16 | cbFormatString = _scwprintf( L"[%S:%d] ", kwszFunction, iLineNumber ) * sizeof( WCHAR ); |
| 17 | cbFormatString += _vscwprintf( kwszDebugFormatString, args ) * sizeof( WCHAR ) + 2; |
| 18 | |
| 19 | wszDebugString = (PWCHAR)malloc( cbFormatString ); |
| 20 | |
| 21 | if(wszDebugString == nullptr){ |
| 22 | //not a lot we can do here |
| 23 | OutputDebugStringW(L"Failed to allocate memory for output string"); |
| 24 | }else{ |
| 25 | /* Populate the buffer with the contents of the format string. */ |
| 26 | StringCbPrintfW( wszDebugString, cbFormatString, L"[%S:%d] ", kwszFunction, iLineNumber ); |
| 27 | StringCbLengthW( wszDebugString, cbFormatString, &st_Offset ); |
| 28 | StringCbVPrintfW( &wszDebugString[st_Offset / sizeof(WCHAR)], cbFormatString - st_Offset, kwszDebugFormatString, args ); |
| 29 | |
| 30 | OutputDebugStringW( wszDebugString ); |
| 31 | |
| 32 | free( wszDebugString ); |
| 33 | } |
| 34 | |
| 35 | va_end( args ); |
| 36 | } |
| 37 | #else |
| 38 | #define DBGPRINT( kwszDebugFormatString, ... ) ;; |
| 39 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected