Lines Matching refs:char

51  #define	EATAB {while (isascii(CAST(unsigned char, *l)) && \
57 +#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))
66 private char *mkdbname(struct magic_set *, const char *, int);
69 private struct magic_map *apprentice_map(struct magic_set *, const char *);
70 -private int check_buffer(struct magic_set *, struct magic_map *, const char *);
73 const char *);
80 -int main(int, char *[]);
83 -main(int argc, char *argv[])
87 - char *progname;
113 const char name[16];
185 - if (CAST(char *, b) >= CAST(char *, p) &&
186 - CAST(char *, b) <= CAST(char *, p) + map->len)
282 /* const char *fn: list of magic files and directories */
284 file_apprentice(struct magic_set *ms, const char *fn, int action)
343 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
347 + char buffer[BUFSIZ + 1];
348 char *line = NULL;
360 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
411 - char **filearr = NULL, *mfn;
413 + char **filearr = NULL;
442 + char mfn[MAXPATHLEN];
444 + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
470 - char **nfilearr;
473 - if ((nfilearr = CAST(char **,
475 + if ((filearr = CAST(char **,
551 parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line,
555 const char *l = line;
556 char *el;
560 parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
561 - size_t llen, off_t off, size_t len, const char *name, const char *extra,
563 + size_t llen, zend_off_t off, size_t len, const char *name, const char *extra, int nt)
566 const char *l = line;
624 apprentice_map(struct magic_set *ms, const char *fn)
631 char *dbname = NULL;
657 + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
669 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
738 -check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
836 char *dbname;
852 + stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS, NULL);
863 + if (php_stream_write(stream,(const char *)&hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
872 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
944 - if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
945 + if ((utf8_buf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
1047 -cdf_malloc(const char *file __attribute__((__unused__)),
1057 -cdf_realloc(const char *file __attribute__((__unused__)),
1067 -cdf_calloc(const char *file __attribute__((__unused__)),
1128 char buf[512];
1157 if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
1207 char name[__arraycount(d->d_name)];
1212 static const char *types[] = { "empty", "user storage",
1229 char buf[64];
1288 char *
1289 cdf_ctime(const time_t *sec, char *buf)
1291 - char *ptr = ctime_r(sec, buf);
1292 + char *ptr = php_ctime_r(sec, buf);
1333 lzmacmp(const unsigned char *buf)
1339 -static int makeerror(unsigned char **, size_t *, const char *, ...)
1341 +static int makeerror(unsigned char **, size_t *, const char *, ...);
1342 private const char *methodname(size_t);
1423 - if ((*newch = CAST(unsigned char *, malloc(bytes_max + 1))) == NULL)
1424 + if ((*newch = CAST(unsigned char *, emalloc(bytes_max + 1))) == NULL)
1490 if ((nbuf = CAST(unsigned char *,
1610 protected const char *file_fmttime(char *, size_t, uint64_t, int);
1614 -protected int file_buffer(struct magic_set *, int, struct stat *, const char *,
1616 -protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
1617 +protected int file_buffer(struct magic_set *, php_stream *, zend_stat_t *, const char *, const voi…
1619 +protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *);
1621 -protected int file_vprintf(struct magic_set *, const char *, va_list)
1623 +protected int file_vprintf(struct magic_set *, const char *, va_list);
1625 protected char *file_copystr(char *, size_t, size_t, const char *);
1626 protected int file_checkfmt(char *, size_t, const char *);
1628 protected int file_print_guid(char *, size_t, const uint64_t *);
1629 protected int file_parse_guid(const char *, uint64_t *);
1630 protected int file_replace(struct magic_set *, const char *, const char *);
1631 -protected int file_printf(struct magic_set *, const char *, ...)
1633 +protected int file_printf(struct magic_set *, const char *, ...);
1640 const char *);
1646 -protected void file_error(struct magic_set *, int, const char *, ...)
1648 -protected void file_magerror(struct magic_set *, const char *, ...)
1650 -protected void file_magwarn(struct magic_set *, const char *, ...)
1652 +protected void file_error(struct magic_set *, int, const char *, ...);
1653 +protected void file_magerror(struct magic_set *, const char *, ...);
1654 +protected void file_magwarn(struct magic_set *, const char *, ...);
1656 protected void file_showstr(FILE *, const char *, size_t);
1657 protected size_t file_mbswidth(const char *);
1660 protected char *file_strtrim(char *);
1674 - const char *pat;
1680 - char *old_lc_ctype;
1686 -protected int file_regcomp(file_regex_t *, const char *, int);
1687 -protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
1691 +public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32_t options);
1694 char *buf;
1703 -int vasprintf(char **, const char *, va_list);
1706 -int asprintf(char **, const char *, ...);
1709 -int dprintf(int, const char *, ...);
1714 size_t strlcpy(char *, const char *, size_t);
1718 size_t strlcat(char *, const char *, size_t);
1723 char *asctime_r(const struct tm *, char *);
1732 -const char *fmtcheck(const char *, const char *)
1748 -protected const char *file_getprogname(void);
1749 -protected void file_setprogname(const char *);
1750 -protected void file_err(int, const char *, ...)
1752 -protected void file_errx(int, const char *, ...)
1754 -protected void file_warn(const char *, ...)
1756 -protected void file_warnx(const char *, ...)
1787 -bad_link(struct magic_set *ms, int err, char *buf)
1811 handle_mime(struct magic_set *ms, int mime, const char *str)
1816 -file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
1817 +file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb)
1823 - char buf[BUFSIZ+4];
2013 - char *tmp;
2014 - char buf2[BUFSIZ+BUFSIZ+4];
2051 - const char *p;
2085 protected char *
2086 file_copystr(char *buf, size_t blen, size_t width, const char *str)
2099 file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
2103 char *buf, *newstr;
2104 char tbuf[1024];
2150 file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
2157 - const char *inname __attribute__ ((__unused__)),
2159 + const char *inname,
2164 const char *ftype = NULL;
2165 char *rbuf = NULL;
2219 - if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
2220 + if ((pbuf = CAST(char *, erealloc(ms->o.pbuf, psize))) == NULL) {
2237 file_replace(struct magic_set *ms, const char *pat, const char *rep)
2264 + pattern = convert_libmagic_pattern((char*)pat, strlen(pat), opts);
2286 -file_regcomp(file_regex_t *rx, const char *pat, int flags)
2306 -file_regexec(file_regex_t *rx, const char *str, size_t nmatch,
2335 - char errmsg[512];
2356 char *rbuf;
2389 protected char *
2390 file_strtrim(char *str)
2429 -private void close_and_restore(const struct magic_set *, const char *, int,
2431 -private int unreadable_info(struct magic_set *, mode_t, const char *);
2432 -private const char* get_default_magic(void);
2434 -private const char *file_or_fd(struct magic_set *, const char *, int);
2440 +private int unreadable_info(struct magic_set *, mode_t, const char *);
2441 +private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
2452 -_w32_append_path(char **hmagicpath, const char *fmt, ...)
2454 - char *tmppath;
2455 - char *newpath;
2485 -_w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
2487 - static const char *trypaths[] = {
2502 - char exepath[MAX_PATH];
2535 -private const char *
2538 - static const char hmagic[] = "/.magic/magic.mgc";
2539 - static char *default_magic;
2540 - char *home, *hmagicpath;
2610 -public const char *
2611 -magic_getpath(const char *magicfile, int action)
2646 magic_compile(struct magic_set *ms, const char *magicfile)
2653 -close_and_restore(const struct magic_set *ms, const char *name, int fd,
2705 +public const char *
2713 private const char *
2714 -file_or_fd(struct magic_set *ms, const char *inname, int fd)
2715 +file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
2718 unsigned char *buf;
2733 - if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
2734 + if ((buf = CAST(unsigned char *, emalloc(ms->bytes_max + SLOP))) == NULL)
2772 + stream = php_stream_open_wrapper((char *)inname, "rb", REPORT_ERRORS, NULL);
2838 + if ((nbytes = php_stream_read(stream, (char *)buf, ms->bytes_max - nbytes)) < 0) {
2875 const char *magic_getpath(const char *, int);
2876 const char *magic_file(magic_t, const char *);
2877 +const char *magic_stream(magic_t, php_stream *);
2878 const char *magic_descriptor(magic_t, int);
2879 const char *magic_buffer(magic_t, const void *, size_t);
2902 file_magwarn(struct magic_set *ms, const char *f, ...)
2905 + char *expanded_format = NULL;
2928 protected const char *
2975 const char *rv = NULL;
2978 + char *vbuf_lower;
2985 - char *old_lc_ctype = setlocale(LC_CTYPE, NULL);
2995 + char *pattern_lower;
3023 const char *s, *e;
3094 private const char * __attribute__((__format_arg__(3)))
3218 check_fmt(struct magic_set *ms, const char *fmt)
3310 +public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32_t options)
3373 - const char *search;
3393 + pattern = convert_libmagic_pattern((char *)m->value.s, m->vallen, options);
3402 - char *copy;
3404 - copy = CAST(char *, malloc(slen));
3463 - search = CCAST(char *, "");
3466 - rc = file_regexec(&rx, RCAST(const char *, search),