8 int strrep(char *buf, char *mae, char *ato)
11 size_t maelen, atolen;
15 if (maelen == 0 || (mituke = strstr(buf, mae)) == NULL) return 0;
16 memmove(mituke + atolen, mituke + maelen, strlen(buf) - (mituke + maelen - buf ) + 1);
17 memcpy(mituke, ato, atolen);
20 int getBit(unsigned char *byte, int *pbit, int gbit) {
21 int pbyte = *pbit / 8;
22 unsigned char *fbyte = byte + pbyte;
24 int cutbit = *pbit - (pbyte * 8);
25 int lcutbit = 32 - (cutbit + gbit);
27 unsigned char tbuf[4]; /* int¤ÎºÇÂç32bit */
30 memcpy(tbuf, fbyte, sizeof(unsigned char) * 4);
32 /* ÀèƬ¥Ð¥¤¥È¤«¤éÉÔÍ×bit¤ò¥«¥Ã¥È */
33 tbuf[0] = tbuf[0] << cutbit;
34 tbuf[0] = tbuf[0] >> cutbit;
37 tnum = tbuf[0] << 24 | tbuf[1] << 16 | tbuf[2] << 8 | tbuf[3];
39 /* ¸å¤í¤ÎÉÔÍץХ¤¥È¤ò¥«¥Ã¥È */
40 tnum = tnum >> lcutbit;
48 void getStr(char *tostr, unsigned char *byte, int *pbit, int len) {
50 int pbyte = *pbit / 8;
51 unsigned char *fbyte = byte + pbyte;
53 memset(str, 0, sizeof(char) * MAXSECLEN);
54 memcpy(str, fbyte, len);
58 AribToString(tostr, str, len);
64 int parseOTHERdesc(unsigned char *data) {
67 int descriptor_length;
69 descriptor_tag = getBit(data, &boff, 8);
70 descriptor_length = getBit(data, &boff, 8);
72 /* printf("other desc_tag:0x%x\n", descriptor_tag); */
74 return descriptor_length + 2;