Lines Matching refs:buf

140 -	free(ms->o.buf);
146 + if (ms->o.buf) {
147 + efree(ms->o.buf);
166 ms->o.buf = ms->o.pbuf = NULL;
804 char *buf;
813 - if (asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext) < 0)
815 - if (access(buf, R_OK) != -1) {
816 + spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
818 + if (VCWD_ACCESS(buf, R_OK) == 0) {
820 + if (VCWD_ACCESS(buf, R_OK) != -1) {
823 return buf;
825 - free(buf);
826 + efree(buf);
828 - if (asprintf(&buf, "%.*s%s", (int)(q - fn), fn, ext) < 0)
830 + spprintf(&buf, MAXPATHLEN, "%.*s%s", (int)(q - fn), fn, ext);
925 - if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
929 + if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len)
945 (void)memcpy(((char *)buf) + offs,
1056 char buf[64];
1068 cdf_print_elapsed_time(buf, sizeof(buf), tp);
1069 (void)fprintf(stderr, "timestamp %s\n", buf);
1171 char buf[25];
1243 -sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
1244 +sread(int fd, void *buf, size_t n, int canbepipe)
1252 - switch ((rv = read(fd, buf, n))) {
1253 + switch ((rv = FINFO_READ_FUNC(fd, buf, n))) {
1556 -bad_link(struct magic_set *ms, int err, char *buf)
1566 - "broken symbolic link to `%s'", buf);
1569 - if (file_printf(ms, "broken symbolic link to `%s'", buf) == -1)
1602 - char buf[BUFSIZ+4];
1782 - if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
1799 - buf[nch] = '\0'; /* readlink(2) does not do this */
1802 - if (*buf == '/') {
1803 - if (stat(buf, &tstatbuf) < 0)
1804 - return bad_link(ms, errno, buf);
1810 - tmp = buf; /* in current directory anyway */
1815 - "path too long: `%s'", buf);
1832 - (void)strlcat(buf2, buf, sizeof buf2);
1836 - return bad_link(ms, errno, buf);
1843 - p = magic_file(ms, buf);
1852 - COMMA, buf) == -1)
1945 - char *buf, *newstr;
1946 + char *buf = NULL, *newstr;
1948 - len = vasprintf(&buf, fmt, ap);
1952 + len = vspprintf(&buf, 0, fmt, ap);
1955 if (ms->o.buf != NULL) {
1956 - len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
1957 - free(buf);
1960 - free(ms->o.buf);
1961 - buf = newstr;
1962 + len = spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
1963 + if (buf) {
1964 + efree(buf);
1966 + efree(ms->o.buf);
1967 + ms->o.buf = newstr;
1969 + ms->o.buf = buf;
1971 - ms->o.buf = buf;
1995 + char *buf = NULL;
2001 - free(ms->o.buf);
2002 + efree(ms->o.buf);
2003 ms->o.buf = NULL;
2010 + vspprintf(&buf, 0, f, va);
2014 + file_printf(ms, "%s (%s)", (*buf ? buf : ""), strerror(error));
2015 + } else if (*buf) {
2016 + file_printf(ms, "%s", buf);
2019 + if (buf) {
2020 + efree(buf);
2033 - const void *buf, size_t nb)
2034 +file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const void *buf,
2092 if (ms->o.buf) {
2093 - free(ms->o.buf);
2094 + efree(ms->o.buf);
2095 ms->o.buf = NULL;
2114 len = strlen(ms->o.buf);
2141 return ms->o.buf == NULL ? 0 : strlen(ms->o.buf);
2172 + res = php_pcre_replace_impl(pce, ms->o.buf, strlen(ms->o.buf), repl,
2189 - while (regexec(&rx, ms->o.buf, 1, &rm, 0) == 0) {
2190 - ms->o.buf[rm.rm_so] = '\0';
2192 - rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
2200 + strncpy(ms->o.buf, res, res_len);
2201 + ms->o.buf[res_len] = '\0';
2412 unsigned char *buf;
2428 - if ((buf = CAST(unsigned char *, malloc(HOWMANY + SLOP))) == NULL)
2430 + buf = emalloc(HOWMANY + SLOP);
2493 - while ((r = sread(fd, (void *)&buf[nbytes],
2508 - if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) {
2512 + if ((nbytes = php_stream_read(stream, (char *)buf, HOWMANY)) < 0) {
2517 (void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
2518 - if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
2519 + if (file_buffer(ms, stream, inname, buf, (size_t)nbytes) == -1)
2523 - free(buf);
2525 + efree(buf);
2542 - if (file_buffer(ms, -1, NULL, buf, nb) == -1) {
2543 + if (file_buffer(ms, NULL, NULL, buf, nb) == -1) {
2826 char buf[64];
2834 cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
2917 file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
2924 if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
3078 const char *buf; /* start of search region */
3097 buf = RCAST(const char *, s) + offset;
3100 /* mget() guarantees buf <= last */
3101 for (lines = linecnt, b = buf; lines && b < end &&
3110 ms->search.s = buf;
3111 ms->search.s_len = last - buf;
3283 sbuf = ms->o.buf;
3285 ms->o.buf = NULL;
3292 rbuf = ms->o.buf;