Lines Matching refs:char
17 file_private char *mkdbname(struct magic_set *, const char *, int);
20 file_private struct magic_map *apprentice_map(struct magic_set *, const char *);
21 -file_private int check_buffer(struct magic_set *, struct magic_map *, const char *);
24 const char *);
33 int main(int, char *[]);
113 - char *p;
121 - p = CAST(char *, map->p);
123 - char *b = RCAST(char *, map->magic[i]);
234 /* const char *fn: list of magic files and directories */
236 file_apprentice(struct magic_set *ms, const char *fn, int action)
295 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
299 + char buffer[BUFSIZ + 1];
300 char *line = NULL;
312 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
363 - char **filearr = NULL, *mfn;
365 + char **filearr = NULL;
394 + char mfn[MAXPATHLEN];
396 + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
422 - char **nfilearr;
425 - if ((nfilearr = CAST(char **,
427 + if ((filearr = CAST(char **,
503 parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
504 - size_t llen, off_t off, size_t len, const char *name, const char *extra,
505 + size_t llen, zend_off_t off, size_t len, const char *name, const char *extra,
565 apprentice_map(struct magic_set *ms, const char *fn)
572 char *dbname = NULL;
598 + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
610 + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
679 -check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
778 char *dbname;
787 + stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS, NULL);
798 + if (php_stream_write(stream,(const char *)&hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
807 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
887 - if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
888 + if ((utf8_buf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
996 -cdf_malloc(const char *file __attribute__((__unused__)),
1008 -cdf_realloc(const char *file __attribute__((__unused__)),
1018 -cdf_calloc(const char *file __attribute__((__unused__)),
1081 char buf[512];
1110 if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
1160 char name[__arraycount(d->d_name)];
1165 static const char *types[] = { "empty", "user storage",
1182 char buf[64];
1243 lzmacmp(const unsigned char *buf)
1321 int (*decompress)(const unsigned char *, unsigned char **,
1324 - *newch = CAST(unsigned char *, malloc(bytes_max + 1));
1325 + *newch = CAST(unsigned char *, emalloc(bytes_max + 1));
1360 unsigned char *nbuf;
1363 - if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
1364 + if ((nbuf = CAST(unsigned char *, emalloc(mlen))) == NULL) {
1474 file_protected const char *file_fmtnum(char *, size_t, const char *, int);
1479 - const char *, const void *, size_t);
1480 -file_protected int file_fsmagic(struct magic_set *, const char *,
1482 +file_protected int file_buffer(struct magic_set *, php_stream *, zend_stat_t *, const char *, cons…
1484 +file_protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *);
1487 file_protected int file_vprintf(struct magic_set *, const char *, va_list)
1495 const char *);
1499 file_protected char *file_strtrim(char *);
1510 - const char *, int);
1512 - const char *, size_t, regmatch_t *, int);
1516 char *buf;
1526 -int vasprintf(char **, const char *, va_list);
1529 -int asprintf(char **, const char *, ...);
1532 -int dprintf(int, const char *, ...);
1537 size_t strlcpy(char *, const char *, size_t);
1541 size_t strlcat(char *, const char *, size_t);
1546 char *asctime_r(const struct tm *, char *);
1555 -const char *fmtcheck(const char *, const char *)
1571 -file_protected const char *file_getprogname(void);
1572 -file_protected void file_setprogname(const char *);
1573 -file_protected void file_err(int, const char *, ...)
1575 -file_protected void file_errx(int, const char *, ...)
1577 -file_protected void file_warn(const char *, ...)
1579 -file_protected void file_warnx(const char *, ...)
1593 -bad_link(struct magic_set *ms, int err, char *buf)
1617 handle_mime(struct magic_set *ms, int mime, const char *str)
1622 -file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
1623 +file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb)
1629 - char buf[BUFSIZ+4];
1819 - char *tmp;
1820 - char buf2[BUFSIZ+BUFSIZ+4];
1822 - if ((tmp = CCAST(char *, strrchr(fn, '/'))) == NULL) {
1857 - const char *p;
1891 file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
1895 char *buf, *newstr;
1896 char tbuf[1024];
1943 const char *inname __attribute__ ((__unused__)),
1947 const char *ftype = NULL;
1948 char *rbuf = NULL;
2011 - if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
2012 + if ((pbuf = CAST(char *, erealloc(ms->o.pbuf, psize))) == NULL) {
2029 file_replace(struct magic_set *ms, const char *pat, const char *rep)
2054 + pattern = convert_libmagic_pattern((char*)pat, strlen(pat), opts);
2076 -check_regex(struct magic_set *ms, const char *pat)
2078 - char sbuf[512];
2079 - unsigned char oc = '\0';
2080 - const char *p;
2085 - unsigned char c = *p;
2111 - const char *pat, int flags)
2120 - char old[1024];
2133 - char errmsg[512], buf[512];
2146 - const char *str, size_t nmatch, regmatch_t* pmatch, int eflags)
2152 - char old[1024];
2188 char *rbuf;
2252 -file_private void close_and_restore(const struct magic_set *, const char *, int,
2254 -file_private int unreadable_info(struct magic_set *, mode_t, const char *);
2255 -file_private const char* get_default_magic(void);
2257 -file_private const char *file_or_fd(struct magic_set *, const char *, int);
2263 +file_private int unreadable_info(struct magic_set *, mode_t, const char *);
2264 +file_private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
2275 -_w32_append_path(char **hmagicpath, const char *fmt, ...)
2277 - char *tmppath;
2278 - char *newpath;
2308 -_w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
2310 - static const char *trypaths[] = {
2325 - char exepath[MAX_PATH];
2360 -file_private const char *
2363 - static const char hmagic[] = "/.magic/magic.mgc";
2364 - static char *default_magic;
2365 - char *home, *hmagicpath;
2439 -file_public const char *
2440 -magic_getpath(const char *magicfile, int action)
2475 magic_compile(struct magic_set *ms, const char *magicfile)
2482 -close_and_restore(const struct magic_set *ms, const char *name, int fd,
2534 +file_public const char *
2542 file_private const char *
2543 -file_or_fd(struct magic_set *ms, const char *inname, int fd)
2544 +file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
2547 unsigned char *buf;
2562 - if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
2563 + if ((buf = CAST(unsigned char *, emalloc(ms->bytes_max + SLOP))) == NULL)
2599 + stream = php_stream_open_wrapper((char *)inname, "rb", REPORT_ERRORS, NULL);
2665 + if ((nbytes = php_stream_read(stream, (char *)buf, ms->bytes_max - nbytes)) < 0) {
2734 const char *magic_getpath(const char *, int);
2735 const char *magic_file(magic_t, const char *);
2736 +const char *magic_stream(magic_t, php_stream *);
2737 const char *magic_descriptor(magic_t, int);
2738 const char *magic_buffer(magic_t, const void *, size_t);
2763 file_magwarn(struct magic_set *ms, const char *f, ...)
2766 + char *expanded_format = NULL;
2789 file_protected const char *
2834 const char *rv = NULL;
2837 + char *vbuf_lower;
2844 - char *old_lc_ctype = setlocale(LC_CTYPE, NULL);
2854 + char *pattern_lower;
2882 const char *s, *e;
2967 file_private const char * __attribute__((__format_arg__(3)))
3033 check_fmt(struct magic_set *ms, const char *fmt)
3037 - const char* pat = "%[-0-9\\.]*s";
3069 - if ((copy = CAST(char *, malloc(len + 1))) == NULL)
3070 + if ((copy = CAST(char *, emalloc(len + 1))) == NULL)
3075 char *cp, *scp;
3078 - cp = strndup(RCAST(const char *, ms->search.s),
3079 + cp = estrndup(RCAST(const char *, ms->search.s),
3211 const char *found;
3215 - found = CAST(const char *, memmem(ms->search.s, idx,
3221 + found = CAST(const char *, php_memnstr(ms->search.s,
3238 - const char *search;
3241 - char *copy;
3259 - copy = CAST(char *, malloc(slen));
3270 - search = CCAST(char *, "");
3273 - rc = file_regexec(ms, rx, RCAST(const char *, search),
3288 + pattern = convert_libmagic_pattern((char *)m->value.s, m->vallen, options);