本文整理汇总了C++中freeData函数的典型用法代码示例。如果您正苦于以下问题:C++ freeData函数的具体用法?C++ freeData怎么用?C++ freeData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了freeData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: freeData
OCSPClientCertID::~OCSPClientCertID()
{
freeData(mIssuerName);
freeData(mIssuerPubKey);
freeData(mSubjectSerial);
freeData(mEncoded);
}
示例2: freeData
int gWaveform::alloc(int datasize) {
ratio = chan->wave->size / (float) datasize;
if (ratio < 2)
return 0;
freeData();
data.size = datasize;
data.sup = (int*) malloc(data.size * sizeof(int));
data.inf = (int*) malloc(data.size * sizeof(int));
int offset = h() / 2;
int zero = y() + offset; // center, zero amplitude (-inf dB)
for (int i=0; i<data.size; i++) {
int pp; // point prev
int pn; // point next
/* resampling the waveform, hardcore way. Many thanks to
* http://fourier.eng.hmc.edu/e161/lectures/resize/node3.html
* Note: we use
* p = j * (m-1 / n)
* instead of
* p = j * (m-1 / n-1)
* in order to obtain 'datasize' cells to parse (and not datasize-1) */
pp = i * ((chan->wave->size - 1) / (float) datasize);
pn = (i+1) * ((chan->wave->size - 1) / (float) datasize);
if (pp % 2 != 0) pp -= 1;
if (pn % 2 != 0) pn -= 1;
float peaksup = 0.0f;
float peakinf = 0.0f;
int k = pp;
while (k < pn) {
if (chan->wave->data[k] > peaksup)
peaksup = chan->wave->data[k]; // Left data only
else
if (chan->wave->data[k] <= peakinf)
peakinf = chan->wave->data[k]; // Left data only
k += 2;
}
data.sup[i] = zero - (peaksup * chan->boost * offset);
data.inf[i] = zero - (peakinf * chan->boost * offset);
// avoid window overflow
if (data.sup[i] < y()) data.sup[i] = y();
if (data.inf[i] > y()+h()-1) data.inf[i] = y()+h()-1;
}
recalcPoints();
return 1;
}
示例3: tvRefcountedDecRef
BaseVector::~BaseVector() {
for (uint i = 0; i < m_size; ++i) {
tvRefcountedDecRef(&m_data[i]);
}
freeData();
}
示例4: freeData
void NNRegressionFactory::deserialize( Object *parent , SerializeObject& so )
{
freeData();
vars = ( NNVariables * )so.getPropObject( "variables" , true );
nPerceptronIDLast = so.getPropInt( "nPerceptronIDLast" );
}
示例5: XOJ_CHECK_TYPE
void PagePositionHandler::update(PageView** viewPages, int viewPagesLen,
int maxY)
{
XOJ_CHECK_TYPE(PagePositionHandler);
freeData();
this->maxY = maxY;
PagePosition* lastPp = new PagePosition();
addData(lastPp);
for (int i = 0; i < viewPagesLen; i++)
{
PageView* pv = viewPages[i];
if (!lastPp->add(pv))
{
PagePosition* pp = new PagePosition(pv);
lastPp->y2 = pp->y1 - 1;
lastPp = pp;
addData(pp);
}
}
PagePosition* pp = new PagePosition();
pp->y1 = lastPp->y2 + 1;
pp->y2 = maxY;
addData(pp);
}
示例6: main
int main() {
struct node_t *list = NULL;
/* Create a long singly-linked list with optional data.
*/
int dataNotFinished = 0;
do {
append(&list);
} while(__VERIFIER_nondet_int());
/*
Do something with data.
displayData();
*/
// free list and data
while (list) {
struct node_t *next = list->next;
freeData(list->data);
free(list);
list = next;
}
return 0;
}
示例7: freeData
bool BitmapData::loadTGA(Common::SeekableReadStream *data) {
Image::TGADecoder dec;
bool success = dec.loadStream(*data);
if (!success)
return false;
const Graphics::Surface *origSurf = dec.getSurface();
Graphics::PixelFormat pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
Graphics::Surface *surf = origSurf->convertTo(pixelFormat);
_width = surf->w;
_height = surf->h;
_format = 1;
_x = _y = 0;
_bpp = 4;
_colorFormat = BM_RGBA;
_numImages = 1;
_data = new Graphics::PixelBuffer[1];
_data[0].set(pixelFormat, (unsigned char *)surf->getPixels());
g_driver->createBitmap(this);
freeData();
delete surf;
return true;
}
示例8: ashmem_get_size_region
void ProfileDataContainer::switchStorageToAshmem(int ashmemfd) {
int regionSize = ashmem_get_size_region(ashmemfd);
if (regionSize < 0) {
int err = errno;
ALOGW("Failed to get ashmem region size from fd %d, err %d %s", ashmemfd, err,
strerror(err));
return;
}
if (regionSize < static_cast<int>(sizeof(ProfileData))) {
ALOGW("Ashmem region is too small! Received %d, required %u", regionSize,
static_cast<unsigned int>(sizeof(ProfileData)));
return;
}
ProfileData* newData = reinterpret_cast<ProfileData*>(
mmap(NULL, sizeof(ProfileData), PROT_READ | PROT_WRITE, MAP_SHARED, ashmemfd, 0));
if (newData == MAP_FAILED) {
int err = errno;
ALOGW("Failed to move profile data to ashmem fd %d, error = %d", ashmemfd, err);
return;
}
newData->mergeWith(*mData);
freeData();
mData = newData;
mIsMapped = true;
}
示例9: freeData
//-----------------------------------------------------------------------------
Image & Image::operator = ( const Image &img )
{
freeData();
m_uWidth = img.m_uWidth;
m_uHeight = img.m_uHeight;
m_uDepth = img.m_uDepth;
m_eFormat = img.m_eFormat;
m_uSize = img.m_uSize;
m_uFlags = img.m_uFlags;
m_ucPixelSize = img.m_ucPixelSize;
m_uNumMipmaps = img.m_uNumMipmaps;
m_bAutoDelete = img.m_bAutoDelete;
//Only create/copy when previous data was not dynamic data
if( m_bAutoDelete )
{
m_pBuffer = new uchar[ m_uSize ];
memcpy( m_pBuffer, img.m_pBuffer, m_uSize );
}
else
{
m_pBuffer = img.m_pBuffer;
}
return *this;
}
示例10: freeData
void CppVariant::set(const NPVariant& newValue)
{
freeData();
switch (newValue.type) {
case NPVariantType_Bool:
set(newValue.value.boolValue);
break;
case NPVariantType_Int32:
set(newValue.value.intValue);
break;
case NPVariantType_Double:
set(newValue.value.doubleValue);
break;
case NPVariantType_String:
set(newValue.value.stringValue);
break;
case NPVariantType_Null:
case NPVariantType_Void:
type = newValue.type;
break;
case NPVariantType_Object:
set(newValue.value.objectValue);
break;
}
}
示例11: createTestSummary
void createTestSummary(char *baseFileName) {
lineStruct **tests;
uint numTests;
tests = gatherTests(baseFileName, numTests);
printTestsSummary(numTests, tests, baseFileName);
freeData(tests, numTests);
}
示例12: freeData
CFile::~CFile(){
if(mStream){
mStream->flush();
delete mStream;
}
freeData();
}
示例13: main
int main(int argc, char **argv)
{
exitCode = 0;
initGtk(&argc, &argv);
migrateConfigToXdgDir();
migrateThemesToXdgDir();
initDataDefault();
if (parseCommandline(&argc, &argv)) {
if(initLockFile()) {
printMessage(MSG_INFO, "Startup %s %s (-h to print usage)\n", OBS_NAME, OBS_VERSION);
if (initConfigs()) {
initWidgets();
gtk_widget_show_all(winWidget);
gtk_main();
}
else
exitCode = 1;
deleteLockFile();
}
else
exitCode = 1;
}
else
exitCode = 1;
freeData();
exit(exitCode);
}
示例14: stratBranch
int stratBranch (void *branchpoint, void **newbranch, size_t *size) {
tsp_t *bp = (tsp_t *)branchpoint;
*size = sizeof (tsp_t *);
// Find number of children
int *degre = (int *) calloc (bp->nb_node, sizeof (int)), i, j;
for (i=0; i<bp->nb_node; i++) {
degre[bp->sol[i]/bp->nb_node]++;
degre[bp->sol[i]%bp->nb_node]++;
}
int max = 0, ind_max = 0;
for (i=0; i<bp->nb_node; i++)
if (degre[i] > max) {
max = degre[i];
ind_max = i;
}
if (max <= 2) {
free (degre);
return 0;
}
int *nodes = (int *) malloc (sizeof(int) * max);
int zz = 0;
for (i=0; i<bp->nb_node; i++) {
if (bp->sol[i]/bp->nb_node == ind_max)
nodes[zz++] = bp->sol[i]%bp->nb_node;
else if (bp->sol[i]%bp->nb_node == ind_max)
nodes[zz++] = bp->sol[i]/bp->nb_node;
}
tsp_t **nb = (tsp_t **) malloc (max * sizeof(tsp_t *));
tsp_t *tmp;
for (i=0; i< max; i++) {
tmp = (tsp_t *) malloc (sizeof(tsp_t));
tmp->nb_node = bp->nb_node;
tmp->sol = (int *) malloc (bp->nb_node * sizeof(int));
tmp->mat = (int **) malloc (sizeof(int*) *bp->nb_node);
for (j=0; j<bp->nb_node; tmp->mat[j++] = (int *) malloc (sizeof(int)*bp->nb_node));
copyData(tmp, bp);
tmp->mat[nodes[i]][ind_max] = -1;
tmp->mat[ind_max][nodes[i]] = -1;
if (compPartSolFromACPM(tmp, 0))
nb[i] = tmp;
else {
i--;
max--;
freeData(tmp);
}
}
*newbranch = nb;
free (degre);
free(nodes);
// free(nb);
return max;
}
示例15: freeData
void mhwd::fillData(mhwd::Data *data) {
freeData(data);
fillDevices(data, mhwd::TYPE_PCI);
fillDevices(data, mhwd::TYPE_USB);
updateConfigData(data);
}