mirror of https://github.com/PCSX2/pcsx2.git
More GCC fixes for SafeArray (changes to the BoundsCheck macro fix some meaningless warnings, not really important otherwise).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3607 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6531640844
commit
28ba6d7520
|
@ -158,6 +158,12 @@ extern pxDoAssertFnType* pxDoAssert;
|
|||
#define IndexBoundsCheckDev( objname, idx, sze ) pxAssertDev( (uint)(idx) < (uint)(sze), \
|
||||
wxsFormat( L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze) ) )
|
||||
|
||||
#define IndexBoundsAssume( objname, idx, sze ) pxAssumeMsg( (uint)(idx) < (uint)(sze), \
|
||||
wxsFormat( L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze) ) )
|
||||
|
||||
#define IndexBoundsAssumeDev( objname, idx, sze ) pxAssumeDev( (uint)(idx) < (uint)(sze), \
|
||||
wxsFormat( L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze) ) )
|
||||
|
||||
|
||||
extern void pxOnAssert( const DiagnosticOrigin& origin, const wxChar* msg=NULL );
|
||||
extern void pxOnAssert( const DiagnosticOrigin& origin, const char* msg );
|
||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
|||
// builds only -- no bounds checking is done in release builds).
|
||||
T* _getPtr( uint i ) const
|
||||
{
|
||||
IndexBoundsCheckDev( Name.c_str(), i, m_size );
|
||||
IndexBoundsAssumeDev( Name.c_str(), i, m_size );
|
||||
return &m_ptr[i];
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ protected:
|
|||
|
||||
T* _getPtr( uint i ) const
|
||||
{
|
||||
IndexBoundsCheckDev( Name.c_str(), i, m_length );
|
||||
IndexBoundsAssumeDev( Name.c_str(), i, m_length );
|
||||
return &m_ptr[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ T& SafeList<T>::AddNew( const T& src )
|
|||
template< typename T >
|
||||
void SafeList<T>::Remove( int index )
|
||||
{
|
||||
IndexBoundsCheckDev( Name.c_str(), index, m_length );
|
||||
IndexBoundsAssumeDev( Name.c_str(), index, m_length );
|
||||
|
||||
int copylen = m_length - index;
|
||||
if( copylen > 0 )
|
||||
|
|
|
@ -20,6 +20,17 @@
|
|||
|
||||
using namespace Threading;
|
||||
|
||||
// Implement some very commonly used SafeArray types here
|
||||
// (done here for lack of a better place)
|
||||
|
||||
template class SafeArray<char>;
|
||||
template class SafeArray<wchar_t>;
|
||||
template class SafeArray<u8>;
|
||||
|
||||
template class SafeAlignedArray<char,16>;
|
||||
template class SafeAlignedArray<wchar_t,16>;
|
||||
template class SafeAlignedArray<u8,16>;
|
||||
|
||||
// Sanity check: truncate strings if they exceed 512k in length. Anything like that
|
||||
// is either a bug or really horrible code that needs to be stopped before it causes
|
||||
// system deadlock.
|
||||
|
@ -50,7 +61,6 @@ public:
|
|||
|
||||
for (uint i=0; i<BufferCount; ++i)
|
||||
{
|
||||
//m_buffers[i].Name = wxsFormat(L"Ascii Formatting Buffer (slot%d)", i);
|
||||
m_buffers[i].Name = wxsFormat(L"%s Formatting Buffer (slot%d)",
|
||||
(sizeof(CharType)==1) ? L"Ascii" : L"Unicode", i);
|
||||
m_buffers[i].MakeRoomFor(1024);
|
||||
|
@ -85,7 +95,7 @@ public:
|
|||
|
||||
BufferType& operator[](uint i)
|
||||
{
|
||||
pxAssume(i<BufferCount);
|
||||
IndexBoundsAssume( ((sizeof(CharType)==1) ? L"Ascii Formatting Buffer" : L"Unicode Formatting Buffer"), i, BufferCount );
|
||||
return m_buffers[i];
|
||||
}
|
||||
};
|
||||
|
@ -313,3 +323,4 @@ FastFormatAscii::operator const char*() const
|
|||
{
|
||||
return m_dest->GetPtr();
|
||||
}
|
||||
|
||||
|
|
|
@ -326,8 +326,8 @@ namespace FilenameDefs
|
|||
}
|
||||
};
|
||||
|
||||
IndexBoundsCheckDev( L"FilenameDefs::Memcard", port, 2 );
|
||||
IndexBoundsCheckDev( L"FilenameDefs::Memcard", slot, 4 );
|
||||
IndexBoundsAssumeDev( L"FilenameDefs::Memcard", port, 2 );
|
||||
IndexBoundsAssumeDev( L"FilenameDefs::Memcard", slot, 4 );
|
||||
|
||||
return retval[port][slot];
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
|
|||
// ------------------------------------------------------------------------
|
||||
const wxFileName& AppConfig::FilenameOptions::operator[]( PluginsEnum_t pluginidx ) const
|
||||
{
|
||||
IndexBoundsCheckDev( L"Filename[Plugin]", pluginidx, PluginId_Count );
|
||||
IndexBoundsAssumeDev( L"Filename[Plugin]", pluginidx, PluginId_Count );
|
||||
return Plugins[pluginidx];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue