本文整理汇总了C++中FskMemPtrNewClear函数的典型用法代码示例。如果您正苦于以下问题:C++ FskMemPtrNewClear函数的具体用法?C++ FskMemPtrNewClear怎么用?C++ FskMemPtrNewClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FskMemPtrNewClear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FskHTTPServerCreate
/*
interface is optional. If NULL, then all interfaces will be used
*/
FskErr FskHTTPServerCreate(int port, char *interfaceName, FskHTTPServer *server, void *refCon, Boolean ssl) {
FskHTTPServer http;
FskErr err;
FskInstrumentedTypePrintfDebug(&gFskHTTPServerTypeInstrumentation, "httpServerCreate\n");
err = FskMemPtrNewClear(sizeof(FskHTTPServerRecord), (FskMemPtr*)&http);
BAIL_IF_ERR(err);
sFskHTTPServerUpUse(http);
http->stopped = true;
http->refCon = refCon;
http->port = port;
http->keepAliveTimeout = kFskHTTPKeepAliveTimeout;
http->defaultBufferSize = kFskHTTPServerDefaultBufferSize;
http->owner = FskThreadGetCurrent();
http->ssl = ssl;
snprintf(http->name, 64, "%s:%d", interfaceName ? interfaceName : "all", port);
FskInstrumentedItemNew(http, http->name, &gFskHTTPServerTypeInstrumentation);
if (interfaceName) {
err = FskHTTPServerListenerAdd(http, port, interfaceName, NULL);
}
else {
FskNetInterfaceRecord *ifc;
int i, numI;
http->all = true;
numI = FskNetInterfaceEnumerate();
for (i=0; i<numI; i++) {
FskErr notErr = FskNetInterfaceDescribe(i, &ifc);
if (notErr) continue;
if (ifc->status) {
notErr = FskHTTPServerListenerAdd(http, port, ifc->name, NULL);
if (notErr) err = notErr;
}
FskNetInterfaceDescriptionDispose(ifc);
}
}
http->interfaceNotifier = FskNetInterfaceAddNotifier(httpServerInterfaceChanged, http, "http server");
bail:
*server = http;
return err;
}
示例2: amrReaderNew
FskErr amrReaderNew(FskMediaReader reader, void **readerState, const char *mimeType, const char *uri, FskMediaSpooler spooler)
{
FskErr err;
amrReader state = NULL;
BAIL_IF_NULL(spooler, err, kFskErrUnimplemented);
err = FskMemPtrNewClear(sizeof(amrReaderRecord), &state);
BAIL_IF_ERR(err);
*readerState = state; // must be set before anything that might issue a callback
state->spooler = spooler;
state->reader = reader;
if (spooler->doOpen) {
err = (spooler->doOpen)(spooler, kFskFilePermissionReadOnly);
BAIL_IF_ERR(err);
state->spoolerOpen = true;
}
state->spooler->onSpoolerCallback = amrSpoolerCallback;
state->spooler->clientRefCon = state;
state->spooler->flags |= kFskMediaSpoolerForwardOnly;
state->duration = kFskUInt32Max;
(reader->doSetState)(reader, kFskMediaPlayerStateInstantiating);
err = amrInstantiate(state);
if (err) {
if (kFskErrNeedMoreTime == err)
err = kFskErrNone;
goto bail;
}
bail:
if ((kFskErrNone != err) && (NULL != state)) {
amrReaderDispose(reader, state);
state = NULL;
}
*readerState = state;
return err;
}
示例3: KprSSDPClientNew
FskErr KprSSDPClientNew(KprSSDPClient *it, const char* type)
{
FskErr err = kFskErrNone;
KprSSDPClient self = NULL;
bailIfError(FskMemPtrNewClear(sizeof(KprSSDPClientRecord), it));
self = *it;
if (type) {
self->type = FskStrDoCopy(type);
bailIfNULL(self->type);
}
FskInstrumentedItemNew(self, NULL, &KprSSDPClientInstrumentation);
bail:
if (err)
KprSSDPClientDispose(self);
return err;
}
示例4: scanVolumes
void scanVolumes() {
FILE *mountList;
struct mntent *cur;
int err;
volInfo vi;
mntdevmap *walker;
struct statfs fsinfo;
mountList = setmntent(kKplLinuxVolumeListFile, "r");
if (mountList) {
while (NULL != (cur = getmntent(mountList))) {
err = statfs(cur->mnt_dir, &fsinfo);
if (0 != err) {
continue;
}
for (walker = gMntDevMap; NULL != walker->name; walker++) {
if (0 == FskStrCompareWithLength(cur->mnt_type, walker->name, FskStrLen(walker->name)))
break;
}
if (!walker->name) {
continue;
}
FskMemPtrNewClear(sizeof(volInfoRec), &vi);
vi->type = walker->type;
vi->removable = walker->removable;
vi->mounted = true;
vi->typeStr = FskStrDoCopy(cur->mnt_type);
if (kFskErrNone == FskMemPtrNew(FskStrLen(cur->mnt_dir) + 2, &vi->mountPoint)) {
FskStrCopy(vi->mountPoint, cur->mnt_dir);
if (vi->mountPoint[FskStrLen(vi->mountPoint)-1] != '/')
FskStrCat(vi->mountPoint, "/");
}
vi->name = copyNiceName(cur->mnt_fsname);
vi->capacity = fsinfo.f_blocks * fsinfo.f_bsize;
vi->remaining = fsinfo.f_bavail * fsinfo.f_bsize;
FskListAppend(&volumeList, vi);
}
endmntent(mountList);
}
}
示例5: lpcmPacketParserProcessPacket
FskErr lpcmPacketParserProcessPacket(RTPPacketParser parser, RTPPacket rtpHeader)
{
LPCMPacketParser lpcmPacketParser = (LPCMPacketParser)parser->handlerRefCon;
RTPCompressedMediaFrame frame;
FskErr err;
err = FskMemPtrNewClear(rtpHeader->dataSize + sizeof(RTPCompressedMediaFrameRecord), &frame);
BAIL_IF_ERR(err);
rtpHeader->frames = frame;
frame->length = rtpHeader->dataSize;
FskMemMove(frame + 1, rtpHeader->data, rtpHeader->dataSize);
rtpHeader->totalSamples = frame->length / (lpcmPacketParser->bitsPerSample/8) / lpcmPacketParser->nChannels;
bail:
return err;
}
示例6: KprZeroconfServiceNewType
FskErr KprZeroconfServiceNewType(char* authority, char** it)
{
#define kKPRZeroconfKinomaServe "_%s._tcp."
FskErr err = kFskErrNone;
char* type = NULL;
char* ptr;
UInt32 length = FskStrLen(authority);
UInt32 size = length + FskStrLen(kKPRZeroconfKinomaServe);
bailIfError(FskMemPtrNewClear(size, &type));
snprintf(type, size, kKPRZeroconfKinomaServe, authority);
type[length + 1] = 0;
for (ptr = FskStrChr(type, '.'); ptr; ptr = FskStrChr(ptr, '.'))
*ptr = '_';
type[length + 1] = '.';
*it = type;
bail:
return err;
}
示例7: KprCanvasNew
FskErr KprCanvasNew(KprCanvas* it, KprCoordinates coordinates)
{
FskErr err = kFskErrNone;
KprCanvas self;
bailIfError(FskMemPtrNewClear(sizeof(KprCanvasRecord), it));
self = *it;
FskInstrumentedItemNew(self, NULL, &KprCanvasInstrumentation);
self->dispatch = &KprCanvasDispatchRecord;
self->flags = kprVisible;
KprContentInitialize((KprContent)self, coordinates, NULL, NULL);
if (coordinates->width && coordinates->height) {
bailIfError(FskCanvasNew(coordinates->width, coordinates->height, PreferredPixelFormat(), &self->cnv));
FskCanvas2dSetOpenGLSourceAccelerated(self->cnv, true);
}
bail:
return err;
}
示例8: KprWebSocketServerNew
FskErr KprWebSocketServerNew(KprWebSocketServer* it, void *refCon)
{
FskErr err = kFskErrNone;
KprWebSocketServer self = NULL;
bailIfError(FskMemPtrNewClear(sizeof(KprWebSocketServerRecord), it));
self = *it;
self->stopped = false;
self->refCon = refCon;
self->owner = FskThreadGetCurrent();
// self->interfaceNotifier = FskNetInterfaceAddNotifier(KprWebSocketServerInterfaceChanged, self, "websocket server");
return err;
bail:
KprWebSocketServerDispose(self);
return err;
}
示例9: KprDebugNew
FskErr KprDebugNew(KprDebug* it, UInt32 port)
{
FskErr err = kFskErrNone;
KprDebug self = NULL;
BAIL_IF_ERR(err = FskMemPtrNewClear(sizeof(KprDebugRecord), it));
self = *it;
self->port = port;
BAIL_IF_ERR(err = KprSocketServerNew(&self->server, self));
self->server->debugName = "Debug";
self->server->acceptCallback = KprDebugAcceptNewConnection;
BAIL_IF_ERR(err = KprSocketServerListen(self->server, self->port, NULL));
FskListAppend(&gKprDebugList, self);
FskInstrumentedItemNew(self, NULL, &KprDebugInstrumentation);
return err;
bail:
KprDebugDispose(self);
return err;
}
示例10: KprWebSocketEndpointNew
FskErr KprWebSocketEndpointNew(KprWebSocketEndpoint* it, void *refcon)
{
FskErr err = kFskErrNone;
KprWebSocketEndpoint self = NULL;
bailIfError(FskMemPtrNewClear(sizeof(KprWebSocketEndpointRecord), it));
self = *it;
FskInstrumentedItemNew(self, NULL, &gKprWebSocketEndpointInstrumentation);
self->refcon = refcon;
self->state = kKprWebSocketStateConnecting;
FskDebugStr("CREATE: KprWebSocketEndpoint\n");
return err;
bail:
if (self) KprWebSocketEndpointDispose(self);
return err;
}
示例11: FskGtkWindowCreate
FskErr FskGtkWindowCreate(FskWindow fskWindow, UInt32 style, SInt32 width, SInt32 height)
{
FskErr err = kFskErrNone;
FskGtkWindow gtkWin;
if(fskWindow->gtkWin == NULL) {
err = FskMemPtrNewClear(sizeof(FskGtkWindowRecord), &(fskWindow->gtkWin));
BAIL_IF_ERR(err);
}
gtkWin = (FskGtkWindow)fskWindow->gtkWin;
gtkWin->width = width;
gtkWin->height = height;
FskGtkWindowInit(fskWindow);
bail:
return err;
}
示例12: KplConditionNew
FskErr KplConditionNew(KplCondition *conditionOut)
{
FskErr err;
KplCondition condition = NULL;
err = FskMemPtrNewClear(sizeof(KplConditionRecord), (FskMemPtr *)&condition);
if (err) goto bail;
pthread_cond_init(&condition->cond, NULL);
bail:
if (err) {
KplConditionDispose(condition);
condition = NULL;
}
*conditionOut = condition;
return err;
}
示例13: FskAudioCompressNew
FskErr FskAudioCompressNew(FskAudioCompress *compOut, const char *outputFormat, const char *inputFormat, UInt32 inputSampleRate, UInt32 inputChannelCount)
{
FskErr err;
FskAudioCompressor encoder;
FskAudioCompress comp;
UInt32 i = 0;
while (true) {
Boolean canHandle = false;
encoder = (FskAudioCompressor)FskExtensionGetByIndex(kFskExtensionAudioCompressor, i++);
if (NULL == encoder) {
*compOut = NULL;
return kFskErrExtensionNotFound;
}
if ((kFskErrNone == encoder->doCanHandle(outputFormat, &canHandle)) && canHandle)
break;
}
err = FskMemPtrNewClear(sizeof(FskAudioCompressRecord), &comp);
BAIL_IF_ERR(err);
comp->outputFormat = FskStrDoCopy(outputFormat);
comp->inputFormat = FskStrDoCopy(inputFormat);
comp->inputSampleRate = inputSampleRate;
comp->inputChannelCount = inputChannelCount;
comp->outputSampleRate = inputSampleRate;
comp->outputChannelCount = inputChannelCount;
comp->encoder = encoder;
err = comp->encoder->doNew(comp);
BAIL_IF_ERR(err);
bail:
if (err) {
FskAudioCompressDispose(comp);
comp = NULL;
}
*compOut = comp;
return err;
}
示例14: fxLoadModuleJSB
void fxLoadModuleJSB(txMachine* the, txString path, txID moduleID)
{
FskErr err = kFskErrNone;
txScript* script = NULL;
FskFile fref = NULL;
Atom atom;
bailIfError(FskMemPtrNewClear(sizeof(txScript), &script));
bailIfError(FskFileOpen(path, kFskFilePermissionReadOnly, &fref));
bailIfError(fxLoadModuleJSBAtom(the, fref, &atom));
bailAssert(atom.atomType == XS_ATOM_BINARY);
bailIfError(fxLoadModuleJSBAtom(the, fref, &atom));
bailAssert(atom.atomType == XS_ATOM_VERSION);
bailIfError(FskFileRead(fref, sizeof(script->version), script->version, NULL));
bailAssert(script->version[0] == XS_MAJOR_VERSION);
bailAssert(script->version[1] == XS_MINOR_VERSION);
bailAssert(script->version[2] == XS_PATCH_VERSION);
bailAssert(script->version[3] != -1);
bailIfError(fxLoadModuleJSBAtom(the, fref, &atom));
bailAssert(atom.atomType == XS_ATOM_SYMBOLS);
script->symbolsSize = atom.atomSize - sizeof(atom);
bailIfError(FskMemPtrNew(script->symbolsSize, &script->symbolsBuffer));
bailIfError(FskFileRead(fref, script->symbolsSize, script->symbolsBuffer, NULL));
bailIfError(fxLoadModuleJSBAtom(the, fref, &atom));
bailAssert(atom.atomType == XS_ATOM_CODE);
script->codeSize = atom.atomSize - sizeof(atom);
bailIfError(FskMemPtrNew(script->codeSize, &script->codeBuffer));
bailIfError(FskFileRead(fref, script->codeSize, script->codeBuffer, NULL));
bail:
if (fref)
FskFileClose(fref);
if (err) {
if (script) {
fxDeleteScript(script);
script = NULL;
}
}
fxResolveModule(the, moduleID, script, NULL, NULL);
}
示例15: FskMutexNew_
FskErr FskMutexNew_(FskMutex *mutex, const char *name, FSK_SYNCHRONIZATION_DEBUG_ARGS)
#endif
{
FskMutex mtx = NULL;
FskErr err;
err = FskMemPtrNewClear(sizeof(FskMutexRecord), (FskMemPtr *)&mtx);
BAIL_IF_ERR(err);
err = KplMutexNew((KplMutex*)&mtx->kplMutex);
BAIL_IF_ERR(err);
#if SUPPORT_INSTRUMENTATION
mtx->name = FskStrDoCopy_Untracked(name);
FskInstrumentedItemNew(mtx, mtx->name, &gFskMutexTypeInstrumentation);
#if SUPPORT_SYNCHRONIZATION_DEBUG
if (FskInstrumentedItemHasListeners(mtx)) {
FskSynchronizationInstrMsgRecord msg;
msg.name = name;
msg.file = file;
msg.line = line;
msg.function = function;
FskInstrumentedItemSendMessage(mtx, kFskSynchronizationInstrMsgMutexNew, &msg);
}
#endif
#endif
bail:
if ((err != kFskErrNone) && (mtx != NULL)) {
KplMutexDispose(mtx->kplMutex);
#if SUPPORT_INSTRUMENTATION
FskMemPtrDispose_Untracked((void*)mtx->name);
#endif
FskMemPtrDispose(mtx);
mtx = NULL;
}
*mutex = mtx;
return err;
}