void SimpleString::InitializeNonTerminated( const char* pString, uint Length ) { DEVASSERTDESC( pString, "SimpleStrings must be initialized--use \"\" instead of NULL" ); // SimpleStrings should always represent something (same as std::string) DEVASSERT( !m_String ); if( pString ) { m_Length = Length; m_String = Allocate( m_Length + 1 ); memcpy_s( m_String, m_Length + 1, pString, m_Length ); m_String[ m_Length ] = '\0'; } }
void SimpleString::Initialize( const char* pString ) { DEVASSERTDESC( pString, "SimpleStrings must be initialized--use \"\" instead of NULL" ); // SimpleStrings should always represent something (same as std::string) DEVASSERT( !m_String ); // Safeguard against this error in final builds. if( !pString ) { pString = ""; } if( pString ) { m_Length = ( uint )strlen( pString ); m_String = Allocate( m_Length + 1 ); strcpy_s( m_String, m_Length + 1, pString ); } }
void RendererCommon::AddMesh(Mesh* pMesh) { XTRACE_FUNCTION; DEVASSERT(pMesh); if (pMesh->m_VertexBuffer->GetNumVertices() == 0) { return; } #if BUILD_DEV uint NumBucketsAdded = 0; #endif const uint MaterialFlags = pMesh->GetMaterialFlags(); Bucket* pBucket; uint NumBuckets = m_OrderedBuckets.Size(); for (uint i = 0; i < NumBuckets; ++i) { pBucket = m_OrderedBuckets[i]; // This conditional means that the mesh must have all the // flags of the bucket and none of the filtered flags if ((MaterialFlags & pBucket->m_Flags) == pBucket->m_Flags && (MaterialFlags & pBucket->m_FilterFlags) == 0) { #if BUILD_DEV ++NumBucketsAdded; #endif pBucket->m_Meshes.PushBack(pMesh); if (pBucket->m_ExclusiveMeshes) { return; } } } DEVASSERTDESC(NumBucketsAdded > 0, "Mesh was added but fell into no buckets."); }