本文整理汇总了C++中SKIP函数的典型用法代码示例。如果您正苦于以下问题:C++ SKIP函数的具体用法?C++ SKIP怎么用?C++ SKIP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SKIP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: garmin_pack_d1004
static void
garmin_pack_d1004 ( D1004 * prof, uint8 ** pos )
{
int i;
int j;
for ( i = 0; i < 3; i++ ) {
for ( j = 0; j < 5; j++ ) {
PUTU8(prof->activities[i].heart_rate_zones[j].low_heart_rate);
PUTU8(prof->activities[i].heart_rate_zones[j].high_heart_rate);
SKIP(2);
}
for ( j = 0; j < 10; j++ ) {
PUTF32(prof->activities[i].speed_zones[j].low_speed);
PUTF32(prof->activities[i].speed_zones[j].high_speed);
PUTSTR(prof->activities[i].speed_zones[j].name);
}
PUTF32(prof->activities[i].gear_weight);
PUTU8(prof->activities[i].max_heart_rate);
SKIP(3);
}
PUTF32(prof->weight);
PUTU16(prof->birth_year);
PUTU8(prof->birth_month);
PUTU8(prof->birth_day);
PUTU8(prof->gender);
}
示例2: parseURL
int parseURL(ExHttp *pHttp)
{
/* we should treat URL carefully to prevent security issues. */
char *ePos = NULL;
char *pBuf = pHttp->curPos;
TRIM_HEAD(&pBuf);
pHttp->url = pBuf;
SKIP(&pBuf, ' ');
TRIMI_LB_TAIL(pBuf);
TRIM_HEAD(&pBuf);
pHttp->protocol = pBuf;
SKIP(&pBuf, '\n');
TRIMI_LB_TAIL(pBuf);
pHttp->curPos = pBuf;
pHttp->queryString = NULL;
if (*(pHttp->method) == 'G') {
/* if URL is empty, take index file as default */
if (*(pHttp->url) == '\0') {
pHttp->url = (char *) IndexFile;
}
else if ((ePos = strchr(pHttp->url, '?')) != NULL) {
*ePos = '\0';
pHttp->queryString = ++ePos;
pHttp->paramEndPos = find_lb_end(pHttp->protocol);
}
}
/* convert URL to UTF-8 encoding */
return url_decode(pHttp->url, pHttp->url, 0);
}
示例3: startBlock
virtual void startBlock(
const Block *b,
uint64_t
)
{
if(0<=cutoffBlock && cutoffBlock<b->height) wrapup();
uint8_t blockHash[kSHA256ByteSize];
sha256Twice(blockHash, b->data, 80);
const uint8_t *p = b->data;
SKIP(uint32_t, version, p);
SKIP(uint256_t, prevBlkHash, p);
SKIP(uint256_t, blkMerkleRoot, p);
LOAD(uint32_t, blkTime, p);
// id BIGINT PRIMARY KEY
// hash BINARY(32)
// time BIGINT
fprintf(blockFile, "%" PRIu64 "\t", (blkID = b->height-1));
writeEscapedBinaryBuffer(blockFile, blockHash, kSHA256ByteSize);
fputc('\t', blockFile);
fprintf(blockFile, "%" PRIu64 "\n", (uint64_t)blkTime);
if(0==(b->height)%500) {
fprintf(
stderr,
"block=%8" PRIu64 " "
"nbOutputs=%8" PRIu64 "\n",
b->height,
outputMap.size()
);
}
}
示例4: SKIP
const char *acl_split_nameval(char *buf, char **name, char **value)
{
char *np; /* name substring */
char *vp; /* value substring */
char *cp;
char *ep;
/*
* Ugly macros to make complex expressions less unreadable.
*/
#define SKIP(start, var, cond) \
for (var = start; *var && (cond); var++);
#define TRIM(s) { \
char *p; \
for (p = (s) + strlen(s); p > (s) && ACL_ISSPACE(p[-1]); p--); \
*p = 0; \
}
SKIP(buf, np, ACL_ISSPACE(*np)); /* find name begin */
if (*np == 0)
return ("missing attribute name");
SKIP(np, ep, !ACL_ISSPACE(*ep) && *ep != '='); /* find name end */
SKIP(ep, cp, ACL_ISSPACE(*cp)); /* skip blanks before '=' */
if (*cp != '=') /* need '=' */
return ("missing '=' after attribute name");
*ep = 0; /* terminate name */
cp++; /* skip over '=' */
SKIP(cp, vp, ACL_ISSPACE(*vp)); /* skip leading blanks */
TRIM(vp); /* trim trailing blanks */
*name = np;
*value = vp;
return (NULL);
}
示例5: mpeg4_util_parse_GOV
gboolean
mpeg4_util_parse_GOV (GstBuffer * buf, Mpeg4GroupofVideoObjectPlane * gov)
{
GstBitReader reader = GST_BIT_READER_INIT_FROM_BUFFER (buf);
guint8 gov_start_code;
/* start code prefix */
SKIP (&reader, 24);
READ_UINT8 (&reader, gov_start_code, 8);
if (gov_start_code != MPEG4_PACKET_GOV)
goto wrong_start_code;
READ_UINT8 (&reader, gov->hours, 5);
READ_UINT8 (&reader, gov->minutes, 6);
/* marker bit */
SKIP (&reader, 1);
READ_UINT8 (&reader, gov->seconds, 6);
READ_UINT8 (&reader, gov->closed, 1);
READ_UINT8 (&reader, gov->broken_link, 1);
return TRUE;
error:
GST_WARNING ("error parsing \"Group of Video Object Plane\"");
return FALSE;
wrong_start_code:
GST_WARNING ("got buffer with wrong start code");
goto error;
}
示例6: parseTX
static void parseTX(
const uint8_t *&p
)
{
uint8_t *txHash = 0;
const uint8_t *txStart = p;
if(gNeedTXHash && !skip) {
const uint8_t *txEnd = p;
parseTX<true>(txEnd);
txHash = allocHash256();
sha256Twice(txHash, txStart, txEnd - txStart);
}
if(!skip) startTX(p, txHash);
SKIP(uint32_t, version, p);
parseInputs<skip>(p, txHash);
if(gNeedTXHash && !skip)
gTXMap[txHash] = p;
parseOutputs<skip, false>(p, txHash);
SKIP(uint32_t, lockTime, p);
if(!skip) endTX(p);
}
示例7: SlimList_Deserialize
SlimList* SlimList_Deserialize(char* serializedList)
{
int listLength;
SlimList * list = 0;
char* current = 0;
if(serializedList == 0 || strlen(serializedList) == 0)
return 0;
current = serializedList;
list = SlimList_Create();
SKIP('[')
listLength = readLength(¤t);
SKIP(':')
while (listLength--)
{
int elementLength = readLength(¤t);
SKIP(':')
SlimList_AddBuffer(list, current, elementLength);
current += elementLength;
SKIP(':')
}
SKIP(']')
return list;
}
示例8: usage
static void
usage(void)
{
#define SKIP(s) /* nothing */
#define KEEP(s) s "\n"
static const char msg[] =
{
KEEP("")
KEEP("Options:")
SKIP(" -a arpanet (obsolete)")
KEEP(" -c set control characters")
SKIP(" -d dialup (obsolete)")
KEEP(" -e ch erase character")
KEEP(" -I no initialization strings")
KEEP(" -i ch interrupt character")
KEEP(" -k ch kill character")
KEEP(" -m mapping map identifier to type")
SKIP(" -p plugboard (obsolete)")
KEEP(" -Q do not output control key settings")
KEEP(" -q display term only, do no changes")
KEEP(" -r display term on stderr")
SKIP(" -S (obsolete)")
KEEP(" -s output TERM set command")
KEEP(" -V print curses-version")
KEEP(" -w set window-size")
KEEP("")
KEEP("If neither -c/-w are given, both are assumed.")
};
#undef KEEP
#undef SKIP
(void) fprintf(stderr, "Usage: %s [options] [terminal]\n", _nc_progname);
fputs(msg, stderr);
ExitProgram(EXIT_FAILURE);
/* NOTREACHED */
}
示例9: rc_read_mapfile
int rc_read_mapfile(char *filename)
{
char buffer[1024];
FILE *mapfd;
char *c, *name, *id, *q;
struct map2id_s *p;
int lnr = 0;
if ((mapfd = fopen(filename,"r")) == NULL)
{
error("rc_read_mapfile: can't read %s: %s", filename, strerror(errno));
return (-1);
}
#define SKIP(p) while(*p && isspace(*p)) p++;
while (fgets(buffer, sizeof(buffer), mapfd) != NULL)
{
lnr++;
q = buffer;
SKIP(q);
if ((*q == '\n') || (*q == '#') || (*q == '\0'))
continue;
if (( c = strchr(q, ' ')) || (c = strchr(q,'\t'))) {
*c = '\0'; c++;
SKIP(c);
name = q;
id = c;
if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) {
novm("rc_read_mapfile");
return (-1);
}
p->name = strdup(name);
p->id = atoi(id);
p->next = map2id_list;
map2id_list = p;
} else {
error("rc_read_mapfile: malformed line in %s, line %d", filename, lnr);
return (-1);
}
}
#undef SKIP
fclose(mapfd);
return 0;
}
示例10: f_mktime
bool TestExtDatetime::test_strftime() {
int ts = f_mktime(0, 0, 0, 8, 5, 1998);
f_setlocale(2, k_LC_TIME, "C");
VS(f_strftime("%A", ts), "Wednesday");
if (f_setlocale(2, k_LC_TIME, "fi_FI")) {
VS(f_strftime(" in Finnish is %A,", ts), " in Finnish is keskiviikko,");
} else {
SKIP("setlocale() failed");
}
if (f_setlocale(2, k_LC_TIME, "fr_FR")) {
VS(f_strftime(" in French %A and", ts), " in French mercredi and");
} else {
SKIP("setlocale() failed");
}
if (f_setlocale(2, k_LC_TIME, "de_DE")) {
VS(f_strftime(" in German %A.", ts), " in German Mittwoch.");
} else {
SKIP("setlocale() failed");
}
f_setlocale(2, k_LC_TIME, "C");
/*
December 2002 / January 2003
ISOWk M Tu W Thu F Sa Su
----- ----------------------------
51 16 17 18 19 20 21 22
52 23 24 25 26 27 28 29
1 30 31 1 2 3 4 5
2 6 7 8 9 10 11 12
3 13 14 15 16 17 18 19
*/
VS(f_strftime("%V,%G,%Y", f_strtotime("12/28/2002")), "52,2002,2002");
VS(f_strftime("%V,%G,%Y", f_strtotime("12/30/2002")), "01,2003,2002");
VS(f_strftime("%V,%G,%Y", f_strtotime("1/3/2003")), "01,2003,2003");
VS(f_strftime("%V,%G,%Y", f_strtotime("1/10/2003")), "02,2003,2003");
/*
December 2004 / January 2005
ISOWk M Tu W Thu F Sa Su
----- ----------------------------
51 13 14 15 16 17 18 19
52 20 21 22 23 24 25 26
53 27 28 29 30 31 1 2
1 3 4 5 6 7 8 9
2 10 11 12 13 14 15 16
*/
VS(f_strftime("%V,%G,%Y", f_strtotime("12/23/2004")), "52,2004,2004");
VS(f_strftime("%V,%G,%Y", f_strtotime("12/31/2004")), "53,2004,2004");
VS(f_strftime("%V,%G,%Y", f_strtotime("1/2/2005")), "53,2004,2005");
VS(f_strftime("%V,%G,%Y", f_strtotime("1/3/2005")), "01,2005,2005");
return Count(true);
}
示例11: printf
bool Scenario::read(bool save_triggers)
{
printf("[R] Reading scenario\n");
FILE *scx=fopen("scndata.hex", "rb");
if (scx==NULL)
return false; //must open scn before reading data
trigger_start = skiptotriggers("scndata.hex");
long bytes_read = 0;
SKIP(scx, trigger_start);
int numtriggers;
READ(&numtriggers, sizeof(long), 1, scx);
printf("\t[R] numtriggers=%d\n",numtriggers);
long trigger_skip=0;
bool displayed=0;
std::vector<Trigger *> scen_triggers;
for (int i=0; i<numtriggers; i++)
{
//printf("[R] TRIGGER %d\n", i);
Trigger *t = new Trigger;
t->read(scx);
scen_triggers.push_back(t);
//printf("[R] END TRIGGER %d. triggerskip=%d\n", i, ftell(scx)-bytes_read);
}
if (save_triggers)
triggers = scen_triggers;
printf("\t[R] Done reading triggers\n");
trigger_skip = ftell(scx) - bytes_read;
bytes_read+=trigger_skip;
//at the end is numtriggers longs representing order of triggers.
//skip them. they're just the display order, not execution order
SKIP(scx, 4*numtriggers);
trigger_end = bytes_read;
scenario_end = skiptoscenarioend("scndata.hex");
long filesize=fsize("scndata.hex");
printf("\t[R] trigger start=%d, trigger end=%d\n", trigger_start, trigger_end);
printf("\t[R] scenario_end=%d\n", scenario_end);
printf("\t[R] scndata.hex size: %d, size without triggers: %d\n", filesize, filesize-trigger_skip-4*numtriggers-4);
printf("\t[R] Read done\n");
fclose(scx);
return true;
}
示例12: test_protect_symlinks
static void
test_protect_symlinks(TestBatchRunner *runner) {
#ifdef ENABLE_SYMLINK_TESTS
FSFolder *folder = (FSFolder*)S_set_up();
String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
FSFolder_MkDir(folder, foo);
FSFolder_MkDir(folder, bar);
OutStream *outstream = FSFolder_Open_Out(folder, foo_boffo);
DECREF(outstream);
if (!S_create_test_symlinks()) {
FAIL(runner, "symlink creation failed");
FAIL(runner, "symlink creation failed");
FAIL(runner, "symlink creation failed");
FAIL(runner, "symlink creation failed");
FAIL(runner, "symlink creation failed");
// Try to clean up anyway.
FSFolder_Delete_Tree(folder, foo);
FSFolder_Delete_Tree(folder, bar);
}
else {
VArray *list = FSFolder_List_R(folder, NULL);
bool saw_bazooka_boffo = false;
for (uint32_t i = 0, max = VA_Get_Size(list); i < max; i++) {
String *entry = (String*)VA_Fetch(list, i);
if (Str_Ends_With_Utf8(entry, "bazooka/boffo", 13)) {
saw_bazooka_boffo = true;
}
}
TEST_FALSE(runner, saw_bazooka_boffo,
"List_R() shouldn't follow symlinks");
DECREF(list);
TEST_TRUE(runner, FSFolder_Delete_Tree(folder, bar),
"Delete_Tree() returns true");
TEST_FALSE(runner, FSFolder_Exists(folder, bar),
"Tree is really gone");
TEST_TRUE(runner, FSFolder_Exists(folder, foo),
"Original folder sill there");
TEST_TRUE(runner, FSFolder_Exists(folder, foo_boffo),
"Delete_Tree() did not follow directory symlink");
FSFolder_Delete_Tree(folder, foo);
}
DECREF(folder);
S_tear_down();
#else
SKIP(runner, "Tests requiring symlink() disabled");
SKIP(runner, "Tests requiring symlink() disabled");
SKIP(runner, "Tests requiring symlink() disabled");
SKIP(runner, "Tests requiring symlink() disabled");
SKIP(runner, "Tests requiring symlink() disabled");
#endif // ENABLE_SYMLINK_TESTS
}
示例13: garmin_pack_d1012
static void
garmin_pack_d1012 ( D1012 * point, uint8 ** pos )
{
PUTSTR(point->name);
SKIP(1);
PUTU16(point->course_index);
SKIP(2);
PUTU32(point->track_point_time);
PUTU8(point->point_type);
}
示例14: startBlock
virtual void startBlock(
const Block *b,
uint64_t chainSize
)
{
curBlock = b;
const uint8_t *p = b->data;
const uint8_t *sz = -4 + p;
LOAD(uint32_t, size, sz);
offset += size;
double now = usecs();
static double startTime = 0;
static double lastStatTime = 0;
double elapsed = now - lastStatTime;
bool longEnough = (5*1000*1000<elapsed);
bool closeEnough = ((chainSize - offset)<80);
if(unlikely(longEnough || closeEnough)) {
if(0==startTime) {
startTime = now;
}
double progress = offset/(double)chainSize;
double elasedSinceStart = 1e-6*(now - startTime);
double speed = progress / elasedSinceStart;
info(
"%8" PRIu64 " blocks, "
"%8.3f MegaAddrs , "
"%6.2f%% , "
"elapsed = %5.2fs , "
"eta = %5.2fs , "
,
curBlock->height,
addrMap.size()*1e-6,
100.0*progress,
elasedSinceStart,
(1.0/speed) - elasedSinceStart
);
lastStatTime = now;
}
SKIP(uint32_t, version, p);
SKIP(uint256_t, prevBlkHash, p);
SKIP(uint256_t, blkMerkleRoot, p);
LOAD(uint32_t, bTime, p);
blockTime = bTime;
if(0<=cutoffBlock && cutoffBlock<=curBlock->height) {
wrapup();
}
}
示例15: startBlock
virtual void startBlock(
const Block *b
)
{
const uint8_t *p = b->data;
SKIP(uint32_t, version, p);
SKIP(uint256_t, prevBlkHash, p);
SKIP(uint256_t, blkMerkleRoot, p);
LOAD(uint32_t, blkTime, p);
bTime = blkTime;
}