void CGmObjAnim3::CData::Clear() { ARRAY_DELETE( m_oArrAction, CAction ); ARRAY_DELETE( m_oArrAnim, CAnim ); ARRAY_DELETE( m_oArrFrame, CFrame ); m_poModel = 0; }
void CGmObjAnim3::Clear() { if( m_poData ) { if( m_poData->m_uiInstanceCount == 1 ) { delete m_poData; } else { m_poData->m_uiInstanceCount -= 1; } m_poData = 0; m_uiInstanceNum = 0; } ARRAY_DELETE( m_oArrAction, CAction ); ARRAY_DELETE( m_oArrAnim, CAnim ); m_poModel = 0; }
VOID ACLStr::_Wack(VOID) { // Use the real allocation length to determine // if we should wack this string. // if (_realLength) { ARRAY_DELETE(_string); } } // _Wack
stringheap::~stringheap() { for (const fkhashmap<const char *, stringele>::ele * p = m_shh.first(); p != 0; p = m_shh.next()) { stringele * e = p->t; safe_fkfree(m_fk, e->s); } m_shh.clear(); ARRAY_DELETE(m_todelete); }
void CGmResMan::Clear() { ARRAY_DELETE( m_oArrTex, CGTex2 ); ARRAY_DELETE( m_oArrWav, TWav ); ARRAY_DELETE( m_oArrASource, CASource ); ARRAY_DELETE( m_oArrABuffer, CABuffer ); ARRAY_DELETE( m_oArrMesh, CGMesh ); ARRAY_DELETE( m_oArrModelMD5, CGMeshMD5::CModel ); ARRAY_DELETE( m_oArrAnim3, CGmObjAnim3 ); ARRAY_DELETE( m_oArrLight, CGLight ); for( unsigned int i=0; i<m_oArrLstCurve.GetSize(); ++i ) { TLstCurve * poLstCurve = m_oArrLstCurve[i]; LIST_DELETE( ( *poLstCurve ), CCurvePathBezier3 ); } m_oArrLstCurve.Clear(); //ARRAY_DELETE( m_oArrLstCurve, TLstCurve ); //ARRAY_DELETE( m_oArrPhysMaterial, CGmObjPhysMaterial ); LIST_DELETE( m_oLstFileEntry, CFileEntry ); }
static UINT __Format ( OUT LPTSTR* ppOutput, OUT UINT* pLen, IN LPCTSTR format, IN va_list& args ) { UINT len(0); if (format) { va_list newargs; va_copy(newargs, args); // Figure out the length. If we were given // a valid pointer that's long enough, use it // otherwise we need to reallocate it. len = VSCPRINTF(format, newargs)+1; if (len > *pLen) { // Delete the buffer ARRAY_DELETE(*ppOutput); // Resize the buffer. size_t unused(0); __Alloc(len, ppOutput, &unused); *pLen = len; } // Fill the buffer. if (*ppOutput) { SPRINTFNS(*ppOutput, *pLen, format, newargs); } } //else //{ // YOU'RE GETTING A NULL POINTER BACK! //} return len; }
//static ACLStr ACLStr::Format(LPCTSTR format, ...) { ACLStr output; if (format) { va_list args; va_start(args, format); // Caller owes a delete on outputPtr LPTSTR outputPtr(NULL); UINT outputLen(0); __Format(&outputPtr, &outputLen, format, args); va_end(args); // Ok, copy the string. output = outputPtr; // All done. ARRAY_DELETE(outputPtr); } return output; }
VOID ACLStr::_Grow(IN const size_t appendSize) { // If the string doesn't need growing then // just bail. if (appendSize) { size_t strSize(Len()); // Check to see if we've run out of room, remember the // string is padded by xxx bytes. Where xxx is the next // eight byte boundry if (_realLength <= (_length+appendSize)) { size_t newRealLength(0); LPTSTR newString(NULL); size_t newLength(__Alloc(strSize+appendSize, &newString, &newRealLength)); if (newString && newLength && newRealLength) { MEMSET(newString, 0, newRealLength); STRCPY_S(newString, newRealLength, _string); ARRAY_DELETE(_string); _string = newString; _length = newLength; _realLength = newRealLength; } } else { // If the append size is less than the size of // the REAL buffer size then don't worry about // growing the buffer. Just tell this string // that its' size is now larger. _length = (strSize+appendSize); } } } // ::grow
BSTR ACLStr::MakeBstr(VOID) { BSTR bstr = 0; UINT cch; LPWSTR wideStr; UINT codePage = GetACP(); // Pass zero for destination buffer size to get the actual size required. // The returned size is expressed in number of wide characters, including // the final null. cch = MultiByteToWideChar(codePage, MB_PRECOMPOSED, _string, -1, 0, 0); // Now do the real work of converting the string. if (wideStr = new WCHAR[cch]) { MultiByteToWideChar(codePage, MB_PRECOMPOSED, _string, -1, wideStr, cch); bstr = SysAllocString(wideStr); ARRAY_DELETE(wideStr); } return bstr; } // ::MakeBstr
void CGmObjAnim3::CSharedData::Clear() { ARRAY_DELETE( m_oArrFrame, CFrame ); }
void CSkeleton::Clear() { ARRAY_DELETE( m_oArrBone, CBone ); m_uiBone = 0; }
static void pf_coord_remove(PolyFill *pf, const unsigned int index) { ARRAY_DELETE(pf->indices, index, 1, pf->coords_tot); ARRAY_DELETE(pf->coords_sign, index, 1, pf->coords_tot); pf->coords_tot -= 1; }