本文整理汇总了C++中BAIL_IF_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ BAIL_IF_ERR函数的具体用法?C++ BAIL_IF_ERR怎么用?C++ BAIL_IF_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BAIL_IF_ERR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FskMuxerTrackNew
FskErr FskMuxerTrackNew(FskMuxer muxer, FskMuxerTrack *muxerTrackOut, const char *trackType, UInt32 scale)
{
FskErr err;
FskMuxerTrack track = NULL;
err = FskMemPtrNewClear(sizeof(FskMuxerTrackRecord) + FskStrLen(trackType) + 1, &track);
BAIL_IF_ERR(err);
track->trackType = (char *)(track + 1);
FskStrCopy(track->trackType, trackType);
track->scale = scale;
track->muxer = muxer;
err = (muxer->dispatch->doNewTrack)(muxer, muxer->state, track, &track->dispatch, &track->state);
BAIL_IF_ERR(err);
FskListAppend((FskList*)(void*)&muxer->tracks, track);
bail:
if (kFskErrNone != err) {
FskMuxerTrackDispose(track);
track = NULL;
}
*muxerTrackOut = track;
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:28,代码来源:FskMuxer.c
示例2: FskGPIONew
static FskErr FskGPIONew(FskGPIO *gpioOut, int pin, char *pinName, GPIOdirection direction)
{
FskErr err = kFskErrNone;
FskGPIO gpio = NULL;
err = FskMemPtrNewClear(sizeof(FskGPIORecord), (FskMemPtr *)&gpio);
BAIL_IF_ERR(err);
gpio->pinNum = pin;
gpio->realPin = FskHardwarePinsMux(pin, kFskHardwarePinGPIO);
gpio->thread = FskThreadGetCurrent();
if (gpio->realPin < 0)
BAIL(kFskErrInvalidParameter);
err = FskGPIOPlatformInit(gpio);
BAIL_IF_ERR(err);
if (undefined != direction) {
err = FskGPIOPlatformSetDirection(gpio, direction);
BAIL_IF_ERR(err);
}
bail:
if (err && gpio) {
FskGPIOPlatformDispose(gpio);
FskMemPtrDisposeAt(&gpio);
}
*gpioOut = gpio;
return err;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:33,代码来源:gpio.c
示例3: FskSemaphoreNew_
FskErr FskSemaphoreNew_(FskSemaphore *sem, UInt32 value, FSK_SYNCHRONIZATION_DEBUG_ARGS)
#endif
{
FskErr err;
err = FskMemPtrNewClear(sizeof(FskSemaphoreRecord), (FskMemPtr *)sem);
BAIL_IF_ERR(err);
err = KplSemaphoreNew((KplSemaphore*)&(*sem)->kplSem, value);
BAIL_IF_ERR(err);
FskInstrumentedItemNew(*sem, NULL, &gFskSemaphoreTypeInstrumentation);
#if SUPPORT_INSTRUMENTATION && SUPPORT_SYNCHRONIZATION_DEBUG
if (FskInstrumentedItemHasListeners(*sem)) {
FskSynchronizationInstrMsgRecord msg;
msg.file = file;
msg.line = line;
msg.function = function;
FskInstrumentedItemSendMessage(*sem, kFskSynchronizationInstrMsgSemaphoreNew, &msg);
}
#endif
bail:
if ((err != kFskErrNone) && (*sem != NULL)) {
KplSemaphoreDispose((*sem)->kplSem);
FskMemPtrDispose(*sem);
*sem = NULL;
}
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:31,代码来源:FskSynchronization.c
示例4: FskFSVolumeNotifierNew
FskErr FskFSVolumeNotifierNew(FskVolumeNotifierCallbackProc callback, void *refCon, FskFSVolumeNotifier *volNtfOut) {
FskErr err;
FskFSVolumeNotifier volNtf = NULL;
FskAndroidFilesPrintfDebug("VolumeNotifierNew\n");
if (NULL == gVolNotifiers) {
err = FskMutexNew(&gVolNotifiersMutex, "volume notifier");
BAIL_IF_ERR(err);
}
err = FskMemPtrNewClear(sizeof(FskFSVolumeNotifierRecord), (FskMemPtr*)(void*)&volNtf);
BAIL_IF_ERR(err);
FskMutexAcquire(gVolNotifiersMutex);
volNtf->dispatch.dispatch = &gFSDispatch;
volNtf->dispatch.refcon = NULL;
volNtf->callback = callback;
volNtf->refCon = refCon;
volNtf->callbackThread = FskThreadGetCurrent();
FskListPrepend(&gVolNotifiers, &volNtf->next);
FskMutexRelease(gVolNotifiersMutex);
bail:
*volNtfOut = volNtf;
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:30,代码来源:FskFilesAndroid.c
示例5: sFskNetInterfaceEnumerate
static FskErr sFskNetInterfaceEnumerate(FskNetInterfaceRecord **interfaceList)
{
FskErr err;
KplNetInterfaceRecord *kplInterfaceList;
*interfaceList = NULL;
err = KplNetInterfaceEnumerate(&kplInterfaceList);
BAIL_IF_ERR(err);
while (kplInterfaceList) {
FskNetInterfaceRecord *nir;
KplNetInterfaceRecord *next = kplInterfaceList->next;
err = FskMemPtrNew(sizeof(FskNetInterfaceRecord), (FskMemPtr*)&nir);
BAIL_IF_ERR(err);
nir->name = FskStrDoCopy(kplInterfaceList->name);
nir->ip = kplInterfaceList->ip;
FskMemMove(nir->MAC, kplInterfaceList->MAC, sizeof(nir->MAC));
nir->status = kplInterfaceList->status;
nir->netmask = kplInterfaceList->netmask;
FskListAppend((FskList*)interfaceList, nir);
FskMemPtrDispose(kplInterfaceList->name);
FskMemPtrDispose(kplInterfaceList);
kplInterfaceList = next;
}
bail:
return err;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:34,代码来源:FskNetInterface.c
示例6: FskMutexNew_uninstrumented
FskErr FskMutexNew_uninstrumented(FskMutex *mutex, const char *name)
{
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);
#endif
bail:
if ((err != kFskErrNone) && (mtx != NULL)) {
KplMutexDispose(mtx->kplMutex);
#if SUPPORT_INSTRUMENTATION
FskMemPtrDispose((void*)mtx->name);
#endif
FskMemPtrDispose(mtx);
mtx = NULL;
}
*mutex = mtx;
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:28,代码来源:FskSynchronization.c
示例7: KprDebugMachineNew
FskErr KprDebugMachineNew(KprDebugMachine* it, KprDebug debug, FskSocket skt)
{
FskErr err = kFskErrNone;
KprDebugMachine self = NULL;
UInt32 ip;
int port;
BAIL_IF_ERR(err = FskMemPtrNewClear(sizeof(KprDebugMachineRecord), it));
self = *it;
self->debug = debug;
self->socket = skt;
BAIL_IF_ERR(err = FskNetSocketGetRemoteAddress(skt, &ip, &port));
FskNetIPandPortToString(ip, port, self->address);
FskListAppend(&self->debug->machine, self);
FskNetSocketReceiveBufferSetSize(self->socket, kSocketBufferSize);
FskThreadAddDataHandler(&self->reader, (FskThreadDataSource)self->socket, KprDebugMachineDataReader, true, false, self);
bailIfError(KprSocketWriterNew(&self->writer, self->socket, self));
self->writer->errorCallback = KprDebugMachineWriteError;
KprDebugMachineCallbackText(self, "onMachineRegistered", mxNoCommand, NULL);
FskInstrumentedItemNew(self, NULL, &KprDebugMachineInstrumentation);
return err;
bail:
KprDebugMachineDispose(self);
return err;
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:32,代码来源:kprDebug.c
示例8: FskFSFileRename
FskErr FskFSFileRename(const char *fullPath, const char *newName)
{
int err;
char *p, newPath[PATH_MAX];
FskFileInfo itemInfo;
err = sCheckFullPath(fullPath, kFskPathIsFile);
BAIL_IF_ERR(err);
err = FskFSFileGetFileInfo(fullPath, &itemInfo);
BAIL_IF_ERR(err);
if (itemInfo.filetype == kFskDirectoryItemIsDirectory)
BAIL(kFskErrIsDirectory);
p = FskStrRChr((char *)newName, '/');
if (p)
BAIL(kFskErrOperationFailed); // newName contains path elements
FskStrCopy(newPath, fullPath);
p = FskStrRChr(newPath, '/');
if (p)
*++p = '\0';
FskStrCat(newPath, newName);
err = rename(fullPath, newPath);
if (err == -1)
BAIL(errnoToFskErr(errno));
err = kFskErrNone;
bail:
return err;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:34,代码来源:FskFilesAndroid.c
示例9: 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;
}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:34,代码来源:FskFilesAndroid.c
示例10: ButtEndCap
static FskErr
ButtEndCap(const LineSeg *seg, UInt32 end, FskGrowableFixedPoint2DArray array)
{
FskErr err;
FskFixedVector2D v;
FskFixedPoint2D p;
const FskFixedPoint2D *center;
v.x = FskFixedNMul(seg->perp.x, seg->strokeWidth, 31);
v.y = FskFixedNMul(seg->perp.y, seg->strokeWidth, 31);
if (!end) { /* Starting endpoint */
center = &seg->pt[0];
}
else { /* Ending endpoint */
v.x = -v.x;
v.y = -v.y;
center = &seg->pt[1];
}
p.x = center->x - v.x;
p.y = center->y - v.y;
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItem(array, &p));
p.x = center->x + v.x;
p.y = center->y + v.y;
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItem(array, &p));
bail:
return err;
}
开发者ID:giapdangle,项目名称:kinomajs,代码行数:31,代码来源:FskWideLineToPolygon.c
示例11: BeveledJoin
static FskErr
BeveledJoin(const LineSeg *seg0, const LineSeg *seg1, FskGrowableFixedPoint2DArray fwdPoly, FskGrowableFixedPoint2DArray revPoly)
{
FskErr err = kFskErrNone;
FskFract sinAng, cosAng, snmHaf, sinHaf, cosHaf;
FskFixed bevHafWidth, mitLength, maxElbow;
FskFractVector2D u;
FskFixedVector2D b, c, e;
FskFixedPoint2D p[3];
sinAng = FskFractCrossProduct2D(&seg0->par, &seg1->par); /* Sine of change in trajectory */
if (sinAng == 0) /* Collinear */
goto bail; /* All done */
cosAng = FskFractDotProduct(&seg0->par.x, &seg1->par.x, 2); /* Cosine of change in trajectory */
if (cosAng > FRACT_ONE) cosAng = FRACT_ONE;
else if (cosAng < -FRACT_ONE) cosAng = -FRACT_ONE;
cosHaf = FskFracSqrt(FRACT_HALF - (cosAng >> 1)); /* Cosine of half the subtended angle */
snmHaf = FskFracSqrt(FRACT_HALF + (cosAng >> 1)); /* Sine of half the subtended angle */
if (snmHaf != 0) {
sinHaf = snmHaf;
if (sinAng < 0) sinHaf = -sinHaf;
u.x = FskFixedNLinear2D(seg0->par.x, cosHaf, seg0->par.y, sinHaf, 30); /* Unit vector to elbow, inside or outside */
u.y = FskFixedNLinear2D(seg0->par.y, cosHaf, -seg0->par.x, sinHaf, 30);
bevHafWidth = (FskFixed)(((FskInt64)(seg0->strokeWidth) * cosHaf / (FRACT_ONE + snmHaf) + 1) >> 1);
c.x = FskFixedNMul(seg0->strokeWidth, u.x, 31); /* Midpoint of bevel */
c.y = FskFixedNMul(seg0->strokeWidth, u.y, 31);
b.x = FskFracMul(bevHafWidth, -u.y); /* Half-vector of bevel */
b.y = FskFracMul(bevHafWidth, u.x);
mitLength = FskFixedNDiv(seg0->strokeWidth, snmHaf, 29);
if ((maxElbow = (seg0->strokeWidth)) < seg0->length) /* Limit the extent of the inside bevel joint */
maxElbow = seg0->length;
if (maxElbow < seg1->length)
maxElbow = seg1->length;
if (mitLength > maxElbow)
mitLength = maxElbow;
e.x = FskFracMul(mitLength, u.x); /* Scaled vector to elbow, inside */
e.y = FskFracMul(mitLength, u.y);
if (sinAng > 0) { /* Positive rotation */
p[0].x = seg0->pt[1].x + c.x - b.x; /* First bevel point */
p[0].y = seg0->pt[1].y + c.y - b.y;
p[1].x = seg0->pt[1].x + c.x + b.x; /* Second bevel point */
p[1].y = seg0->pt[1].y + c.y + b.y;
p[2].x = seg0->pt[1].x - e.x; /* Inside elbow */
p[2].y = seg0->pt[1].y - e.y;
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItems(revPoly, &p[0], 2));
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItem( fwdPoly, &p[2]));
}
else { /* Negative rotation */
p[0].x = seg0->pt[1].x + c.x + b.x; /* First bevel point */
p[0].y = seg0->pt[1].y + c.y + b.y;
p[1].x = seg0->pt[1].x + c.x - b.x; /* Second bevel point */
p[1].y = seg0->pt[1].y + c.y - b.y;
p[2].x = seg0->pt[1].x - e.x; /* Inside elbow */
p[2].y = seg0->pt[1].y - e.y;
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItems(fwdPoly, &p[0], 2));
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayAppendItem( revPoly, &p[2]));
}
}
开发者ID:giapdangle,项目名称:kinomajs,代码行数:59,代码来源:FskWideLineToPolygon.c
示例12: FskFramePolygon
FskErr
FskFramePolygon(
UInt32 nPts,
const FskFixedPoint2D *pts,
FskFixed strokeWidth,
FskFixed jointSharpness,
const FskColorSource *frameColor,
const FskFixedMatrix3x2 *M,
UInt32 quality,
FskConstRectangle clipRect,
FskBitmap dstBM
)
{
FskErr err;
const FskColorSource *frameFillColors[2];
if (frameColor->dashCycles != 0) /* Do special processing for dashed lines: @@@ should have endcap spec for dashes */
return FrameDashedPolyLine(nPts, pts, strokeWidth, jointSharpness, kFskLineEndCapClosed|kFskLineEndCapButt, frameColor, M, quality, clipRect, dstBM);
if (M) strokeWidth = ScaleStrokeWidth(strokeWidth, M);
if ( (strokeWidth <= FIXED_ONE)
&& (frameColor->type == kFskColorSourceTypeConstant)
) {
if (quality == 0) {
FskConstColorRGB frColor = (FskConstColorRGB)(void*)(&(((const FskColorSourceConstant*)(void*)frameColor)->color));
err = FrameJaggyNarrowPolyLine( nPts, pts, 1, frColor, M, clipRect, dstBM);
} else {
frameFillColors[0] = frameColor;
frameFillColors[1] = NULL;
err = FskAAPolygonContours(1, &nPts, pts, FIXED_ONE, frameFillColors, -1, M, clipRect, dstBM);
}
}
else {
FskGrowableFixedPoint2DArray pgon = NULL;
UInt32 n;
FskFixedPoint2D *p;
BAIL_IF_ERR(err = FskWidePolyLineToPolygon(nPts, pts, strokeWidth, jointSharpness, kFskLineEndCapClosed, M, &pgon));
BAIL_IF_ZERO((n = FskGrowableFixedPoint2DArrayGetItemCount(pgon)), err, kFskErrNothingRendered);
BAIL_IF_ERR(err = FskGrowableFixedPoint2DArrayGetPointerToItem(pgon, 0, (void**)(void*)(&p)));
if (quality == 0) {
err = FillJaggyPolygonContours(1, &n, p, frameColor, kFskFillRuleNonZero, NULL, clipRect, dstBM);
} else {
frameFillColors[0] = NULL;
frameFillColors[1] = frameColor;
err = FskAAPolygonContours( 1, &n, p, -1, frameFillColors, kFskFillRuleNonZero, NULL, clipRect, dstBM);
}
bail:
if (pgon != NULL) FskGrowableFixedPoint2DArrayDispose(pgon);
}
return err;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:55,代码来源:FskPolygon.c
示例13: httpServerListenerStart
static FskErr httpServerListenerStart(FskHTTPServerListener listener, FskSocket skt) {
FskErr err = kFskErrNone;
FskHTTPServerRequest request;
if (listener->http->stopped) {
FskInstrumentedItemSendMessage(listener->http, kFskHTTPInstrMsgConnectionRefusedStopped, listener);
listener->http->stats.connectionsRefused++;
FskNetSocketClose(skt);
goto bail;
}
err = FskMemPtrNewClear(sizeof(FskHTTPServerRequestRecord), (FskMemPtr*)&request);
BAIL_IF_ERR(err);
sFskHTTPServerRequestUpUse(request);
request->http = listener->http;
request->skt = skt;
FskNetSocketGetRemoteAddress(skt, (UInt32 *)&request->requesterAddress, &request->requesterPort);
FskNetSocketMakeNonblocking(request->skt);
err = FskHeaderStructNew(&request->requestHeaders);
BAIL_IF_ERR(err);
err = FskHeaderStructNew(&request->responseHeaders);
BAIL_IF_ERR(err);
request->in.bufferSize = request->http->defaultBufferSize;
request->out.bufferSize = request->http->defaultBufferSize;
err = FskMemPtrNew(request->in.bufferSize, (FskMemPtr*)&request->in.buf);
BAIL_IF_ERR(err);
err = FskMemPtrNew(request->out.bufferSize, (FskMemPtr*)&request->out.buf);
BAIL_IF_ERR(err);
FskListAppend((FskList*)&request->http->activeRequests, request);
FskTimeCallbackNew(&request->cycleCallback);
FskTimeCallbackNew(&request->keepAliveKillCallback);
listener->http->stats.connectionsMade++;
request->state = kHTTPNewSession;
FskInstrumentedItemNew(request, NULL, &gFskHTTPServerRequestTypeInstrumentation);
FskInstrumentedItemSetOwner(request, request->http);
FskTimeCallbackScheduleNextRun(request->cycleCallback, httpServerTimeCycle, request);
doCallCondition(request->http->callbacks->requestCondition, request, kFskHTTPConditionConnectionInitialized, request->refCon);
FskTimeCallbackNew(&request->timer);
FskTimeCallbackScheduleFuture(request->timer, 1, 0, KprHTTPServerTimerCallback, request);
bail:
if (err)
FskHTTPServerRequestDispose(request);
return err;
}
开发者ID:archite,项目名称:kinomajs,代码行数:51,代码来源:FskHTTPServer.c
示例14: FskAudioDecompressNew
FskErr FskAudioDecompressNew(FskAudioDecompress *decoOut, UInt32 audioFormat, const char *mimeType, UInt32 sampleRate, UInt32 channelCount, void *formatInfo, UInt32 formatInfoSize)
{
FskErr err;
FskAudioDecompressor decoder;
FskAudioDecompress deco;
UInt32 i = 0;
while (true) {
Boolean canHandle = false;
decoder = (FskAudioDecompressor)FskExtensionGetByIndex(kFskExtensionAudioDecompressor, i++);
if (NULL == decoder) {
if (decoOut)
*decoOut = NULL;
return kFskErrExtensionNotFound;
}
if ((kFskErrNone == decoder->doCanHandle(audioFormat, mimeType, &canHandle)) && canHandle)
break;
}
if (NULL == decoOut)
return kFskErrNone; // can handler
err = FskMemPtrNewClear(sizeof(FskAudioDecompressRecord), &deco);
BAIL_IF_ERR(err);
deco->inputSampleRate = sampleRate;
deco->inputChannelCount = channelCount;
deco->outputChannelCount = channelCount;
deco->formatInfoSize = formatInfoSize;
err = FskMemPtrNewFromData(formatInfoSize, formatInfo, (FskMemPtr*)(void*)&deco->formatInfo);
BAIL_IF_ERR(err);
deco->decoder = decoder;
FskInstrumentedItemNew(deco, FskStrDoCopy_Untracked(mimeType), &gAudioDecompressTypeInstrumentation);
err = deco->decoder->doNew(deco, audioFormat, mimeType);
BAIL_IF_ERR(err);
bail:
if (err) {
FskAudioDecompressDispose(deco);
deco = NULL;
}
*decoOut = deco;
return err;
}
开发者ID:lizhizhou,项目名称:kinomajs,代码行数:48,代码来源:FskAudioCodec.c
示例15: FskPinAnalogNew
FskErr FskPinAnalogNew(FskPinAnalog *pin, SInt32 number, const char *name)
{
FskErr err;
FskPinAnalogDispatch dispatch = NULL;
UInt32 i = 0;
while (true) {
FskPinAnalogDispatch aDispatch = FskExtensionGetByIndex(kFskExtensionPinAnalog, i++);
if (NULL == aDispatch)
BAIL(kFskErrExtensionNotFound);
if ((aDispatch->doCanHandle)(number, name, &number)) {
dispatch = aDispatch;
break;
}
}
err = (dispatch->doNew)(pin, number, name);
BAIL_IF_ERR(err);
(*pin)->dispatch = dispatch;
bail:
return err;
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:25,代码来源:FskPin.c
示例16: FskPinI2CNew
FskErr FskPinI2CNew(FskPinI2C *pin, SInt32 sda, SInt32 sclk, SInt32 bus)
{
FskErr err;
FskPinI2CDispatch dispatch = NULL;
UInt32 i = 0;
while (true) {
SInt32 remappedBus = kFskPinI2CNoBus;
FskPinI2CDispatch aDispatch = FskExtensionGetByIndex(kFskExtensionPinI2C, i++);
if (NULL == aDispatch)
BAIL(kFskErrExtensionNotFound);
if ((aDispatch->doCanHandle)(sda, sclk, bus, &remappedBus)) {
dispatch = aDispatch;
break;
}
if (kFskPinI2CNoBus != remappedBus)
bus = remappedBus;
}
err = (dispatch->doNew)(pin, sda, sclk, bus);
BAIL_IF_ERR(err);
(*pin)->dispatch = dispatch;
bail:
return err;
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:29,代码来源:FskPin.c
示例17: FskAudioCompressFrames
FskErr FskAudioCompressFrames(FskAudioCompress comp, const void *inData, UInt32 inDataSize, UInt32 inSampleCount,
void **outSamples, UInt32 *outDataSize, UInt32 **outFrameSizes, UInt32 *outFrameCount, UInt32 *outSampleCount, UInt32 *outSampleRate, UInt32 *outChannelCount)
{
FskErr err = kFskErrNone;
UInt32 frameCount;
*outSamples = NULL;
*outFrameSizes = NULL;
if (outFrameCount)
*outFrameCount = 0;
err = (comp->encoder->doCompressFrames)(comp->state, comp, inData, inDataSize, inSampleCount,
outSamples, outDataSize, outFrameSizes, &frameCount);
comp->frameNumber += 1;
BAIL_IF_ERR(err);
if (outSampleRate)
*outSampleRate = comp->outputSampleRate;
if (outChannelCount)
*outChannelCount = comp->outputChannelCount;
if (outFrameCount)
*outFrameCount = frameCount;
if (outSampleCount)
*outSampleCount = comp->outputSamplesPerFrame * frameCount;
bail:
return err;
}
开发者ID:lizhizhou,项目名称:kinomajs,代码行数:28,代码来源:FskAudioCodec.c
示例18: 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
示例19: on_drag_data_received
void on_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
{
FskGtkWindow gtkWin = user_data;
gboolean dnd_success = FALSE;
FskDragDropFile dropFileList = NULL;
FskDragDropFile droppedFile = NULL;
char* path = NULL;
if (gdk_drag_context_get_suggested_action(context) == GDK_ACTION_COPY) {
char* string = (char*)gtk_selection_data_get_data(data);
char* end;
FskFileInfo itemInfo;
for (end = FskStrStr(string, "\r\n"); end; end = FskStrStr(string, "\r\n")) {
BAIL_IF_ERR(FskMemPtrNewClear(sizeof(FskDragDropFileRecord), (FskMemPtr*)&droppedFile));
FskListAppend((FskList *)&dropFileList, droppedFile);
*end = 0;
BAIL_IF_ERR(KprURLToPath(string, &path));
BAIL_IF_ERR(FskFileGetFileInfo(path, &itemInfo));
if (itemInfo.filetype == kFskDirectoryItemIsDirectory) {
int length = FskStrLen(path);
BAIL_IF_ERR(FskMemPtrNew(length + 2, &droppedFile->fullPathName));
FskMemCopy(droppedFile->fullPathName, path, length);
droppedFile->fullPathName[length] = '/';
droppedFile->fullPathName[length + 1] = 0;
FskMemPtrDispose(path);
}
else {
droppedFile->fullPathName = path;
}
path = NULL;
string = end + 2;
*end = '\r';
}
(*gDropTargetProc)(kFskDragDropTargetEnterWindow, x, y, dropFileList, gtkWin->owner);
(*gDropTargetProc)(kFskDragDropTargetDropInWindow, x, y, dropFileList, gtkWin->owner);
dnd_success = TRUE;
}
bail:
gtk_drag_finish(context, dnd_success, TRUE, time);
FskMemPtrDispose(path);
while (NULL != dropFileList) {
droppedFile = dropFileList;
FskListRemove((FskList *)&dropFileList, droppedFile);
FskMemPtrDispose(droppedFile->fullPathName);
FskMemPtrDispose(droppedFile);
}
}
开发者ID:VzqzAc,项目名称:kinomajs,代码行数:46,代码来源:FskGtkWindow.c
示例20: 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
注:本文中的BAIL_IF_ERR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论