OpenBarnyard
 
Loading...
Searching...
No Matches
TError.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
2#include "TError.h"
3
4//-----------------------------------------------------------------------------
5// Enables memory debugging.
6// Note: Should be the last include!
7//-----------------------------------------------------------------------------
9
10Toshi::TError::TError( TUINT32 size1, TUINT32 size2 )
11{
12 m_size1 = size1;
13 m_size2 = size2;
14 m_Buffer1 = new TCHAR[ size1 ];
15 m_Buffer2 = new TINT[ size2 ];
16 m_currentSize = 0;
18}
19
20Toshi::TError::~TError()
21{
22 delete[] m_Buffer1;
23 delete[] m_Buffer2;
24}
25
26void Toshi::TError::AddError( const TCHAR* error, ... )
27{
29 {
31
32 va_list args;
33
34 va_start( args, error );
35
36 TCHAR str[ 0x400 ];
37
38 T2String8::Format( str, sizeof( str ), error, args );
39
40 TSIZE size = strlen( str );
41
42 if ( size + m_currentSize <= m_size1 && TUtil::MemCopy( m_Buffer1 + m_currentSize, str, size ) )
43 {
45 m_currentSize += size + 1;
46 }
47 }
48}
size_t TSIZE
Definition Typedefs.h:9
char TCHAR
Definition Typedefs.h:20
uint32_t TUINT32
Definition Typedefs.h:13
int TINT
Definition Typedefs.h:7
static TINT Format(TCHAR *a_pcString, TINT size, const TCHAR *a_pcFormat,...)
Definition T2String8.cpp:41
TUINT32 m_size1
Definition TError.h:15
TUINT32 m_currentSize2
Definition TError.h:19
TINT * m_Buffer2
Definition TError.h:16
TUINT32 m_currentSize
Definition TError.h:18
TCHAR * m_Buffer1
Definition TError.h:14
TUINT32 m_size2
Definition TError.h:17
static void * MemCopy(void *dst, const void *src, TSIZE size)
Definition TUtil.h:90