这篇教程C++ ADVANCE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADVANCE函数的典型用法代码示例。如果您正苦于以下问题:C++ ADVANCE函数的具体用法?C++ ADVANCE怎么用?C++ ADVANCE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADVANCE函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: clear_one_cd_file/* Clear central directory data about a single file */static intclear_one_cd_file(unsigned char **p1, off_t *p2){ unsigned char *data; off_t size_left; struct cd_file h; size_t len; int is_zip64; data = *p1; size_left = *p2; memcpy(&h, data, sizeof(h)); memset(h.mtime, 0, sizeof(h.mtime)); memset(h.mdate, 0, sizeof(h.mdate)); memcpy(data, &h, sizeof(h)); ADVANCE(sizeof(h)); len = get_u16(h.name_length); ADVANCE(len); if (clear_file_extra(&data, &size_left, get_u16(h.extra_length), &is_zip64, NULL) != 0) return -1; len = get_u16(h.comment_length); ADVANCE(len); *p1 = data; *p2 = size_left; return 0;}
开发者ID:boyski,项目名称:Objcmp,代码行数:28,
示例2: next_pattstatic const char *next_patt(register const char *pattern, int advance){ wchar_t __nlh_char[1]; if (CHARAT(pattern) == '[') { int ch; const char *pp = pattern; ADVANCE(pp); if (CHARAT(pp) == '^') ADVANCE(pp); if (CHARAT(pp) == ']') ADVANCE(pp); char const *np; for (; (ch = next_char(pp, &np)) != '/0'; pp = np) if (ch == ']') return (advance ? np : pp); } next_char(pattern, &pattern); return pattern;}
开发者ID:idunham,项目名称:cdesktop,代码行数:26,
示例3: cmp_one_cd_file/* Compare central directory data about a single file */static intcmp_one_cd_file(const unsigned char **p1, const unsigned char **p2, off_t *p3){ const unsigned char *data1, *data2; off_t size_left; struct cd_file h1, h2; size_t len; enum result res; int is_zip64; data1 = *p1; data2 = *p2; size_left = *p3; memcpy(&h1, data1, sizeof(h1)); memcpy(&h2, data2, sizeof(h2)); ADVANCE(sizeof(h1)); memset(h1.mtime, 0, sizeof(h1.mtime)); memset(h2.mtime, 0, sizeof(h2.mtime)); memset(h1.mdate, 0, sizeof(h1.mdate)); memset(h2.mdate, 0, sizeof(h2.mdate)); if (memcmp(&h1, &h2, sizeof(h1)) != 0) return RES_DIFFERENT; len = get_u16(h1.name_length); COMPARE_AND_ADVANCE(len); res = cmp_file_extra(&data1, &data2, &size_left, get_u16(h1.extra_length), &is_zip64, NULL); if (res != RES_SAME) return res; len = get_u16(h1.comment_length); COMPARE_AND_ADVANCE(len); *p1 = data1; *p2 = data2; *p3 = size_left; return RES_SAME;}
开发者ID:boyski,项目名称:Objcmp,代码行数:36,
示例4: dbg_history_dumpvoid dbg_history_dump(char *key){ int cnt; char buf[80]; struct head *p; if(history_length) { fprintf(stderr, "***** %s:%u: history dump start/n", dbg_file_name, dbg_line_number); if(histp->addr) { cnt = history_length; p = histp; } else { cnt = histp - hist_base; p = hist_base; } while(cnt--) { snprintf(buf, 80, "(alloc: %s:%u size: %lu free: %s:%u)/n", p->file, p->line, (unsigned long)p->size, p->free.file, p->free.line); ADVANCE(p); if(strstr(buf, key)) fputs(buf, stderr); } fprintf(stderr, "***** %s:%u: history dump end/n", dbg_file_name, dbg_line_number); }}
开发者ID:BackupTheBerlios,项目名称:avinfo-svn,代码行数:28,
示例5: parse_next_atom/* NOTE: This functions record the fact that it has read to the end of * the buffer by setting the position to *beyond* the end of the * buffer. */static intparse_next_atom(struct simple_buffer *buffer, enum lsh_atom *result){ uint32_t i; assert (buffer->pos <=buffer->capacity); for(i = 0; i < LEFT; i++) { if (HERE[i] == ',') break; if (i == 64) /* Atoms can be no larger than 64 characters */ return 0; } /* NOTE: ssh-2.0.13, server string "SSH-1.99-2.0.13 * (non-commercial)", sends USERAUTH_FAILURE messages with strings * like "publickey,password,". It's not entirely clear to me if that * is allowed for the spec, but it seems safe and straightforward to * treat empty atoms as any other unknown atom. */ if (!i) { verbose("parse_next_atom: Received an empty atom./n"); /* Treat empty atoms as unknown */ *result = 0; } else *result = lookup_atom(i, HERE); ADVANCE(i+1); /* If the atom was terminated at the end of the * buffer, rather than by a comma, this points beyond * the end of the buffer */ return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:38,
示例6: parse_booleanintparse_boolean(struct simple_buffer *buffer, int *result){ if (!LEFT) return 0; *result = HERE[0]; ADVANCE(1); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:9,
示例7: parse_restvoidparse_rest(struct simple_buffer *buffer, uint32_t *length, const uint8_t **start){ *length = LEFT; *start = HERE; ADVANCE(*length);}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:9,
示例8: parse_octets/* NOTE: This is used in one single place: For copying the cookie in received KEYEXCHANGE_INIT messages. */intparse_octets(struct simple_buffer *buffer, uint32_t length, uint8_t *start){ if (LEFT < length) return 0; memcpy(start, HERE, length); ADVANCE(length); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:12,
示例9: parse_uint32intparse_uint32(struct simple_buffer *buffer, uint32_t *result){ if (LEFT < 4) return 0; *result = READ_UINT32(HERE); ADVANCE(4); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:10,
示例10: parse_uint16/* Used by client_x11.c, for parsing xauth */intparse_uint16(struct simple_buffer *buffer, uint32_t *result){ if (LEFT < 2) return 0; *result = READ_UINT16(HERE); ADVANCE(2); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:11,
示例11: parse_uint8intparse_uint8(struct simple_buffer *buffer, unsigned *result){ if (!LEFT) return 0; *result = HERE[0]; ADVANCE(1); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:10,
示例12: conf_print_rtmvoidconf_print_rtm(FILE *output, struct rt_msghdr *rtm, char *delim, int af){ int i; char *cp, flags[64]; struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL; struct sockaddr *sa; struct sockaddr_in sin; sin.sin_addr.s_addr = htonl(INADDR_BROADCAST); cp = ((char *)rtm + rtm->rtm_hdrlen); for (i = 1; i; i <<= 1) if (i & rtm->rtm_addrs) { sa = (struct sockaddr *)cp; switch (i) { case RTA_DST: /* allow arp to get printed with af==AF_LINK */ if ((sa->sa_family == af) || (af == AF_LINK && sa->sa_family == AF_INET)) { if (rtm->rtm_flags & RTF_REJECT) snprintf(flags, sizeof(flags), " reject"); else flags[0] = '/0'; dst = sa; } break; case RTA_GATEWAY: if (sa->sa_family == af) gate = sa; break; case RTA_NETMASK: /* netmasks will not have a valid sa_family */ mask = sa; break; } ADVANCE(cp, sa); } if (dst && gate && mask && (af == AF_INET || af == AF_INET6)) { /* * Suppress printing IPv4 route if it's the default * route and dhcp (dhclient) is enabled. */ if (!(af == AF_INET && isdefaultroute(dst, mask) && dhclient_isenabled(routename(gate)))) { fprintf(output, "%s%s ", delim, netname(dst, mask)); fprintf(output, "%s%s/n", routename(gate), flags); } } else if (dst && gate && (af == AF_LINK)) { /* print arp */ fprintf(output, "%s%s ", delim, routename(dst)); fprintf(output, "%s/n", routename(gate)); }}
开发者ID:gonzopancho,项目名称:nsh,代码行数:55,
示例13: kbintrstatic void __interrupt __far kbintr(){ unsigned char code; int key, press; code = inp(KB_PORT); if(code >= 128) { press = 0; code -= 128; if(num_pressed > 0) { num_pressed--; } } else { press = 1; num_pressed++; } key = scantbl[code]; if(press) { /* append to buffer */ last_key = key; if(buffer_size > 0) { buffer[buf_widx] = key; ADVANCE(buf_widx); /* if the write end overtook the read end, advance the read end * too, to discard the oldest keypress from the buffer */ if(buf_widx == buf_ridx) { ADVANCE(buf_ridx); } } } /* and update keystate table */ keystate[key] = press; outp(PIC1_CMD_PORT, OCW2_EOI); /* send end-of-interrupt */}
开发者ID:jtsiomb,项目名称:colcycle,代码行数:42,
示例14: parse_rest_copystruct lsh_string *parse_rest_copy(struct simple_buffer *buffer){ uint32_t length = LEFT; struct lsh_string *s = ssh_format("%ls", length, HERE); ADVANCE(length); assert(!LEFT); return s;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:11,
示例15: clear_file_extra/* Clear per-file extra data; Update compressed_size if it is not NULL, otherwise assume compressed_size is not present in the zip64 header. */static intclear_file_extra(unsigned char **p1, off_t *p2, size_t extra_len, int *is_zip64, unsigned long long *compressed_size){ unsigned char *data; off_t size_left; data = *p1; size_left = *p2; while (extra_len >= sizeof(struct extra_header)) { struct extra_header eh; size_t len; memcpy(&eh, data, sizeof(eh)); ADVANCE(sizeof(eh)); len = get_u16(eh.data_size); if (extra_len < sizeof(eh) + len) return -1; extra_len -= sizeof(eh) + len; if (memcmp(eh.id, eh_id_zip64, sizeof(eh_id_zip64)) == 0) { *is_zip64 = 1; if (compressed_size != NULL) *compressed_size = get_u64(data + 8); ADVANCE(len); } else if (memcmp(eh.id, eh_id_ext_timestamp, sizeof(eh_id_ext_timestamp)) == 0) { if (len < 1) return -1; ADVANCE(1); /* Time presence flags */ memset(data, 0, len - 1); /* mtime, atime, ctime - if present */ ADVANCE(len - 1); } else ADVANCE(len); } if (extra_len != 0) return -1; *p1 = data; *p2 = size_left; return 0;}
开发者ID:boyski,项目名称:Objcmp,代码行数:43,
示例16: rt_xaddrsstatic voidrt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo){ struct sockaddr *sa; int i; memset(rtinfo->rti_info, 0, sizeof(rtinfo->rti_info)); for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { if ((rtinfo->rti_addrs & (1 << i)) == 0) continue; rtinfo->rti_info[i] = sa = (struct sockaddr *)cp; ADVANCE(cp, sa); }}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:14,
示例17: xaddress/* * Extract addresses from the given buffer */voidxaddress(const int rti_addrs, char *cp, char *cplim, struct rt_addrinfo *rtinfo){ register struct sockaddr *sa; register int i; bzero((char *)rtinfo, sizeof(struct rt_addrinfo)); for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { if ((rti_addrs & (1 << i)) == 0) continue; rtinfo->rti_info[i] = sa = (struct sockaddr *)cp; ADVANCE(cp, sa); }}
开发者ID:MarginC,项目名称:kame,代码行数:17,
示例18: extractAddressesvoid extractAddresses(int iAddrMask, caddr_t cp, caddr_t cplim, struct sockaddr **pAddresses){ struct sockaddr *sa; for (int i = 0; i < RTAX_MAX && cp < cplim; i++) { if (!(iAddrMask & (1 << i))) continue; sa = (struct sockaddr *)cp; pAddresses[i] = sa; ADVANCE(cp, sa); }}
开发者ID:leopucci,项目名称:VirtualMonitor,代码行数:15,
示例19: kb_getkeyint kb_getkey(void){ int res; if(buffer) { if(buf_ridx == buf_widx) { return -1; } res = buffer[buf_ridx]; ADVANCE(buf_ridx); } else { res = last_key; last_key = -1; } return res;}
开发者ID:jtsiomb,项目名称:colcycle,代码行数:16,
示例20: parse_stringintparse_string(struct simple_buffer *buffer, uint32_t *length, const uint8_t **start){ uint32_t l; if (!parse_uint32(buffer, &l)) return 0; if (LEFT < l) return 0; *length = l; *start = HERE; ADVANCE(l); return 1;}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:17,
示例21: conf_print_rtmvoidconf_print_rtm(FILE *output, struct rt_msghdr *rtm, char *delim, int af){ int i; char *cp; struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL; struct sockaddr *sa; cp = ((char *)rtm + rtm->rtm_hdrlen); for (i = 1; i; i <<= 1) if (i & rtm->rtm_addrs) { sa = (struct sockaddr *)cp; switch (i) { case RTA_DST: /* allow arp to get printed with af==AF_LINK */ if ((sa->sa_family == af) || (af == AF_LINK && sa->sa_family == AF_INET)) dst = sa; break; case RTA_GATEWAY: if (sa->sa_family == af) gate = sa; break; case RTA_NETMASK: /* netmasks will not have a valid sa_family */ mask = sa; break; } ADVANCE(cp, sa); } if (dst && mask && gate && (af == AF_INET || af == AF_INET6)) { /* * suppress printing IP route if it's the default * v4 route and dhcp (dhclient) is enabled */ if (!(isdefaultroute4(dst) && dhclient_isenabled(routename(gate)))) { fprintf(output, "%s%s ", delim, netname(dst, mask)); fprintf(output, "%s/n", routename(gate)); } } else if (dst && gate && (af == AF_LINK)) /* print arp */ fprintf(output, "%s%s %s/n", delim, routename(dst), routename(gate));}
开发者ID:northshorenetworks,项目名称:NSWall,代码行数:45,
示例22: get_addrsstatic voidget_addrs(int type, char *cp, struct sockaddr **sa){ int i; for (i = 0; i < RTAX_MAX; i++) { if (type & (1 << i)) { sa[i] = (struct sockaddr *)cp;#ifdef DEBUG printf ("got %d %d %s/n", i, sa[i]->sa_family, inet_ntoa(((struct sockaddr_in *)sa[i])-> sin_addr));#endif ADVANCE(cp, sa[i]); } else sa[i] = NULL; }}
开发者ID:ACSOP,项目名称:android_external_dhcpcd,代码行数:18,
示例23: cmp_file_extra/* Compare per-file extra data; Update compressed_size if it is not NULL, otherwise assume compressed_size is not present in the zip64 header. */static enum resultcmp_file_extra(const unsigned char **p1, const unsigned char **p2, off_t *p3, size_t extra_len, int *is_zip64, unsigned long long *compressed_size){ const unsigned char *data1, *data2; off_t size_left; data1 = *p1; data2 = *p2; size_left = *p3; while (extra_len >= sizeof(struct extra_header)) { struct extra_header eh; size_t len; memcpy(&eh, data1, sizeof(eh)); COMPARE_AND_ADVANCE(sizeof(eh)); len = get_u16(eh.data_size); if (extra_len < sizeof(eh) + len) return RES_UNKNOWN; extra_len -= sizeof(eh) + len; if (memcmp(eh.id, eh_id_zip64, sizeof(eh_id_zip64)) == 0) { *is_zip64 = 1; if (compressed_size != NULL) *compressed_size = get_u64(data1 + 8); COMPARE_AND_ADVANCE(len); } else if (memcmp(eh.id, eh_id_ext_timestamp, sizeof(eh_id_ext_timestamp)) == 0) { if (len < 1) return RES_UNKNOWN; COMPARE_AND_ADVANCE(1); /* Time presence flags */ ADVANCE(len - 1); /* mtime, atime, ctime - if present */ } else COMPARE_AND_ADVANCE(len); } if (extra_len != 0) return RES_UNKNOWN; *p1 = data1; *p2 = data2; *p3 = size_left; return RES_SAME;}
开发者ID:boyski,项目名称:Objcmp,代码行数:45,
注:本文中的ADVANCE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ADVANCE_BATCH函数代码示例 C++ ADS_ERR_OK函数代码示例 |