本文整理汇总了C++中FreeData函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeData函数的具体用法?C++ FreeData怎么用?C++ FreeData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeData
/*
========================
idSoundSample_XAudio2::MakeDefault
========================
*/
void idSoundSample_XAudio2::MakeDefault()
{
FreeData();
static const int DEFAULT_NUM_SAMPLES = 256;
timestamp = FILE_NOT_FOUND_TIMESTAMP;
loaded = true;
memset( &format, 0, sizeof( format ) );
format.basic.formatTag = idWaveFile::FORMAT_PCM;
format.basic.numChannels = 1;
format.basic.bitsPerSample = 16;
format.basic.samplesPerSec = XAUDIO2_MIN_SAMPLE_RATE;
format.basic.blockSize = format.basic.numChannels * format.basic.bitsPerSample / 8;
format.basic.avgBytesPerSec = format.basic.samplesPerSec * format.basic.blockSize;
assert( format.basic.blockSize == 2 );
totalBufferSize = DEFAULT_NUM_SAMPLES * 2;
short* defaultBuffer = ( short* )AllocBuffer( totalBufferSize, GetName() );
for( int i = 0; i < DEFAULT_NUM_SAMPLES; i += 2 )
{
defaultBuffer[i + 0] = SHRT_MIN;
defaultBuffer[i + 1] = SHRT_MAX;
}
buffers.SetNum( 1 );
buffers[0].buffer = defaultBuffer;
buffers[0].bufferSize = totalBufferSize;
buffers[0].numSamples = DEFAULT_NUM_SAMPLES;
buffers[0].buffer = GPU_CONVERT_CPU_TO_CPU_CACHED_READONLY_ADDRESS( buffers[0].buffer );
playBegin = 0;
playLength = DEFAULT_NUM_SAMPLES;
}
示例2: Clear
void emDirEntry::Clear()
{
if (!--Data->RefCount) FreeData();
Data=&EmptyData;
}
示例3: FreeData
SplineData::~SplineData()
{
FreeData();
}
示例4: StopCapture
~MMDeviceAudioSource()
{
StopCapture();
FreeData();
SafeRelease(mmEnumerator);
}
示例6: FreeData
/*
================
idProgram::~idProgram
================
*/
idProgram::~idProgram()
{
FreeData();
}
示例7: AllocData
void AllocData()
{
FreeData();
m_pKVData = new KeyValues( "gamestats" );
}
示例8: FreeData
Program::~Program()
{
FreeData();
}
示例9: FreeData
DataNode::~DataNode()
{
FreeData();
}
示例10: InitEns
void InitEns (enkf_struct ens)
{
int ne;
pihm_struct pihm;
N_Vector CV_Y; /* State Variables Vector */
int nsv;
int i, j;
char outputdir[MAXSTRING];
outputdir[0] = '\0';
pihm = (pihm_struct)malloc (sizeof *pihm);
ReadAlloc (project, pihm);
/* problem size */
nsv = 3 * pihm->numele + 2 * pihm->numriv;
CV_Y = N_VNew_Serial (nsv);
Initialize (pihm, CV_Y);
MapOutput (project, pihm, outputdir);
ens->numele = pihm->numele;
ens->numriv = pihm->numriv;
ens->ascii = pihm->ctrl.ascii;
/* Initialize ensemble members */
ne = ens->ne;
ens->member = (ensmbr_struct *) malloc (ne * sizeof (ensmbr_struct));
/*
* Define variable controls: vairable names, variable dimension, etc.
*/
MapVar (ens->var, ens->numele, ens->numriv);
InitOper (pihm, ens);
printf("Ensemble members: %d\n", ne);
printf("Default observation cycle: %-d hour(s)\n", ens->interval / 3600);
printf("Observations:");
if (ens->nobs == 0)
{
printf(" none");
}
else
{
for (i = 0; i < ens->nobs - 1; i++)
{
printf(" %s,", ens->obs[i].name);
}
printf(" %s\n", ens->obs[ens->nobs - 1].name);
}
for (i = 0; i < ne; i++)
{
for (j = 0; j < MAXVAR; j++)
{
if (ens->var[j].dim > 0)
{
ens->member[i].var[j] =
(double *) malloc (ens->var[j].dim * sizeof(double));
}
}
}
N_VDestroy_Serial (CV_Y);
FreeData (pihm);
free (pihm);
}
示例11: FreeData
// Like ReloadStrings, but clears all the strings before reloading
void FStringTable::ResetStrings ()
{
FreeData ();
LoadStrings (LumpNum, -1, false);
}
示例12: FreeData
otG711Encoder::~otG711Encoder()
{
FreeData();
}
示例13: progress_callback
/**
* Loads elevation from a USGS DEM file.
*
* Some non-standard variations of the DEM format are supported.
*
* You should call SetupLocalCS() after loading if you will be doing
* heightfield operations on this grid.
*
* \returns \c true if the file was successfully opened and read.
*/
bool vtElevationGrid::LoadFromDEM(const char *szFileName,
bool progress_callback(int), vtElevError *err)
{
// Free buffers to prepare to receive new data
FreeData();
if (progress_callback != NULL) progress_callback(0);
FILE *fp = vtFileOpen(szFileName,"rb");
if (!fp) // Cannot Open File
{
SetError(err, vtElevError::FILE_OPEN, "Couldn't open file '%s'", szFileName);
return false;
}
// check for version of DEM format
int iRow, iColumn;
char buffer[158];
fseek(fp, 864, 0);
if (fread(buffer, 144, 1, fp) != 1)
{
SetError(err, vtElevError::READ_DATA, "Couldn't read DEM data from '%s'", szFileName);
return false;
}
bool bOldFormat = (strncmp(buffer, " 1 1", 12) == 0);
bool bNewFormat = false;
bool bFixedLength = true;
int iDataStartOffset = 1024; // set here to avoid compiler warning
int i, j;
if (bOldFormat)
iDataStartOffset = 1024; // 1024 is record length
else
{
fseek(fp, 1024, 0); // Check for New Format
IConvert(fp, 6, iRow);
IConvert(fp, 6, iColumn);
if (iRow==1 && iColumn==1) // File OK?
{
bNewFormat = true;
iDataStartOffset = 1024;
}
else
{
// might be the Non-fixed-length record format
// Record B can start anywhere from 865 to 1023
// Record B is identified by starting with the row/column
// of its first profile, " 1 1"
fseek(fp, 865, 0);
if (fread(buffer, 158, 1, fp) != 1)
{
SetError(err, vtElevError::READ_DATA, "Couldn't read DEM data from '%s'", szFileName);
fclose(fp);
return false;
}
for (i = 0; i < 158-12; i++)
{
if (!strncmp(buffer+i, " 1 1", 12))
{
// Found it
bFixedLength = false;
iDataStartOffset = 865+i;
break;
}
}
if (i == 158-12)
{
// Not a DEM file
SetError(err, vtElevError::READ_DATA, "Couldn't read DEM data from '%s'", szFileName);
fclose(fp);
return false;
}
}
}
// Read the embedded DEM name
char szName[41];
fseek(fp, 0, 0);
if (fgets(szName, 41, fp) == NULL)
return false;
int len = strlen(szName); // trim trailing whitespace
while (len > 0 && szName[len-1] == ' ')
{
szName[len-1] = 0;
len--;
}
m_strOriginalDEMName = szName;
fseek(fp, 156, 0);
//.........这里部分代码省略.........
示例14:
emDirEntry::~emDirEntry()
{
if (!--Data->RefCount) FreeData();
}
示例15: defined
void emDirEntry::PrivLoad(const emString & path, const emString & name)
{
#if defined(_WIN32)
WIN32_FILE_ATTRIBUTE_DATA fad;
BOOL b;
if (!--Data->RefCount) FreeData();
Data=new SharedData;
Data->Path=path;
Data->Name=name;
Data->TargetPath=Data->Path;
if (em_stat(Data->Path,&Data->Stat)) {
Data->LStatErrNo=errno;
Data->StatErrNo=errno;
memset(&Data->Stat,0,sizeof(struct em_stat));
}
Data->Owner=emString::Format("%u",Data->Stat.st_uid);
Data->Group=emString::Format("%u",Data->Stat.st_gid);
b=GetFileAttributesEx(Data->Path.Get(),GetFileExInfoStandard,&fad);
Data->WndsFileAttributes = b ? fad.dwFileAttributes : 0;
Data->Hidden=(Data->WndsFileAttributes&FILE_ATTRIBUTE_HIDDEN)!=0;
#else
char tmp[1024];
#if !defined(ANDROID)
struct passwd pwbuf;
struct group grbuf;
#endif
struct passwd * pw;
struct group * gr;
int i;
if (!--Data->RefCount) FreeData();
Data=new SharedData;
Data->Path=path;
Data->Name=name;
Data->TargetPath=Data->Path;
if (em_lstat(Data->Path,&Data->Stat)) {
Data->LStatErrNo=errno;
if (em_stat(Data->Path,&Data->Stat)) {
Data->StatErrNo=errno;
memset(&Data->Stat,0,sizeof(struct em_stat));
}
else {
Data->LStat=(struct em_stat*)malloc(sizeof(struct em_stat));
memset(Data->LStat,0,sizeof(struct em_stat));
}
}
else if (S_ISLNK(Data->Stat.st_mode)) {
Data->LStat=(struct em_stat*)malloc(sizeof(struct em_stat));
memcpy(Data->LStat,&Data->Stat,sizeof(struct em_stat));
if (em_stat(Data->Path,&Data->Stat)) {
Data->StatErrNo=errno;
memset(&Data->Stat,0,sizeof(struct em_stat));
}
i=readlink(Data->Path,tmp,sizeof(tmp)-1);
if (i<0) {
Data->TargetPathErrNo=errno;
tmp[0]=0;
}
else {
tmp[i]=0;
}
Data->TargetPath=tmp;
}
#if defined(ANDROID)
pw=getpwuid(Data->Stat.st_uid);
i=0;
#else
i=getpwuid_r(Data->Stat.st_uid,&pwbuf,tmp,sizeof(tmp),&pw);
#endif
if (i==0 && pw && pw->pw_name) Data->Owner=pw->pw_name;
else Data->Owner=emString::Format("%lu",(unsigned long)Data->Stat.st_uid);
#if defined(ANDROID)
gr=getgrgid(Data->Stat.st_gid);
i=0;
#else
i=getgrgid_r(Data->Stat.st_gid,&grbuf,tmp,sizeof(tmp),&gr);
#endif
if (i==0 && gr && gr->gr_name) Data->Group=gr->gr_name;
else Data->Group=emString::Format("%lu",(unsigned long)Data->Stat.st_gid);
Data->Hidden=(Data->Name[0]=='.');
#endif
}