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);
420 - char **filearr = NULL, *mfn;
422 + char **filearr = NULL;
451 + char mfn[MAXPATHLEN];
453 + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
479 - char **nfilearr;
482 - if ((nfilearr = CAST(char **,
484 + if ((filearr = CAST(char **,
569 parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line,
573 const char *l = line;
574 char *el;
578 parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
579 - size_t llen, off_t off, size_t len, const char *name, const char *extra,
581 + size_t llen, zend_off_t off, size_t len, const char *name, const char *extra, int nt)
584 const char *l = line;
642 apprentice_map(struct magic_set *ms, const char *fn)
649 char *dbname = NULL;
675 + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
687 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
756 -check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
854 char *dbname;
870 + stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS, NULL);
881 + if (php_stream_write(stream,(const char *)&hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
890 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
962 - if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
963 + if ((utf8_buf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
1074 -cdf_malloc(const char *file __attribute__((__unused__)),
1084 -cdf_realloc(const char *file __attribute__((__unused__)),
1094 -cdf_calloc(const char *file __attribute__((__unused__)),
1155 char buf[512];
1184 if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
1234 char name[__arraycount(d->d_name)];
1239 static const char *types[] = { "empty", "user storage",
1256 char buf[64];
1315 char *
1316 cdf_ctime(const time_t *sec, char *buf)
1318 - char *ptr = ctime_r(sec, buf);
1319 + char *ptr = php_ctime_r(sec, buf);
1360 lzmacmp(const unsigned char *buf)
1366 -static int makeerror(unsigned char **, size_t *, const char *, ...)
1368 +static int makeerror(unsigned char **, size_t *, const char *, ...);
1369 private const char *methodname(size_t);
1450 - if ((*newch = CAST(unsigned char *, malloc(bytes_max + 1))) == NULL)
1451 + if ((*newch = CAST(unsigned char *, emalloc(bytes_max + 1))) == NULL)
1517 if ((nbuf = CAST(unsigned char *,
1637 protected const char *file_fmttime(char *, size_t, uint64_t, int);
1641 -protected int file_buffer(struct magic_set *, int, struct stat *, const char *,
1643 -protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
1644 +protected int file_buffer(struct magic_set *, php_stream *, zend_stat_t *, const char *, const voi…
1646 +protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *);
1648 -protected int file_vprintf(struct magic_set *, const char *, va_list)
1650 +protected int file_vprintf(struct magic_set *, const char *, va_list);
1652 protected char *file_copystr(char *, size_t, size_t, const char *);
1653 protected int file_checkfmt(char *, size_t, const char *);
1655 protected int file_print_guid(char *, size_t, const uint64_t *);
1656 protected int file_parse_guid(const char *, uint64_t *);
1657 protected int file_replace(struct magic_set *, const char *, const char *);
1658 -protected int file_printf(struct magic_set *, const char *, ...)
1660 +protected int file_printf(struct magic_set *, const char *, ...);
1667 const char *);
1673 -protected void file_error(struct magic_set *, int, const char *, ...)
1675 -protected void file_magerror(struct magic_set *, const char *, ...)
1677 -protected void file_magwarn(struct magic_set *, const char *, ...)
1679 +protected void file_error(struct magic_set *, int, const char *, ...);
1680 +protected void file_magerror(struct magic_set *, const char *, ...);
1681 +protected void file_magwarn(struct magic_set *, const char *, ...);
1683 protected void file_showstr(FILE *, const char *, size_t);
1684 protected size_t file_mbswidth(const char *);
1687 protected char *file_strtrim(char *);
1701 - const char *pat;
1707 - char *old_lc_ctype;
1713 -protected int file_regcomp(file_regex_t *, const char *, int);
1714 -protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
1718 +public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32_t options);
1721 char *buf;
1730 -int vasprintf(char **, const char *, va_list);
1733 -int asprintf(char **, const char *, ...);
1736 -int dprintf(int, const char *, ...);
1741 size_t strlcpy(char *, const char *, size_t);
1745 size_t strlcat(char *, const char *, size_t);
1750 char *asctime_r(const struct tm *, char *);
1759 -const char *fmtcheck(const char *, const char *)
1775 -protected const char *file_getprogname(void);
1776 -protected void file_setprogname(const char *);
1777 -protected void file_err(int, const char *, ...)
1779 -protected void file_errx(int, const char *, ...)
1781 -protected void file_warn(const char *, ...)
1783 -protected void file_warnx(const char *, ...)
1814 -bad_link(struct magic_set *ms, int err, char *buf)
1838 handle_mime(struct magic_set *ms, int mime, const char *str)
1843 -file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
1844 +file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb)
1850 - char buf[BUFSIZ+4];
2040 - char *tmp;
2041 - char buf2[BUFSIZ+BUFSIZ+4];
2078 - const char *p;
2112 protected char *
2113 file_copystr(char *buf, size_t blen, size_t width, const char *str)
2126 file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
2130 char *buf, *newstr;
2131 char tbuf[1024];
2177 file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
2184 - const char *inname __attribute__ ((__unused__)),
2186 + const char *inname,
2191 const char *ftype = NULL;
2192 char *rbuf = NULL;
2246 - if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
2247 + if ((pbuf = CAST(char *, erealloc(ms->o.pbuf, psize))) == NULL) {
2264 file_replace(struct magic_set *ms, const char *pat, const char *rep)
2291 + pattern = convert_libmagic_pattern((char*)pat, strlen(pat), opts);
2313 -file_regcomp(file_regex_t *rx, const char *pat, int flags)
2333 -file_regexec(file_regex_t *rx, const char *str, size_t nmatch,
2362 - char errmsg[512];
2383 char *rbuf;
2416 protected char *
2417 file_strtrim(char *str)
2456 -private void close_and_restore(const struct magic_set *, const char *, int,
2458 -private int unreadable_info(struct magic_set *, mode_t, const char *);
2459 -private const char* get_default_magic(void);
2461 -private const char *file_or_fd(struct magic_set *, const char *, int);
2467 +private int unreadable_info(struct magic_set *, mode_t, const char *);
2468 +private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
2479 -_w32_append_path(char **hmagicpath, const char *fmt, ...)
2481 - char *tmppath;
2482 - char *newpath;
2512 -_w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
2514 - static const char *trypaths[] = {
2529 - char exepath[MAX_PATH];
2562 -private const char *
2565 - static const char hmagic[] = "/.magic/magic.mgc";
2566 - static char *default_magic;
2567 - char *home, *hmagicpath;
2637 -public const char *
2638 -magic_getpath(const char *magicfile, int action)
2673 magic_compile(struct magic_set *ms, const char *magicfile)
2680 -close_and_restore(const struct magic_set *ms, const char *name, int fd,
2732 +public const char *
2740 private const char *
2741 -file_or_fd(struct magic_set *ms, const char *inname, int fd)
2742 +file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
2745 unsigned char *buf;
2760 - if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
2761 + if ((buf = CAST(unsigned char *, emalloc(ms->bytes_max + SLOP))) == NULL)
2799 + stream = php_stream_open_wrapper((char *)inname, "rb", REPORT_ERRORS, NULL);
2865 + if ((nbytes = php_stream_read(stream, (char *)buf, ms->bytes_max - nbytes)) < 0) {
2902 const char *magic_getpath(const char *, int);
2903 const char *magic_file(magic_t, const char *);
2904 +const char *magic_stream(magic_t, php_stream *);
2905 const char *magic_descriptor(magic_t, int);
2906 const char *magic_buffer(magic_t, const void *, size_t);
2929 file_magwarn(struct magic_set *ms, const char *f, ...)
2932 + char *expanded_format = NULL;
2955 protected const char *
3002 const char *rv = NULL;
3005 + char *vbuf_lower;
3012 - char *old_lc_ctype = setlocale(LC_CTYPE, NULL);
3022 + char *pattern_lower;
3050 const char *s, *e;
3121 private const char * __attribute__((__format_arg__(3)))
3245 check_fmt(struct magic_set *ms, const char *fmt)
3337 +public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32_t options)
3400 const char *found;
3404 - found = CAST(const char *, memmem(ms->search.s, idx,
3406 + found = CAST(const char *, php_memnstr(ms->search.s,
3425 - const char *search;
3445 + pattern = convert_libmagic_pattern((char *)m->value.s, m->vallen, options);
3454 - char *copy;
3456 - copy = CAST(char *, malloc(slen));
3515 - search = CCAST(char *, "");
3518 - rc = file_regexec(&rx, RCAST(const char *, search),