-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginDebug.cpp
52 lines (41 loc) · 1.45 KB
/
PluginDebug.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// =============================================================================
// PluginDebug.cpp
// =============================================================================
// Copyright (c) WildPackets, Inc. 2006. All rights reserved.
#include "StdAfx.h"
#include "PluginDebug.h"
// -----------------------------------------------------------------------------
// _PluginAssertFailed
// -----------------------------------------------------------------------------
void
_PluginAssertFailed(
TCHAR* inCondition,
TCHAR* inFileName,
int inLine )
{
TCHAR szMsg[kPluginNameMaxLength];
_stprintf( szMsg, _T( "Assertion failed: %s, line %d; %s" ), inFileName, inLine, inCondition );
_PluginOutputDebugString( szMsg );
}
// -----------------------------------------------------------------------------
// _PluginOutputDebugString
// -----------------------------------------------------------------------------
void
_PluginOutputDebugString(
TCHAR* inFormat, ... )
{
va_list list;
va_start(list, inFormat);
TCHAR szBuff[kPluginNameMaxLength];
_vsntprintf(szBuff, (kPluginNameMaxLength - 1), inFormat, list);
#if TARGET_OS_WIN32
::OutputDebugString( szBuff );
#elif TARGET_OS_MAC
Str255 tmpStr;
int nStrLen = strlen( szBuff );
if( nStrLen > (kPluginNameMaxLength - 1) ) nStrLen = (kPluginNameMaxLength - 1);
memcpy( &tmpStr[1], szBuff, nStrLen );
tmpStr[0] = nStrLen;
::DebugStr( tmpStr );
#endif
}