bool CWav::Init() { if( !m_uiSampleCount ) return false; Clear(); m_ptBufferL = new TValue[m_uiSampleCount]; m_ptBufferR = new TValue[m_uiSampleCount]; MEM_ZERO( m_ptBufferL, m_uiSampleCount * sizeof(TValue) ); MEM_ZERO( m_ptBufferR, m_uiSampleCount * sizeof(TValue) ); return true; }
void * createPlayList(char * title) { PlayList * pl = MEM_ALLOC(sizeof(PlayList)); if (pl==NULL){ PL_ERR("%s failed, no memory!\n", __FUNCTION__); goto err; } MEM_ZERO(pl, sizeof(PlayList)); if (title==NULL) title = DEFAULT_PL_TITLE; pl->title = MEM_ALLOC(strlen(title)+1); if (pl->title==NULL){ PL_ERR("%s failed, no memory!\n"); goto err; } strcpy(pl->title, title); return (void *)pl; err: if (pl){ MEM_FREE(pl); pl=NULL; } return (void *)pl; }
bool CWav::CData::Init() { if( !m_uiSampleCount ) return false; Clear(); m_ptBuffer = new TValue[m_uiSampleCount]; MEM_ZERO( m_ptBuffer, m_uiSampleCount * sizeof(TValue) ); m_uiInstanceCount = 1; return true; }
void __zero__(Real *dp, int len) #endif { #ifdef CHAR0ISDBL0 /* if a floating point zero is equivalent to a string of nulls */ MEM_ZERO((char * )dp, len*sizeof(Real)); #else /* else, need to zero the array entry by entry */ int i; for ( i = 0; i < len; i++ ) dp[i] = 0.0; #endif }
/* __zzero__ -- zeros an array of complex numbers */ void __zzero__(complex *zp,int len) { /* if a Real precision zero is equivalent to a string of nulls */ MEM_ZERO((char *)zp,len*sizeof(complex)); /* else, need to zero the array entry by entry */ /****************************** while ( len-- ) { zp->re = zp->im = 0.0; zp++; } ******************************/ }
PlayItem * addItemAtTail(void * hdl, fsl_player_s8 * iName, fsl_player_s32 copy) { PlayItemCtl * item = NULL; PlayList * pl = (PlayList *)hdl; if ((pl==NULL)||(iName==NULL)){ PL_ERR("%s failed, parameters error!\n", __FUNCTION__); goto err; } item = MEM_ALLOC(sizeof(PlayItemCtl)); if (item==NULL){ PL_ERR("%s failed, no memory!\n"); goto err; } MEM_ZERO(item, sizeof(PlayItemCtl)); if (copy){ item->buffer = MEM_ALLOC(strlen(iName)); if (item->buffer==NULL){ PL_ERR("%s failed, no memory!\n"); goto err; } strcpy(item->buffer, iName); item->pi.name = item->buffer; }else{ item->pi.name = iName; } item->pl = pl; item->prev = pl->tail; if (pl->head){ pl->tail->next = item; pl->tail= item; }else{ pl->head = pl->tail = item; } return (PlayItem *)item; err: if (item){ MEM_FREE(item); item=NULL; } return (PlayItem *)item; }
void CGmObjSkybox::Clear() { MEM_ZERO( m_apoTex, sizeof(m_apoTex) ); m_bIsValid = false; }