本文整理汇总了C++中FskStrDoCopy函数的典型用法代码示例。如果您正苦于以下问题:C++ FskStrDoCopy函数的具体用法?C++ FskStrDoCopy怎么用?C++ FskStrDoCopy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FskStrDoCopy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KplVolumeGetInfo
FskErr KplVolumeGetInfo(UInt32 volumeID, char **pathOut, char **nameOut, UInt32 *volumeType, Boolean *isRemovable, KplInt64 *capacity, KplInt64 *freeSpace)
{
volInfoRec *vi;
FskErr err = kFskErrOperationFailed;
if (!volumeList)
scanVolumes();
vi = volumeList;
while (vi) {
if (volumeID == (UInt32)vi) {
if (pathOut)
*pathOut = FskStrDoCopy(vi->mountPoint);
if (nameOut)
*nameOut = FskStrDoCopy(vi->name);
if (volumeType)
*volumeType = vi->type;
if (isRemovable)
*isRemovable = vi->removable;
if (capacity)
*capacity = vi->capacity;
if (freeSpace)
*freeSpace = vi->remaining;
err = kFskErrNone;
break;
}
vi = vi->next;
}
return err;
}
示例2: FskFSVolumeIteratorGetNext
// ---------------------------------------------------------------------
FskErr FskFSVolumeIteratorGetNext(FskFSVolumeIterator volIt, UInt32 *id, char **path, char **name)
{
FskErr ret = kFskErrIteratorComplete;
if (volIt) {
pMount theMount = gMounts;
while (theMount) {
if (theMount->fsID >= volIt->iter) {
break;
}
theMount = theMount->next;
}
if (!theMount) {
return ret;
}
if (id)
*id = theMount->fsID;
if (path) *path = FskStrDoCopy(theMount->mountPoint);
if (name) *name = FskStrDoCopy(theMount->name);
FskAndroidFilesPrintfDebug("VolIterGetNext iter: %d - path: %s\n", theMount->fsID, theMount->mountPoint);
volIt->iter = theMount->fsID + 1;
ret = kFskErrNone;
}
return ret;
}
示例3: KprZeroconfServiceInfoNew
FskErr KprZeroconfServiceInfoNew(KprZeroconfServiceInfo *it, const char* type, const char* name, const char* host, const char* ip, UInt32 port, const UInt32 interfaceIndex, char* txt)
{
FskErr err = kFskErrNone;
KprZeroconfServiceInfo self = NULL;
bailIfError(FskMemPtrNewClear(sizeof(KprZeroconfServiceInfoRecord), it));
self = *it;
self->type = FskStrDoCopy(type);
bailIfNULL(self->type);
self->name = FskStrDoCopy(name);
bailIfNULL(self->name);
if (host) {
self->host = FskStrDoCopy(host);
bailIfNULL(self->host);
}
if (ip) {
self->ip = FskStrDoCopy(ip);
bailIfNULL(self->ip);
}
self->port = port;
self->interfaceIndex = interfaceIndex;
if (txt) {
self->txt = FskStrDoCopy(txt);
bailIfNULL(self->txt);
}
FskInstrumentedItemNew(self, NULL, &KprZeroconfServiceInfoInstrumentation);
bail:
if (err)
KprZeroconfServiceInfoDispose(self);
return err;
}
示例4: Library_cacheQuery
void Library_cacheQuery(xsMachine* the)
{
KprLibraryServer self = gLibraryServer;
UInt32 index;
KprLibraryQuery query;
FskMutexAcquire(self->queryMutex);
index = self->queryIndex % kQueryCount;
query = self->queries[index];
if (query) {
KprLibraryQueryDispose(query);
self->queries[index] = NULL;
}
KprLibraryQueryNew(&query);
FskInstrumentedItemSetOwner(query, self);
xsEnterSandbox();
query->index = self->queryIndex;
query->info = FskStrDoCopy(xsToString(xsGet(xsArg(0), xsID("info"))));
query->kind = xsToInteger(xsGet(xsArg(0), xsID("kind")));
query->mime = FskStrDoCopy(xsToString(xsGet(xsArg(0), xsID("mime"))));
query->url = FskStrDoCopy(xsToString(xsGet(xsArg(0), xsID("url"))));
xsResult = xsGet(xsArg(0), xsID("authorization"));
if (xsTest(xsResult))
query->authorization = FskStrDoCopy(xsToString(xsResult));
xsLeaveSandbox();
self->queries[index] = query;
xsResult = xsInteger(self->queryIndex);
self->queryIndex++;
FskMutexRelease(self->queryMutex);
}
示例5: KPR_debug_file
void KPR_debug_file(xsMachine *the)
{
KprDebug self = xsGetHostData(xsThis);
KprDebugMachine machine = NULL;
int command = mxNoCommand;
char* path = NULL;
char* value = NULL;
xsIntegerValue line = -1;
xsIntegerValue c = xsToInteger(xsArgc);
xsVars(4);
if ((c >= 2) && (xsTypeOf(xsArg(0)) == xsStringType) && (xsTypeOf(xsArg(1)) == xsIntegerType)) {
char* address = xsToString(xsArg(0));
command = xsToInteger(xsArg(1));
machine = KprDebugFindMachine(self, address);
}
if ((c >= 4) && (xsTypeOf(xsArg(2)) == xsStringType) && (xsTypeOf(xsArg(3)) == xsIntegerType)) {
path = FskStrDoCopy(xsToString(xsArg(2)));
line = xsToInteger(xsArg(3));
}
if ((c >= 5) && (xsTypeOf(xsArg(4)) == xsStringType)) {
value = FskStrDoCopy(xsToString(xsArg(4)));
}
if (machine && ((command == mxFramesView) || (command == mxFilesView) || (command == mxLogView) || (command == mxBreakpointsView))) {
xsEnterSandbox();
KprDebugMachineDispatchCommand(machine, command, path, value, line);
xsLeaveSandbox();
}
else
xsThrowIfFskErr(kFskErrInvalidParameter);
FskMemPtrDispose(value);
FskMemPtrDispose(path);
}
示例6: KprWebSocketEndpointConnect
FskErr KprWebSocketEndpointConnect(KprWebSocketEndpoint self, char *url, char *origin)
{
FskErr err = kFskErrNone;
self->url = FskStrDoCopy(url);
bailIfNULL(self->url);
bailIfError(FskStrParseUrl(self->url, &self->parts));
if (!KprWebSocketEndpointCheckURL(self)) {
bailIfError(kFskErrInvalidParameter);
}
self->isSecure = (FskStrCompare(self->parts->scheme, "wss") == 0);
if (origin) {
self->origin = FskStrDoCopy(origin);
bailIfNULL(self->origin);
}
self->state = kKprWebSocketStateConnecting;
INVOKE_AFTER1(KprWebSocketEndpointStartConnect, self);
bail:
return err;
}
示例7: KprDBStatementNew
FskErr KprDBStatementNew(KprDBStatement* it, KprDB db, const char* text, char* bindFormat, char* rowFormat)
{
FskErr err = kFskErrNone;
KprDBStatement self = NULL;
SInt32 count, size, i;
bailIfError(KprMemPtrNewClear(sizeof(KprDBStatementRecord), it));
self = *it;
FskInstrumentedItemNew(self, NULL, &KprDBStatementInstrumentation);
bailIfError(sqlite3_prepare_v2(db->data, text, FskStrLen(text), &self->data, NULL));
count = sqlite3_bind_parameter_count(self->data);
if (count && !bindFormat) BAIL(kFskErrInvalidParameter);
if (!count && bindFormat) BAIL(kFskErrInvalidParameter);
if (count) {
if ((SInt32)FskStrLen(bindFormat) != count) BAIL(kFskErrInvalidParameter);
self->bindFormat = FskStrDoCopy(bindFormat);
bailIfNULL(self->bindFormat);
}
count = sqlite3_column_count(self->data);
if (count && !rowFormat) BAIL(kFskErrInvalidParameter);
if (!count && rowFormat) BAIL(kFskErrInvalidParameter);
if (count) {
if ((SInt32)FskStrLen(rowFormat) != count) BAIL(kFskErrInvalidParameter);
self->rowFormat = FskStrDoCopy(rowFormat);
bailIfNULL(self->rowFormat);
bailIfError(KprMemPtrNewClear(count * sizeof(char*), &self->keys));
for (size = 0, i = 0; rowFormat[i]; i++) {
self->keys[i] = sqlite3_column_name(self->data, i);
switch (rowFormat[i]) {
case 'b':
size += sizeof(void*) + sizeof(UInt32);
break;
case 'd':
size += sizeof(double);
break;
case 'i':
size += sizeof(SInt32);
break;
case 'I':
size += sizeof(FskInt64);
break;
case 'r':
size += sizeof(SInt32);
break;
case 't':
size += sizeof(char*);
break;
default:
BAIL(kFskErrInvalidParameter);
break;
}
}
bailIfError(KprMemPtrNewClear(size, &self->values));
}
bail:
if (err)
KprDBStatementDispose(self);
return err;
}
示例8: FskFSVolumeGetInfo
FskErr FskFSVolumeGetInfo(UInt32 volumeID, char **pathOut, char **nameOut, UInt32 *volumeType, Boolean *isRemovable, FskInt64 *capacity, FskInt64 *freeSpace)
{
FskInt64 calc, more;
pMount theMount;
FskErr err = kFskErrOperationFailed;
struct statfs volStat;
if (!gMounts)
scanVolumes();
theMount = gMounts;
FskAndroidFilesPrintfDebug("FSVolumeGetInfo for id %d\n", volumeID);
if (capacity)
*capacity = 0;
if (freeSpace)
*freeSpace = 0;
while (theMount) {
if (theMount->fsID == (SInt32)volumeID) {
break;
}
theMount = theMount->next;
}
if (theMount) {
if (pathOut) *pathOut = FskStrDoCopy(theMount->mountPoint);
if (nameOut) *nameOut = FskStrDoCopy(theMount->name);
if (volumeType) *volumeType = theMount->type;
if (isRemovable) *isRemovable = theMount->removable;
FskAndroidFilesPrintfDebug("getInfo returns - path: %s, name: %s, ", theMount->mountPoint, theMount->name);
statfs(theMount->mountPoint, &volStat);
if (capacity) {
calc = volStat.f_bsize;
more = volStat.f_blocks;
calc = calc * more;
*capacity = calc;
FskAndroidFilesPrintfDebug("capacity %d,", calc);
}
if (freeSpace) {
calc = volStat.f_bsize;
more = volStat.f_bavail;
calc = calc * more;
*freeSpace = calc;
FskAndroidFilesPrintfDebug("freeSpace %d", calc);
}
err = kFskErrNone;
}
else {
FskAndroidFilesPrintfDebug("getInfo fails\n");
}
return err;
}
示例9: mp3ReaderSniff
FskErr mp3ReaderSniff(const unsigned char *data, UInt32 dataSize, FskHeaders *headers, const char *uri, char **mime)
{
UInt32 i;
// check data for ID3 tag (as per section 3.1 of id3 spec)
if (dataSize >= 10) {
if (('I' == data[0]) & ('D' == data[1]) & ('3' == data[2])) {
if ((data[3] != 0xff) && (data[4] != 0xff)) {
if (0 == (data[5] & 0x1f)) {
if ((data[6] < 0x80) && (data[7] < 0x80) && (data[8] < 0x80) && (data[9] < 0x80)) {
*mime = FskStrDoCopy("audio/mpeg"); // could also be AAC depending on codec tag or actual bitstream. but this is enough to get it routed to this media player.
return kFskErrNone;
}
}
}
}
}
for (i = 0; (i < 2) && (dataSize >= 10); i++) {
const unsigned char *d = data, *e = data + dataSize - 7; // - 7 to account for the max header size of mp3 & aac/adts
UInt32 ds = dataSize;
Boolean (*doHeaderParse)(unsigned char *scan, DIDLMusicItem mi);
doHeaderParse = (0 == i) ? parseMP3Header : parseADTSHeader;
while (d < e) {
DIDLMusicItemRecord mi0, mi1, mi2;
mi0.doExtendedParsing = 0;
mi1.doExtendedParsing = 0;
mi2.doExtendedParsing = 0;
if (true == (doHeaderParse)((unsigned char *)d, &mi0)) {
if ((d + mi0.frameLength + 7) < e) {
if (true == (doHeaderParse)((unsigned char *)(d + mi0.frameLength), &mi1)) {
if ((d + mi0.frameLength + mi1.frameLength + 7) < e) {
if (true == (doHeaderParse)((unsigned char *)(d + mi0.frameLength + mi1.frameLength), &mi2)) {
if ((mi0.frequency == mi1.frequency) && (mi0.channelCount == mi1.channelCount) &&
(mi0.frequency == mi2.frequency) && (mi0.channelCount == mi2.channelCount)) {
*mime = FskStrDoCopy((0 == i) ? "audio/mpeg" : "audio/vnd.dlna.adts");
return kFskErrNone;
}
}
}
}
}
}
d += 1;
ds -= 1;
}
}
return kFskErrUnknownElement;
}
示例10: KplVolumeGetDeviceInfo
FskErr KplVolumeGetDeviceInfo(UInt32 volumeID, char **vendor, char **product, char **revision, char **vendorSpecific) {
if (vendor)
*vendor = FskStrDoCopy("vendor");
if (product)
*product = FskStrDoCopy("product");
if (revision)
*revision = FskStrDoCopy("1.0");
if (vendorSpecific)
*vendorSpecific = FskStrDoCopy("vendorSpecific");
return kFskErrNone;
}
示例11: KprMessageSetCredentials
FskErr KprMessageSetCredentials(KprMessage self, char* user, char* password)
{
FskErr err = kFskErrNone;
FskMemPtrDisposeAt(&self->user);
FskMemPtrDisposeAt(&self->password);
if (user && password) {
self->user = FskStrDoCopy(user);
bailIfNULL(self->user);
self->password = FskStrDoCopy(password);
bailIfNULL(self->password);
}
bail:
return err;
}
示例12: FskFSVolumeGetInfo
FskErr FskFSVolumeGetInfo(UInt32 volumeID, char **pathOut, char **nameOut, UInt32 *volumeType, Boolean *isRemovable, FskInt64 *capacity, FskInt64 *freeSpace)
{
FskErr err = kFskErrNone;
struct statfs *fs;
if (volumeID >= (UInt32)gNumStatFS)
return kFskErrInvalidParameter;
fs = &gStatFS[volumeID];
if (pathOut)
*pathOut = FskStrDoCopy(fs->f_mntonname);
if (nameOut)
*nameOut = FskStrDoCopy(FskCocoaDisplayNameAtPath(fs->f_mntonname));
if (capacity)
*capacity = fs->f_blocks * fs->f_bsize;
if (freeSpace)
*freeSpace = fs->f_bavail * fs->f_bsize;
if (isRemovable)
*isRemovable = FskCocoaIsRemovable(fs->f_mntonname);
if (volumeType) {
*volumeType = kFskVolumeTypeUnknown;
if (!(fs->f_flags & MNT_LOCAL))
*volumeType = kFskVolumeTypeNetwork;
else if (FskStrCompare(fs->f_fstypename, "hfs") == 0 || FskStrCompare(fs->f_fstypename, "ufs") == 0)
*volumeType = kFskVolumeTypeFixed;
else if (FskStrCompare(fs->f_fstypename, "devfs") == 0)
*volumeType = kFskVolumeTypeUnknown;
else {
char *product;
if ((err = FskFSVolumeGetDeviceInfo(volumeID, NULL, &product, NULL, NULL)) != kFskErrNone)
return err;
if (product == NULL)
*volumeType = kFskVolumeTypeUnknown;
else if (FskStrStr(product, "MS") || FskStrStr(product, "WM-MS"))
*volumeType = kFskVolumeTypeMemoryStick;
else if (FskStrStr(product, "MMC"))
*volumeType = kFskVolumeTypeMMC;
else if (FskStrStr(product, "CF"))
*volumeType = kFskVolumeTypeCompactFlash;
else if (FskStrStr(product, "SM"))
*volumeType = kFskVolumeTypeSmartMedia;
else if (FskStrStr(product, "SD"))
*volumeType = kFskVolumeTypeSDMemory;
else
*volumeType = kFskVolumeTypeUnknown;
}
}
return err;
}
示例13: KPR_Message_cancelReferrer
void KPR_Message_cancelReferrer(xsMachine* the)
{
char* url = FskStrDoCopy(xsToString(xsArg(0)));
xsThrowIfNULL(url);
KprMessageCancelReferrer(url);
FskMemPtrDispose(url);
}
示例14: KprWebSocketEndpointClose
FskErr KprWebSocketEndpointClose(KprWebSocketEndpoint self, UInt16 code, char *reason)
{
FskErr err = kFskErrNone;
FskDebugStr("CLOSE: (%d), %s\n", code, reason);
self->closeCode = code;
if (reason) {
FskMemPtrDispose(self->closeReason);
self->closeReason = FskStrDoCopy(reason);
}
switch (self->state) {
case kKprWebSocketStateConnecting:
bailIfError(KprWebSocketEndpointCancelConnection(self));
break;
case kKprWebSocketStateOpen:
bailIfError(KprWebSocketEndpointStartClosingHandshake(self, code, reason));
break;
case kKprWebSocketStateClosing:
case kKprWebSocketStateClosed:
default:
break;
}
bail:
return err;
}
示例15: KprSocketConnect
FskErr KprSocketConnect(KprSocket self, const char *host, int port)
{
FskErr err = kFskErrNone;
long flags = 0;
if (self->mode != kKprSocketModeUndefined) return kFskErrBadState;
self->host = FskStrDoCopy(host);
bailIfNULL(self->host);
self->port = port;
self->mode = kKprSocketModeTCP;
if (self->secure) {
FskSSLOption ssl;
flags |= kConnectFlagsSSLConnection;
FskNetSSLOptionInitialize(self->host, self->port, flags, kFskNetSocketDefaultPriority, &ssl);
ssl.protocolVersion = self->tlsProtocolVersion;
ssl.applicationProtocols = self->applicationProtocols;
bailIfError(FskNetConnectToSecureHost(&ssl, self->certs, KprSocketOnConnect, self));
} else {
bailIfError(FskNetConnectToHost((char *) self->host, self->port, false, KprSocketOnConnect, self, flags, NULL, "KprSocketTCP"));
}
bail:
if (err) {
KprSocketCleanup(self);
}
return err;
}