/* return pointer to string after the authority, filling in pointers * to start of user, password, host, and port, if provided; input: * result of skip_scheme() */ static const char * skip_authority(const char *uri, const char **userp, const char **passp, const char **hostp, const char **portp) { const char *user = NULL, *pass = NULL, *host = NULL, *port = NULL; if (uri[0] == '/' && uri[1] == '/') { uri += 2; user = host = uri; while (isunreserved(*uri) || (*uri == '%' && ishex(uri[1]) && ishex(uri[2])) || *uri == ';' || *uri == ':' || *uri == '=' || *uri == '+'|| *uri == '$' || *uri == ',' || *uri == '@') { if (*uri == ':') { if (user == host) port = pass = uri + 1; else port = uri + 1; } else if (*uri == '@') host = uri + 1; uri += *uri == '%' ? 3 : 1; } if (user == host) { /* no "@", so no user info */ if (userp) *userp = NULL; if (passp) *passp = NULL; } else { if (*userp) *userp = user; if (*passp) *passp = pass; } if (portp) *portp = port; if (hostp) *hostp = host; return uri; } return NULL; }
static void name_rev_line(char *p, struct name_ref_data *data) { int forty = 0; char *p_start; for (p_start = p; *p; p++) { #define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f')) if (!ishex(*p)) forty = 0; else if (++forty == 40 && !ishex(*(p+1))) { unsigned char sha1[40]; const char *name = NULL; char c = *(p+1); int p_len = p - p_start + 1; forty = 0; *(p+1) = 0; if (!get_sha1(p - 39, sha1)) { struct object *o = lookup_object(sha1); if (o) name = get_rev_name(o); } *(p+1) = c; if (!name) continue; if (data->name_only) printf("%.*s%s", p_len - 40, p_start, name); else printf("%.*s (%s)", p_len, p_start, name); p_start = p + 1; } } /* flush */ if (p_start != p) fwrite(p_start, p - p_start, 1, stdout); }
int checkline(char s[]) { int i; for(i=0;i<MAXNUM;i++) { if(ishex(s[i])==0) { return -1; } } return 1; }
static void process_key (char *s, char *key) { char string[257]; int i; int j; int shift = 1; int value = 0; int hex_count = 0; int nonhex_count = 0; int white_count = 0; /* zero string */ for (i=0; i<256; i++) string[i] = '\0'; /* check if a hex number or ascii string was entered */ for (i = 0; (i < 256) && *s; i++) { string[i] = *s++; if (ishex (string[i])) hex_count++; else if (string[i] == ' ') white_count++; else nonhex_count++; } string[i] = '\0'; /* either convert hex number or process ascii string */ if (hex_count == 32 && nonhex_count == 0) { hex_count = 0; for (i = 0; string[i] != '\0'; i++) { if ((value = hextoint (string[i])) != -1) { if (shift) { key[hex_count >> 1] = (unsigned char) value << 4; hex_count++; shift = 0; } else { key[hex_count >> 1] += (unsigned char) value; hex_count++; shift = 1; } } string[i] = '\0'; }
static uint32_t str2val(char *str) { int i; int value; int base = ishex(str) ? 16 : 10; if (str == NULL) return(0); for (i=0,value=0; str[i]; i++) { value = (value*base) + char2num(str[i]); } return(value); }
static int valid(char *ciphertext, struct fmt_main *self) { char *ptr, *ctcopy, *keeptr; size_t len; if (strncmp(ciphertext, FORMAT_TAG, sizeof(FORMAT_TAG) - 1)) return 0; if (strlen(ciphertext) > MAX_CIPHERTEXT_LENGTH) return 0; ciphertext += sizeof(FORMAT_TAG) - 1; if (!(ctcopy = strdup(ciphertext))) return 0; keeptr = ctcopy; if (!(ptr = strtokm(ctcopy, "."))) goto error; if (strlen(ptr) >= 10) goto error; if (!isdecu(ptr)) goto error; if (!(ptr = strtokm(NULL, "."))) goto error; len = strlen(ptr); // salt length if (len > 2 * MAX_SALT_SIZE || len & 1) goto error; if (!ishex(ptr)) goto error; if (!(ptr = strtokm(NULL, "."))) goto error; len = strlen(ptr); // binary length if (len < BINARY_SIZE || len > MAX_BINARY_SIZE || len & 1) goto error; if (!ishex(ptr)) goto error; MEM_FREE(keeptr); return 1; error: MEM_FREE(keeptr); return 0; }
void Check_TapeAlert(int argc, char **argv) { if (argc > 3) { if (!ishex(argv[3])) { fprintf(stderr, "Value not hexadecimal: %s\n", argv[3]); exit(1); } if (argc == 4) return; PrintErrorExit(argv[0], "TapeAlert"); } PrintErrorExit(argv[0], "TapeAlert"); }
void free_command(char* params) { char option[20]; bool leave = false; unsigned int address = 0; unsigned int i = 0; unsigned int len = 0; void* result = 0; len = strlen_custom(params); memset_custom(option, sizeof(option), 0); sscanf_custom(params, "%s", option); if( strcmp(option, "info") == 0 ) { newline(); set_col(2); vprintf_custom("Usa el comando \'free\' seguido de una direccion" " de memoria en base hexadecimal (es decir el numero precedido" " por 0x o 0X), para liberar la porcion de memoria que empieza" " en ese lugar."); } else { for(i = 0; i < len; i++) { if( ishex(option[i] == false) ) { leave = true; break; } } //compruebo que el numero esté en hexa if( leave == false && option[0] == '0' && (option[1] == 'x' || option[1] == 'X')) { sscanf_custom(option, "%x", &address); result = (void*)free((unsigned int*)address); if( result == (void*)address && (unsigned int)result > 0xF) { newline(); set_col(2); vprintf_custom("La memoria con direccion %x fue liberada.", address); } else { newline(); set_col(2); vprintf_custom("No existe ningun segmento de memoria alocado" "en esa direccion."); } } else { newline(); set_col(2); vprintf_custom("Debes ingresar un direccion de memoria en " "hexa para liberar esa porcion de memoria."); } } }
static int valid(char *ciphertext, struct fmt_main *self) { char *p; p = ciphertext; if (!strncmp(p, FORMAT_TAG, TAG_LENGTH)) p += TAG_LENGTH; if (strlen(p) != CIPHERTEXT_LENGTH) return 0; if (!ishex(p)) return 0; return 1; }
int htoi(char s[]) { int answer; int i=0; if(checkline(s) != 1 ) { return (-1); } for(answer=0;ishex(s[i])/*isxdigit(s[i])*/;i++) { if(isdigit(s[i])){answer = 16 * answer + (s[i]-'0');} if(isupper(s[i])){answer = 16 * answer + (s[i]-'A') + 10;} if(islower(s[i])){answer = 16 * answer + (s[i]-'a') + 10;} } return answer; }
static int read_ahxd(fz_stream *stm, unsigned char *buf, int len) { fz_ahxd *state = stm->state; unsigned char *p = buf; unsigned char *ep = buf + len; int a, b, c, odd; odd = 0; while (p < ep) { if (state->eod) return p - buf; c = fz_read_byte(state->chain); if (c < 0) return p - buf; if (ishex(c)) { if (!odd) { a = unhex(c); odd = 1; } else { b = unhex(c); *p++ = (a << 4) | b; odd = 0; } } else if (c == '>') { if (odd) *p++ = (a << 4); state->eod = 1; } else if (!iswhite(c)) { fz_throw(stm->ctx, "bad data in ahxd: '%c'", c); } } return p - buf; }
// Reads a hexadecimal number from str int getNumber(unsigned int* number, const char** str) { // char buffer[5]; if (sscanf(*str, "%X", number) == EOF || *number > 0xFFFF) { return 0; } // Older, inferior version which doesn't work with leading zeros // sprintf(buffer, "%X", *number); // *str += strlen(buffer); while (ishex(**str)) (*str)++; scan(str); return 1; }
int l_findsig(lua_State* L) { std::string sig; boost::optional<unsigned int> occurance; std::tie(sig, occurance) = phlua::callback::getArguments<std::string, decltype(occurance)>(L, __FUNCTION__); if (!occurance) occurance = 0; if (sig.length() == 0) { luaL_argerror(L, 1, "empty signature"); } for (auto c : sig) { if (c != '?' && !ishex(c)) luaL_argerror(L, 1, "signature can only contain hexadecimal or ? characters"); } // If only part of a byte is specified, treat the next as a wildcard if (sig.length() % 2) { sig.append("?"); } // Basic caching because sig searching is really slow... unsigned int mem; char occuranceStr[9]; static const std::string occ_key_header = "occ:"; sprintf_s(occuranceStr, sizeof(occuranceStr), "%08x", *occurance); std::string map_key = sig + occ_key_header + occuranceStr; auto itr = sigMap.find(map_key); if (itr != sigMap.end()) mem = itr->second; else { mem = (unsigned int)sigscan(sig, *occurance); sigMap.insert(std::make_pair(map_key, mem)); } if (mem) { return phlua::callback::pushReturns(L, std::make_tuple(mem)); } else { return phlua::callback::pushReturns(L, std::make_tuple(lua::types::Nil())); } }
int htoi(QVariant lv){ QByteArray ls=lv.toByteArray(); //skip int ln=ls.size(); int lh=0; if (ln>0) { int li=0; byte lb; while (li<ln) { lb=ishex(ls[li++]); if (lb!=255) { lh<<=4; lh+=lb; } } } return lh; }
static GEN int_read(const char **s) { int nb; GEN y; if (isbin(s)) { y = utoi(binnumber(&nb, s)); if (nb == MAX_BDIGITS) y = bin_read_more(y, s); } else if (ishex(s)) { y = utoi(hexnumber(&nb, s)); if (nb == MAX_XDIGITS) y = hex_read_more(y, s); } else { y = int_read_dec(s); } return y; }
/** decode urlencoded URL into ascii characters * if dest is NULL, return malloc()'d string. needs to be free()'d * if src_len is negative treat src as null terminated * return: * 0 on error (overflow of dest, allocation failure) * dest or allocated pointer on success */ char *uri_unescape(char *dest, size_t dest_len, const char *src, int src_len) { assert(src!=NULL); char *ret; int ret_is_allocated; assert(src!=NULL); if(src_len<0) { src_len=strlen((const char *)src); } ret_is_allocated=!dest; if(ret_is_allocated) { dest_len=src_len+1; /* TODO: calculate the exact needed size? */ dest=(char*)malloc(dest_len); if(!dest) { return 0; /* allocation failure */ } } ret=dest; for(;dest_len>1 && src_len>0;dest_len--,dest++) { if(*src=='%' && src_len>=3 && ishex(src+1)) { *dest=(char)unhex(src+1); src+=3; src_len-=3; } else if(*src=='+') { *dest=' '; src++; src_len--; } else { *dest=*(src++); src_len--; } } /* check for errors - src was not fully consumed */ if(src_len!=0) { if(ret_is_allocated) { free(ret); } return 0; } assert(dest_len>=1); *dest=0; return ret; }
/* *INDENT-ON* */ /* process the escape characters in a string, in place . */ char * rm_escape(char *s, size_t *lenp) { register char *p, *q; char *t; int i; q = p = s; while (*p) { if (*p == '\\') { escape_test[ET_END].in = *++p; /* sentinal */ i = 0; while (escape_test[i].in != *p) i++; if (i != ET_END) /* in table */ { p++; *q++ = escape_test[i].out; } else if (isoctal(*p)) { t = p; *q++ = (char) octal(&t); p = t; } else if (*p == 'x' && ishex(*(UChar *) (p + 1))) { t = p + 1; *q++ = (char) hex(&t); p = t; } else if (*p == 0) /* can only happen with command line assign */ *q++ = '\\'; else { /* not an escape sequence */ *q++ = '\\'; *q++ = *p++; } } else *q++ = *p++; } *q = 0; if (lenp != 0) *lenp = (unsigned) (q - s); return s; }
int osxlion_parse_hash(char *hashline, char *filename, struct crack_hash* hash) { if (!hashline || !hash) return ERR_INVALID_PARAM; if (strlen(hashline)<2) return ERR_INVALID_PARAM; char line[HASHFILE_MAX_LINE_LENGTH]; snprintf(line, HASHFILE_MAX_LINE_LENGTH-1, "%s", hashline); if((strlen(line) == 136) && ishex(line)) { strcpy(hash->hash, line); strcpy(hash->salt, ""); strcpy(hash->salt2, ""); return 0; } else return 1; }
/* Input a number as (at most 8) hex digits - returns value entered */ long hexIn(void) { char input[40]; long num; register int i; i = 0; num = 0; if (sgets (input)) /* grab a line */ { num = hex2dec(input[i++]); /* Convert MSD to dec */ while(ishex(input[i]) && input[i]) /* Get next hex digit */ { num <<= 4; /* Make room for next digit */ num += hex2dec(input[i++]); /* Add it in */ } } return num; }
/* * Some fonts in XPS are obfuscated by XOR:ing the first 32 bytes of the * data with the GUID in the fontname. */ static void xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part) { unsigned char buf[33]; unsigned char key[16]; char *p; int i; if (part->size < 32) { fz_warn(ctx, "insufficient data for font deobfuscation"); return; } p = strrchr(part->name, '/'); if (!p) p = part->name; for (i = 0; i < 32 && *p; p++) { if (ishex(*p)) buf[i++] = *p; } buf[i] = 0; if (i != 32) { fz_warn(ctx, "cannot extract GUID from obfuscated font part name"); return; } for (i = 0; i < 16; i++) key[i] = unhex(buf[i*2+0]) * 16 + unhex(buf[i*2+1]); for (i = 0; i < 16; i++) { part->data[i] ^= key[15-i]; part->data[i+16] ^= key[15-i]; } }
char to_char(const char* s) { // Example: "#\ " // TODO: How will this work? `(display #\<CTRL+V, CTRL+TAB>)´ ? if ( strlen(s) == 2 ) return ' '; // Example: "#\A", etc. if ( strlen(s) == 3 ) // TODO: Only allow SPECIFIC character ranges return s[2]; // Example: "#\x28" -> '(' if ( strlen(s)>3 && s[2] == 'x' && ishex(s+3) ) { long code = strtol(s+3, (char**)NULL, 16); if ( code > 0x7F ) // U+0000 --- U+007F, i.e., the ASCII repertoire raise(runtime_exception("Unicode characters are not suppoted")); return static_cast<char>(code); } // Example: "#\space" // TODO: Make ONE giant table that we use for all character mappings s += 2; std::string lit = tolower(s); if ( lit == "space" ) return ' '; if ( lit == "tab" ) return '\t'; if ( lit == "newline" ) return '\n'; if ( lit == "return" ) return '\r'; if ( lit == "null" ) return '\0'; if ( lit == "alarm" ) return '\a'; if ( lit == "backspace" ) return '\x8'; if ( lit == "escape" ) return '\x1b'; if ( lit == "delete" ) return '\x7f'; raise(runtime_exception(format("Unrecognized character literal: #\\%s", s))); return '\0'; // make compiler happy }
void read_reference(FILE *trace_file, memory_reference *reference) { int c; /* we have the first character; it defined the memory access type. Skip any blanks, get the hexadecimal address, skip the comma and get the length */ /* skip any leading blanks */ c = skip_blanks(trace_file); memory_address a = 0; while (ishex(c)) { a = (a << 4) | hexvalue(c); c = getc(trace_file); } if (c != ',') { fprintf(stderr, "bad trace file input at line %d: %c\n", trace_line_number, c); exit(-1); } /* skip the comma */ /* and get the length */ int n = 0; c = getc(trace_file); while (isdigit(c)) { n = n * 10 + decvalue(c); c = getc(trace_file); } /* skip to end of line */ while ((c != '\n') && (c != EOF)) c = getc(trace_file); /* define reference fields */ reference->address = a; reference->length = n; }
static int lexhexstring(fz_stream *f, char *buf, int n) { char *s = buf; char *e = buf + n; int a = 0, x = 0; int c; while (s < e) { c = fz_readbyte(f); if (c == '>') break; else if (iswhite(c)) continue; else if (ishex(c)) { if (x) { *s++ = a * 16 + fromhex(c); x = !x; } else { a = fromhex(c); x = !x; } } else { if (c == EOF) { break; } // cf. http://code.google.com/p/sumatrapdf/issues/detail?id=624 fz_warn("Ignoring invalid character in hexstring: %c", c); } } return s - buf; }
static int is_address_line(const char *text) { if (*text != '@') return 0; text++; if (!*text || isspace(*text)) return 0; while (*text && !isspace(*text)) { if (!ishex(*text)) return 0; text++; } while (*text) { if (!isspace(*text)) return 0; text++; } return 1; }
static int valid(char *ciphertext, struct fmt_main *self) { char *ctcopy; char *keeptr; char *p; if (strncmp(ciphertext, "$strip$*", 8)) return 0; ctcopy = strdup(ciphertext); keeptr = ctcopy; ctcopy += 7+1; /* skip over "$strip$" and first '*' */ if ((p = strtokm(ctcopy, "*")) == NULL) /* salt + data */ goto err; if (strlen(p) != 2048) goto err; if (!ishex(p)) goto err; MEM_FREE(keeptr); return 1; err: MEM_FREE(keeptr); return 0; }
static int valid(char *ciphertext, struct fmt_main *self) { char *ctcopy, *keeptr, *p; int len; if (strncmp(ciphertext, FORMAT_TAG, TAG_LENGTH) != 0) return 0; ctcopy = strdup(ciphertext); keeptr = ctcopy; ctcopy += TAG_LENGTH; if ((p = strtokm(ctcopy, "$")) == NULL) goto err; if (!strcmp(p, "v2")) { if ((p = strtokm(NULL, "$")) == NULL) goto err; if (!isdec(p)) goto err; if ((p = strtokm(NULL, "$")) == NULL) goto err; } len = atoi(p); if(len > BIG_ENOUGH || !len) goto err; if ((p = strtokm(NULL, "$")) == NULL) goto err; if (strlen(p) != len * 2 || !ishex(p)) goto err; MEM_FREE(keeptr); return 1; err: MEM_FREE(keeptr); return 0; }
/* * unvis - decode characters previously encoded by vis */ int unvis(char *cp, int c, int *astate, int flag) { if (flag & UNVIS_END) { if (*astate == S_OCTAL2 || *astate == S_OCTAL3) { *astate = S_GROUND; return (UNVIS_VALID); } return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD); } switch (*astate & ~S_HTTP) { case S_GROUND: *cp = 0; if (c == '\\') { *astate = S_START; return (0); } if (flag & VIS_HTTPSTYLE && c == '%') { *astate = S_START | S_HTTP; return (0); } *cp = c; return (UNVIS_VALID); case S_START: if (*astate & S_HTTP) { if (ishex(tolower(c))) { *cp = isdigit(c) ? (c - '0') : (tolower(c) - 'a'); *astate = S_HEX2; return (0); } } switch(c) { case '\\': *cp = c; *astate = S_GROUND; return (UNVIS_VALID); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *cp = (c - '0'); *astate = S_OCTAL2; return (0); case 'M': *cp = 0200; *astate = S_META; return (0); case '^': *astate = S_CTRL; return (0); case 'n': *cp = '\n'; *astate = S_GROUND; return (UNVIS_VALID); case 'r': *cp = '\r'; *astate = S_GROUND; return (UNVIS_VALID); case 'b': *cp = '\b'; *astate = S_GROUND; return (UNVIS_VALID); case 'a': *cp = '\007'; *astate = S_GROUND; return (UNVIS_VALID); case 'v': *cp = '\v'; *astate = S_GROUND; return (UNVIS_VALID); case 't': *cp = '\t'; *astate = S_GROUND; return (UNVIS_VALID); case 'f': *cp = '\f'; *astate = S_GROUND; return (UNVIS_VALID); case 's': *cp = ' '; *astate = S_GROUND; return (UNVIS_VALID); case 'E': *cp = '\033'; *astate = S_GROUND; return (UNVIS_VALID); case '\n': /* * hidden newline */ *astate = S_GROUND; return (UNVIS_NOCHAR); case '$': /* * hidden marker */ *astate = S_GROUND; return (UNVIS_NOCHAR); } *astate = S_GROUND; return (UNVIS_SYNBAD); case S_META: if (c == '-') *astate = S_META1; else if (c == '^') *astate = S_CTRL; else { *astate = S_GROUND; return (UNVIS_SYNBAD); } return (0); case S_META1: *astate = S_GROUND; *cp |= c; return (UNVIS_VALID); case S_CTRL: if (c == '?') *cp |= 0177; else *cp |= c & 037; *astate = S_GROUND; return (UNVIS_VALID); case S_OCTAL2: /* second possible octal digit */ if (isoctal(c)) { /* * yes - and maybe a third */ *cp = (*cp << 3) + (c - '0'); *astate = S_OCTAL3; return (0); } /* * no - done with current sequence, push back passed char */ *astate = S_GROUND; return (UNVIS_VALIDPUSH); case S_OCTAL3: /* third possible octal digit */ *astate = S_GROUND; if (isoctal(c)) { *cp = (*cp << 3) + (c - '0'); return (UNVIS_VALID); } /* * we were done, push back passed char */ return (UNVIS_VALIDPUSH); case S_HEX2: /* second mandatory hex digit */ if (ishex(tolower(c))) { *cp = (isdigit(c) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower(c) - 'a' + 10)); } *astate = S_GROUND; return (UNVIS_VALID); default: /* * decoder in unknown state - (probably uninitialized) */ *astate = S_GROUND; return (UNVIS_SYNBAD); } }
void svg_parse_color(fz_context *ctx, svg_document *doc, const char *str, float *rgb) { int i, l, m, r, cmp, n; rgb[0] = 0.0f; rgb[1] = 0.0f; rgb[2] = 0.0f; /* Crack hex-coded RGB */ if (str[0] == '#') { str ++; n = strlen(str); if (n == 3 || (n > 3 && !ishex(str[3]))) { rgb[0] = (unhex(str[0]) * 16 + unhex(str[0])) / 255.0f; rgb[1] = (unhex(str[1]) * 16 + unhex(str[1])) / 255.0f; rgb[2] = (unhex(str[2]) * 16 + unhex(str[2])) / 255.0f; return; } if (n >= 6) { rgb[0] = (unhex(str[0]) * 16 + unhex(str[1])) / 255.0f; rgb[1] = (unhex(str[2]) * 16 + unhex(str[3])) / 255.0f; rgb[2] = (unhex(str[4]) * 16 + unhex(str[5])) / 255.0f; return; } return; } /* rgb(X,Y,Z) -- whitespace allowed around numbers */ else if (strstr(str, "rgb(")) { int numberlen = 0; char numberbuf[50]; str = str + 4; for (i = 0; i < 3; i++) { while (svg_is_whitespace_or_comma(*str)) str ++; if (svg_is_digit(*str)) { numberlen = 0; while (svg_is_digit(*str) && numberlen < sizeof(numberbuf) - 1) numberbuf[numberlen++] = *str++; numberbuf[numberlen] = 0; if (*str == '%') { str ++; rgb[i] = fz_atof(numberbuf) / 100.0f; } else { rgb[i] = fz_atof(numberbuf) / 255.0f; } } } return; } /* TODO: parse icc-profile(X,Y,Z,W) syntax */ /* Search for a pre-defined color */ else { char keyword[50], *p; fz_strlcpy(keyword, str, sizeof keyword); p = keyword; while (*p && *p >= 'a' && *p <= 'z') ++p; *p = 0; l = 0; r = sizeof(svg_predefined_colors) / sizeof(svg_predefined_colors[0]); while (l <= r) { m = (l + r) / 2; cmp = strcmp(svg_predefined_colors[m].name, keyword); if (cmp > 0) r = m - 1; else if (cmp < 0) l = m + 1; else { rgb[0] = svg_predefined_colors[m].red / 255.0f; rgb[1] = svg_predefined_colors[m].green / 255.0f; rgb[2] = svg_predefined_colors[m].blue / 255.0f; return; } } } }
/* process the escape characters in a string, in place . */ char * rm_escape(char *s, size_t *lenp) { register char *p, *q; char *t; q = p = s; while (*p) { if (*p == '\\') { int ch = *++p; switch (ch) { case 'n': p++; *q++ = '\n'; break; case 't': p++; *q++ = '\t'; break; case 'f': p++; *q++ = '\f'; break; case 'b': p++; *q++ = '\b'; break; case 'r': p++; *q++ = '\r'; break; case 'a': p++; *q++ = '\07'; break; case 'v': p++; *q++ = '\013'; break; case '\\': p++; *q++ = '\\'; break; case '\"': p++; *q++ = '\"'; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': t = p; *q++ = (char) octal(&t); p = t; break; case 'x': if (ishex(*(UChar *) (p + 1))) { t = p + 1; *q++ = (char) hex(&t); p = t; break; } else { goto not_escape; } case '\0': *q++ = '\\'; break; not_escape: default: *q++ = '\\'; *q++ = *p++; break; } } else *q++ = *p++; } *q = 0; if (lenp != 0) *lenp = (unsigned) (q - s); return s; }
int jsY_ishex(int c) { return isdigit(c) || ishex(c); }