本文整理汇总了C++中FskMemPtrNewClear函数的典型用法代码示例。如果您正苦于以下问题:C++ FskMemPtrNewClear函数的具体用法?C++ FskMemPtrNewClear怎么用?C++ FskMemPtrNewClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FskMemPtrNewClear函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:archite,项目名称:kinomajs,代码行数:49,代码来源:FskHTTPServer.c
示例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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:46,代码来源:FskMediaReaderAMR.c
示例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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:17,代码来源:kprSSDPClient.c
示例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);
}
}
开发者ID:VzqzAc,项目名称:kinomajs,代码行数:45,代码来源:KplFilesLinux.c
示例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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:18,代码来源:RTPPacketParserLPCM.c
示例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;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:18,代码来源:kprZeroconf.c
示例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;
}
开发者ID:afrog33k,项目名称:kinomajs,代码行数:18,代码来源:kprCanvas.c
示例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;
}
开发者ID:VzqzAc,项目名称:kinomajs,代码行数:18,代码来源:kprWebSocketServer.c
示例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;
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:18,代码来源:kprDebug.c
示例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;
}
开发者ID:giapdangle,项目名称:kinomajs,代码行数:18,代码来源:kprWebSocketEndpoint.c
示例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;
}
开发者ID:VzqzAc,项目名称:kinomajs,代码行数:18,代码来源:FskGtkWindow.c
示例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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:18,代码来源:KplSynchronizationLinux.c
示例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;
}
开发者ID:lizhizhou,项目名称:kinomajs,代码行数:43,代码来源:FskAudioCodec.c
示例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);
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:43,代码来源:xs6Host.c
示例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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:43,代码来源:FskSynchronization.c
示例16: refillQueue
void refillQueue(FskAudioOut audioOut) {
void *silence;
FskAudioOutBlock block;
androidAudioExt *ext;
ext = (androidAudioExt*)audioOut->ext;
FskAudioNativePrintfDebug("refillQueue");
if (audioOut->moreCB) {
SInt32 samplesTarget;
// SInt32 chunkRequestSize = 8192;
SInt32 chunkRequestSize = AUDIO_DATA_BUFFER_SIZE;
samplesTarget = audioOut->sampleRate * audioOut->numChannels;
if (audioOut->chunkRequestSize)
chunkRequestSize = audioOut->chunkRequestSize;
if (audioOut->bufferedSamplesTarget)
samplesTarget = audioOut->bufferedSamplesTarget;
while (true) {
SInt32 samplesNeeded;
FskErr err;
samplesNeeded = samplesTarget - (ext->bytesEnqueued / ext->sampleSize);
//FskAudioNativePrintfDebug("samplesNeeded %d - samplesTarget %d", samplesNeeded, samplesTarget);
if (samplesNeeded < chunkRequestSize)
break;
if (kFskErrNone == (err = (audioOut->moreCB)(audioOut, audioOut->moreRefCon, chunkRequestSize)))
continue;
#if DONT_GENERATE_SILENCE
break;
#else
// make silence
FskAudioNativePrintfDebug("making silence because more callback returns %d", err);
FskMemPtrNewClear(chunkRequestSize * 2 * audioOut->numChannels, (FskMemPtr*)&silence);
if (kFskErrNone != audioOutEnqueue(audioOut, silence, chunkRequestSize * 2 * audioOut->numChannels, NULL, 0, NULL, &block))
break;
block->silence = true;
#endif
}
}
FskAudioNativePrintfDebug("refillQueue - DONE");
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:42,代码来源:androidAudio3.cpp
示例17: mraaDigitalNew
FskErr mraaDigitalNew(FskPinDigital *pin, SInt32 number, const char *name, FskPinsDigitalDirection direction)
{
FskErr err;
mraa_gpio_context context;
mraaDigital md;
context = mraa_gpio_init(number);
if (!context) return kFskErrOperationFailed;
err = FskMemPtrNewClear(sizeof(mraaDigitalRecord), (FskMemPtr *)&md);
if (err) {
mraa_gpio_close(context);
return err;
}
md->context = context;
*pin = (FskPinDigital)md;
return mraaDigitalSetDirection(*pin, direction);
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:20,代码来源:FskPinDigitalMRAA.c
示例18: KplSemaphoreNew
FskErr KplSemaphoreNew(KplSemaphore *sem, UInt32 value)
{
FskErr err;
err = FskMemPtrNewClear(sizeof(KplSemaphoreRecord), (FskMemPtr *)sem);
if (err) goto bail;
if (sem_init(&(*sem)->hSem, 0, value) != 0) {
err = kFskErrOperationFailed;
goto bail;
}
bail:
if ((err != kFskErrNone) && (*sem != NULL)) {
FskMemPtrDispose(*sem);
*sem = NULL;
}
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:20,代码来源:KplSynchronizationLinux.c
示例19: FskNetInterfaceAddNotifier
FskNetInterfaceNotifier FskNetInterfaceAddNotifier(FskNetInterfaceChangedCallback callback, void *param, char *debugName)
{
FskNetInterfaceNotifier notRef = NULL;
FskThread thread = FskThreadGetCurrent();
UInt32 nameLen = debugName ? FskStrLen(debugName) + 1 : 0;
if (kFskErrNone == FskMemPtrNewClear(sizeof(FskNetInterfaceNotifierRec) + nameLen, ¬Ref)) {
FskInstrumentedTypePrintfDebug(&gNetInterfaceNotifierTypeInstrumentation, "NetInterfaceNotifier NEW -- %x", notRef);
notRef->callback = callback;
notRef->param = param;
notRef->thread = thread;
if (nameLen)
FskMemMove(notRef->name, debugName, nameLen);
FskListMutexPrepend(interfaceChangeCBList, notRef);
FskInstrumentedItemNew(notRef, notRef->name, &gNetInterfaceNotifierTypeInstrumentation);
}
return notRef;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:20,代码来源:FskNetInterface.c
示例20: KprNetworkInterfaceMark
FskErr KprNetworkInterfaceMark(int ip, char *name)
{
FskErr err = kFskErrNone;
KprNetworkInterface* address = &gNetworkInterface;
KprNetworkInterface self;
while ((self = *address)) {
if ((self->ip == ip) && !FskStrCompare(self->name, name)) {
self->flag = 1;
return err;
}
address = &self->next;
}
bailIfError(FskMemPtrNewClear(sizeof(KprNetworkInterfaceRecord), address));
self = *address;
self->ip = ip;
self->name = FskStrDoCopy(name);
bailIfNULL(self->name);
bail:
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:20,代码来源:kprNetworkInterface.c
注:本文中的FskMemPtrNewClear函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论