本文整理汇总了C++中FskMemPtrDispose函数的典型用法代码示例。如果您正苦于以下问题:C++ FskMemPtrDispose函数的具体用法?C++ FskMemPtrDispose怎么用?C++ FskMemPtrDispose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FskMemPtrDispose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FskFSFileGetPathInfo
// ---------------------------------------------------------------------
FskErr FskFSFileGetPathInfo(const char *rootpath, const char *filepath, FskFileInfo *itemInfo) {
int err;
STATTYPE statbuf;
char *fullpath;
err = FskMemPtrNew(FskStrLen(rootpath) + FskStrLen(filepath) + 2, (FskMemPtr*)(void*)&fullpath);
if (err)
return err;
FskStrCopy(fullpath, rootpath);
FskStrCat(fullpath, "/");
FskStrCat(fullpath, filepath);
err = STAT(fullpath, &statbuf);
if (err == -1) {
err = errnoToFskErr(errno);
goto bail;
}
GetFileInfoFromStat(&statbuf, itemInfo);
bail:
FskMemPtrDispose(fullpath);
if (err)
FskMemSet(itemInfo, 0, sizeof(*itemInfo));
return err;
}
示例2: FskFSFileOpen
// ---------------------------------------------------------------------
FskErr FskFSFileOpen(const char *fullPath, UInt32 permissions, FskFSFile *frefOut) {
FskErr err;
FskFSFile fref;
FskFileInfo itemInfo;
if (frefOut)
*frefOut = NULL;
err = sCheckFullPath(fullPath, kFskPathIsFile);
BAIL_IF_ERR(err);
err = FskFSFileGetFileInfo(fullPath, &itemInfo);
BAIL_IF_ERR(err);
if (itemInfo.filetype == kFskDirectoryItemIsDirectory)
BAIL(kFskErrIsDirectory);
err = FskMemPtrNewClear(sizeof(FskFSFileRecord), (FskMemPtr*)(void*)&fref);
BAIL_IF_NONZERO(err, err, kFskErrMemFull);
fref->thePermissions = permissions;
fref->theFile = FOPEN(fullPath, sPermsToPermStr(permissions));
if (!fref->theFile) {
FskMemPtrDispose(fref);
BAIL(errnoToFskErr(errno));
}
*frefOut = fref;
bail:
return err;
}
示例3: FskFSVolumeIteratorDispose
// ---------------------------------------------------------------------
FskErr FskFSVolumeIteratorDispose(FskFSVolumeIterator volIt)
{
if (volIt)
FskMemPtrDispose(volIt);
return kFskErrNone;
}
示例4: unpackAndroid
void unpackAndroid() {
char * src, *dst, buf[4096];
int doit=0;
UInt32 amt, amtWrt;
FskFileInfo info, infoSrc;
FskFile srcFref, dstFref;
FskErr err;
dst = FskStrDoCat(gAndroidCallbacks->getStaticDataDirCB(), "ca-bundle.crt");
src = FskStrDoCat(gAndroidCallbacks->getStaticAppDirCB(), "/res/raw/kinoma.jet/ca-bundle.crt");
if (kFskErrFileNotFound == FskFileGetFileInfo(dst, &info)) {
fprintf(stderr, "dst: %s not found\n", dst);
doit = 1;
}
else if (kFskErrNone == FskFileGetFileInfo(src, &infoSrc)) {
if (infoSrc.filesize != info.filesize) {
fprintf(stderr, "src size: %lld, dstSize: %lld\n", infoSrc.filesize, info.filesize);
doit = 1;
}
}
if (doit) {
fprintf(stderr, "Need to copy it over.\n");
err = FskFileOpen(src, kFskFilePermissionReadOnly, &srcFref);
if (err) fprintf(stderr, "open %s failed %d\n", src, err);
err = FskFileCreate(dst);
if (err) fprintf(stderr, "create %s failed %d\n", dst, err);
err = FskFileOpen(dst, kFskFilePermissionReadWrite, &dstFref);
if (err) fprintf(stderr, "open %s failed %d\n", dst, err);
while (kFskErrNone == err) {
err = FskFileRead(srcFref, 4096, buf, &amt);
if (err) fprintf(stderr, "read %s (%lu bytes) failed %d\n", src, amt, err);
if (0 >= amt)
break;
while (amt) {
err = FskFileWrite(dstFref, amt, buf, &amtWrt);
if (err) fprintf(stderr, "write %s (%lu bytes) failed %d\n", dst, amt, err);
amt -= amtWrt;
}
}
err = FskFileClose(dstFref);
if (err) fprintf(stderr, "close %s failed %d\n", src, err);
err = FskFileClose(srcFref);
if (err) fprintf(stderr, "close %s failed %d\n", src, err);
}
FskMemPtrDispose(src);
FskMemPtrDispose(dst);
}
示例5: loadGrammar
FskErr loadGrammar(const char *xsbPath, xsGrammar *theGrammar)
{
FskErr err;
FskFile fref = NULL;
UInt32 atom[2];
err = FskFileOpen(xsbPath, kFskFilePermissionReadOnly, &fref);
if (err) goto bail;
err = FskFileRead(fref, sizeof(atom), atom, NULL);
if (err) goto bail;
atom[0] = FskEndianU32_BtoN(atom[0]);
atom[1] = FskEndianU32_BtoN(atom[1]);
if (atom[1] == 'XS11') {
SInt32 totalSize = (SInt32)atom[0] - sizeof(atom);
while (totalSize > 0) {
UInt32 blockSize;
char *block;
err = FskFileRead(fref, sizeof(atom), atom, NULL);
if (err) break;
atom[0] = FskEndianU32_BtoN(atom[0]);
atom[1] = FskEndianU32_BtoN(atom[1]);
totalSize -= atom[0];
blockSize = atom[0] - sizeof(atom);
err = FskMemPtrNew(blockSize, &block);
if (err) break;
err = FskFileRead(fref, blockSize, block, NULL);
if (err) break;
switch (atom[1]) {
case 'SYMB':
theGrammar->symbols = block;
theGrammar->symbolsSize = blockSize;
break;
case 'CODE':
theGrammar->code = block;
theGrammar->codeSize = blockSize;
break;
default:
FskMemPtrDispose(block);
err = kFskErrBadData;
break;
}
}
}
else
err = kFskErrBadData;
bail:
FskFileClose(fref);
return err;
}
示例6: FillJaggyPolygonContours
static FskErr
FillJaggyPolygonContours(
UInt32 nContours,
const UInt32 *nPts,
const FskFixedPoint2D *pts,
const FskColorSource *colorSource,
SInt32 fillRule,
const FskFixedMatrix3x2 *M,
FskConstRectangle clipRect,
FskBitmap dstBM
)
{
FskRectangleRecord dstRect;
LinkedEdge edges[MAX_EDGES], *pEdges = edges; /* Small polygons use auto edges, large ones need to be alloc'ed */
UInt32 numEdges, totPts;
FskSpan span;
FskErr err = kFskErrNone;
SInt32 n;
const UInt32 *np;
LinkedEdge *pe;
static FskInitSpanProc initProcs[] = {
FskInitSolidColorSpan,
FskInitLinearGradientSpan,
FskInitRadialGradientSpan,
FskInitTextureSpan,
NULL /* Procedure span is not yet implemented */
};
FskInitSpanProc initSpan;
if (clipRect == NULL) dstRect = dstBM->bounds;
else if (!FskRectangleIntersect(&dstBM->bounds, clipRect, &dstRect)) return kFskErrNothingRendered;
for (n = nContours, np = nPts, totPts = 0; n--; )
totPts += *np++;
FskInitSpan(&span, dstBM, sizeof(LinkedEdge)); /* Generic span init */
initSpan = initProcs[((n = colorSource->type) <= kFskColorSourceTypeMax) ? n : 0];
if ((err = (*initSpan)(&span, dstBM, M, 0, colorSource)) != kFskErrNone) /* Specialized span init - this may bump up the edge size */
return err;
span.edgeBytes = (span.edgeBytes + 3) & ~3; /* Ceil up to multiple of 4 bytes */
if ( CANT_USE_AUTO_EDGES(totPts) /* Either small enough for auto storage ... */
&& (err = (FskMemPtrNew(totPts * CLIP_MULTIPLIER * sizeof(LinkedEdge), (FskMemPtr*)(void*)(&pEdges))) != kFskErrNone) /* ... or we can allocate memory */
)
return err; /* Polygon is too big to render */
for (numEdges = 0, pe = pEdges; nContours--; pts += *nPts++, numEdges += n, pe += n)
BAIL_IF_NEGATIVE(n = TransformClipAndMakeEdges(*nPts, pts, M, &dstRect, &span, pe), err, kFskErrMemFull);
BAIL_IF_FALSE(numEdges >= 2, err, kFskErrNothingRendered);
err = ScanConvertLinkedEdges(numEdges, pEdges, fillRule, &span);
bail:
if (pEdges != edges)
FskMemPtrDispose(pEdges); /* Deallocate big polygon edges */
if ((span.disposeSpanData != NULL) && (span.spanData != NULL))
span.disposeSpanData(span.spanData);
return err;
}
示例7: kcl_int_free
static void
kcl_int_free(cint_t *ai)
{
if (ai->cint_data != NULL) {
FskMemPtrDispose(ai->cint_data);
ai->cint_data = NULL;
}
}
示例8: mraaPWMDispose
void mraaPWMDispose(FskPinPWM pin)
{
mraaPWM mpwm = (mraaPWM)pin;
mraaPWMSetDutyCycle(pin, 0);
mraa_pwm_enable(mpwm->context, 0);
mraa_pwm_close(mpwm->context);
FskMemPtrDispose(mpwm);
}
示例9: androidAudioOutDispose
FskErr androidAudioOutDispose(FskAudioOut audioOut) {
androidAudioExt *ext;
FskAudioNativePrintfVerbose("audioOutDispose %x", audioOut);
if (audioOut == NULL)
return kFskErrNone;
ext = (androidAudioExt*)audioOut->ext;
FskAudioNativePrintfVerbose("audioOutDispose ext is %x", ext);
if (ext) {
androidAudioOutStop(audioOut);
audioOut->ext = 0;
FskListMutexRemove(audioOuts, audioOut);
FskAudioNativePrintfDebug("removing audioOut->blocks list %x", audioOut->blocks);
FskListMutexDispose(audioOut->blocks);
FskMutexDispose(ext->getSamplePositionMutex);
if (ext->playItf) {
SLresult res;
FskAudioNativePrintfDebug("before delete ext->playItf: %x", ext->playItf);
res = (*ext->playItf)->SetPlayState(ext->playItf, SL_PLAYSTATE_STOPPED);
CheckErr("audioOutDispose - set playstate STOPPED", res);
res = (*ext->bufferQueueItf)->Clear(ext->bufferQueueItf);
CheckErr("audioOutDispose - calling clear on bufferQueue", res);
FskAudioNativePrintfDebug("after delete ext->playItf: %x", ext->playItf);
}
if (ext->audioBuf[0])
FskMemPtrDispose(ext->audioBuf[0]);
if (ext->audioBuf[1])
FskMemPtrDispose(ext->audioBuf[1]);
if (ext->player != NULL)
(*ext->player)->Destroy(ext->player);
if (ext->outputMixObject != NULL)
(*ext->outputMixObject)->Destroy(ext->outputMixObject);
FskMemPtrDispose(ext);
}
FskMemPtrDispose(audioOut);
return kFskErrNone;
}
示例10: xs_i2c
void xs_i2c(void *data)
{
if (data) {
xsI2C i2c = data;
FskPinI2CDispose(i2c->pin);
FskMemPtrDispose(i2c);
}
}
示例11: KplSemaphoreDispose
FskErr KplSemaphoreDispose(KplSemaphore sem)
{
if (sem) {
sem_destroy(&sem->hSem);
FskMemPtrDispose(sem);
}
return kFskErrNone;
}
示例12: FskFSFileClose
// ---------------------------------------------------------------------
FskErr FskFSFileClose(FskFSFile fref) {
if (fref) {
fclose(fref->theFile);
FskMemPtrDispose(fref);
}
return kFskErrNone;
}
示例13: FskFSFileTerminate
FskErr FskFSFileTerminate()
{
if (gStatFS != NULL) {
FskMemPtrDispose(gStatFS);
gStatFS = NULL;
}
return kFskErrNone;
}
示例14: KplTimeCallbackDispose
void KplTimeCallbackDispose(KplTimeCallback callback)
{
if (NULL == callback)
return;
KplTimeCallbackCancel(callback);
FskMemPtrDispose(callback);
}
示例15: KprHTTPConnectionDispose
void KprHTTPConnectionDispose(KprHTTPConnection self)
{
if (self->client) {
KprHTTPConnectionClose(self);
}
FskInstrumentedItemDispose(self);
FskMemPtrDispose(self);
}