Lines Matching refs:char

17  private char *mkdbname(struct magic_set *, const char *, int);
20 private struct magic_map *apprentice_map(struct magic_set *, const char *);
21 -private int check_buffer(struct magic_set *, struct magic_map *, const char *);
24 const char *);
33 int main(int, char *[]);
105 - char *p;
113 - p = CAST(char *, map->p);
115 - char *b = RCAST(char *, map->magic[i]);
227 /* const char *fn: list of magic files and directories */
229 file_apprentice(struct magic_set *ms, const char *fn, int action)
288 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
292 + char buffer[BUFSIZ + 1];
293 char *line = NULL;
305 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
356 - char **filearr = NULL, *mfn;
358 + char **filearr = NULL;
387 + char mfn[MAXPATHLEN];
389 + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
415 - char **nfilearr;
418 - if ((nfilearr = CAST(char **,
420 + if ((filearr = CAST(char **,
496 parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
497 - size_t llen, off_t off, size_t len, const char *name, const char *extra,
499 + size_t llen, zend_off_t off, size_t len, const char *name, const char *extra, int nt)
502 const char *l = line;
559 apprentice_map(struct magic_set *ms, const char *fn)
566 char *dbname = NULL;
592 + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
604 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
673 -check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
772 char *dbname;
781 + stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS, NULL);
792 + if (php_stream_write(stream,(const char *)&hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
801 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
881 - if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
882 + if ((utf8_buf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
994 -cdf_malloc(const char *file __attribute__((__unused__)),
1006 -cdf_realloc(const char *file __attribute__((__unused__)),
1016 -cdf_calloc(const char *file __attribute__((__unused__)),
1079 char buf[512];
1108 if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
1158 char name[__arraycount(d->d_name)];
1163 static const char *types[] = { "empty", "user storage",
1180 char buf[64];
1241 lzmacmp(const unsigned char *buf)
1312 - if ((*newch = CAST(unsigned char *, malloc(bytes_max + 1))) == NULL)
1313 + if ((*newch = CAST(unsigned char *, emalloc(bytes_max + 1))) == NULL)
1378 unsigned char *nbuf;
1381 - if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
1382 + if ((nbuf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
1471 protected const char *file_fmtnum(char *, size_t, const char *, int);
1475 -protected int file_buffer(struct magic_set *, int, struct stat *, const char *,
1477 -protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
1478 +protected int file_buffer(struct magic_set *, php_stream *, zend_stat_t *, const char *, const voi…
1480 +protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *);
1482 protected int file_vprintf(struct magic_set *, const char *, va_list)
1491 const char *);
1495 protected char *file_strtrim(char *);
1505 -protected int file_regcomp(struct magic_set *, file_regex_t *, const char *,
1507 -protected int file_regexec(struct magic_set *, file_regex_t *, const char *,
1512 char *buf;
1522 -int vasprintf(char **, const char *, va_list);
1525 -int asprintf(char **, const char *, ...);
1528 -int dprintf(int, const char *, ...);
1533 size_t strlcpy(char *, const char *, size_t);
1537 size_t strlcat(char *, const char *, size_t);
1542 char *asctime_r(const struct tm *, char *);
1551 -const char *fmtcheck(const char *, const char *)
1567 -protected const char *file_getprogname(void);
1568 -protected void file_setprogname(const char *);
1569 -protected void file_err(int, const char *, ...)
1571 -protected void file_errx(int, const char *, ...)
1573 -protected void file_warn(const char *, ...)
1575 -protected void file_warnx(const char *, ...)
1589 -bad_link(struct magic_set *ms, int err, char *buf)
1613 handle_mime(struct magic_set *ms, int mime, const char *str)
1618 -file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
1619 +file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb)
1625 - char buf[BUFSIZ+4];
1815 - char *tmp;
1816 - char buf2[BUFSIZ+BUFSIZ+4];
1818 - if ((tmp = CCAST(char *, strrchr(fn, '/'))) == NULL) {
1853 - const char *p;
1887 file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
1891 char *buf, *newstr;
1892 char tbuf[1024];
1938 - const char *inname __attribute__ ((__unused__)),
1940 + const char *inname,
1945 const char *ftype = NULL;
1946 char *rbuf = NULL;
2000 - if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
2001 + if ((pbuf = CAST(char *, erealloc(ms->o.pbuf, psize))) == NULL) {
2018 file_replace(struct magic_set *ms, const char *pat, const char *rep)
2043 + pattern = convert_libmagic_pattern((char*)pat, strlen(pat), opts);
2066 - const char *pat, int flags)
2072 - char old[1024];
2087 - char errmsg[512];
2100 - const char *str, size_t nmatch, regmatch_t* pmatch, int eflags)
2106 - char old[1024];
2142 char *rbuf;
2206 -private void close_and_restore(const struct magic_set *, const char *, int,
2208 -private int unreadable_info(struct magic_set *, mode_t, const char *);
2209 -private const char* get_default_magic(void);
2211 -private const char *file_or_fd(struct magic_set *, const char *, int);
2217 +private int unreadable_info(struct magic_set *, mode_t, const char *);
2218 +private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
2229 -_w32_append_path(char **hmagicpath, const char *fmt, ...)
2231 - char *tmppath;
2232 - char *newpath;
2262 -_w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
2264 - static const char *trypaths[] = {
2279 - char exepath[MAX_PATH];
2314 -private const char *
2317 - static const char hmagic[] = "/.magic/magic.mgc";
2318 - static char *default_magic;
2319 - char *home, *hmagicpath;
2393 -public const char *
2394 -magic_getpath(const char *magicfile, int action)
2429 magic_compile(struct magic_set *ms, const char *magicfile)
2436 -close_and_restore(const struct magic_set *ms, const char *name, int fd,
2488 +public const char *
2496 private const char *
2497 -file_or_fd(struct magic_set *ms, const char *inname, int fd)
2498 +file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
2501 unsigned char *buf;
2516 - if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
2517 + if ((buf = CAST(unsigned char *, emalloc(ms->bytes_max + SLOP))) == NULL)
2553 + stream = php_stream_open_wrapper((char *)inname, "rb", REPORT_ERRORS, NULL);
2619 + if ((nbytes = php_stream_read(stream, (char *)buf, ms->bytes_max - nbytes)) < 0) {
2656 const char *magic_getpath(const char *, int);
2657 const char *magic_file(magic_t, const char *);
2658 +const char *magic_stream(magic_t, php_stream *);
2659 const char *magic_descriptor(magic_t, int);
2660 const char *magic_buffer(magic_t, const void *, size_t);
2675 file_magwarn(struct magic_set *ms, const char *f, ...)
2678 + char *expanded_format = NULL;
2701 protected const char *
2746 const char *rv = NULL;
2749 + char *vbuf_lower;
2756 - char *old_lc_ctype = setlocale(LC_CTYPE, NULL);
2766 + char *pattern_lower;
2794 const char *s, *e;
2879 private const char * __attribute__((__format_arg__(3)))
2945 check_fmt(struct magic_set *ms, const char *fmt)
2949 - const char* pat = "%[-0-9\\.]*s";
2981 - if ((copy = CAST(char *, malloc(len + 1))) == NULL)
2982 + if ((copy = CAST(char *, emalloc(len + 1))) == NULL)
2987 char *cp, *scp;
2990 - cp = strndup(RCAST(const char *, ms->search.s),
2991 + cp = estrndup(RCAST(const char *, ms->search.s),
3111 - found = CAST(const char *, memmem(ms->search.s, idx,
3113 + found = CAST(const char *, php_memnstr(ms->search.s,
3124 - const char *search;
3127 - char *copy;
3143 - copy = CAST(char *, malloc(slen));
3154 - search = CCAST(char *, "");
3159 - rc = file_regexec(ms, rx, RCAST(const char *, search),
3174 + pattern = convert_libmagic_pattern((char *)m->value.s, m->vallen, options);