Lines Matching refs:buf

194 -	free(ms->o.buf);
200 + if (ms->o.buf) {
201 + efree(ms->o.buf);
220 ms->o.buf = ms->o.pbuf = NULL;
746 "`%.*s', new type `%s'", name, (int)len, buf, l);
1174 - if (asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext) < 0)
1176 - if (access(buf, R_OK) != -1) {
1177 + spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
1179 + if (VCWD_ACCESS(buf, R_OK) == 0) {
1181 + if (VCWD_ACCESS(buf, R_OK) != -1) {
1184 return buf;
1186 - free(buf);
1187 + efree(buf);
1189 - if (asprintf(&buf, "%.*s%s", (int)(q - fn), fn, ext) < 0)
1191 + spprintf(&buf, MAXPATHLEN, "%.*s%s", (int)(q - fn), fn, ext);
1266 * the contents of buf. If buf is not the complete file, apptype can
1438 -cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
1439 +cdf_read(const cdf_info_t *info, zend_off_t off, void *buf, size_t len)
1449 (void)memcpy(buf, &info->i_buf[off], len);
1454 - if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
1458 + if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len)
1463 char buf[512];
1466 - if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1)
1467 + if (cdf_read(info, (zend_off_t)0, buf, sizeof(buf)) == -1)
1469 cdf_unpack_header(h, buf);
1475 - return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);
1476 + return cdf_read(info, (zend_off_t)pos, ((char *)buf) + offs, len);
1501 if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
1511 - free(buf);
1512 + efree(buf);
1516 - free(buf);
1518 + efree(buf);
1621 char buf[64];
1625 (void)fprintf(stderr, "Class %s\n", buf);
1716 cdf_ctime(const time_t *sec, char *buf)
1718 - char *ptr = ctime_r(sec, buf);
1719 + char *ptr = php_ctime_r(sec, buf);
1721 return buf;
1722 (void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
1812 -zlibcmp(const unsigned char *buf)
1817 - if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
1820 - x = buf[0] | (buf[1] << 8);
1822 - x = buf[1] | (buf[0] << 8);
1853 + const unsigned char *buf, size_t nbytes)
1862 - const unsigned char *buf = b->fbuf;
1903 -sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
1904 +sread(int fd, void *buf, size_t n, int canbepipe)
1912 - switch ((rv = read(fd, buf, n))) {
1913 + switch ((rv = FINFO_READ_FUNC(fd, buf, n))) {
2039 der_tag(char *buf, size_t len, uint32_t tag)
2043 strlcpy(buf, der__tag[tag], len);
2045 snprintf(buf, len, "%#x", tag);
2048 der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
2062 snprintf(buf + z, blen - z, "%.2x", d[i]);
2080 der_tag(buf, sizeof(buf), tag), len);
2349 char *buf;
2473 -bad_link(struct magic_set *ms, int err, char *buf)
2483 - "broken symbolic link to %s", buf);
2486 - if (file_printf(ms, "broken symbolic link to %s", buf) == -1)
2509 - char buf[BUFSIZ+4];
2724 - if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
2742 - buf[nch] = '\0'; /* readlink(2) does not do this */
2745 - if (*buf == '/') {
2746 - if (stat(buf, &tstatbuf) < 0)
2747 - return bad_link(ms, errno, buf);
2753 - tmp = buf; /* in current directory anyway */
2758 - "path too long: `%s'", buf);
2776 - (void)strlcat(buf2, buf, sizeof buf2);
2780 - return bad_link(ms, errno, buf);
2787 - p = magic_file(ms, buf);
2797 - COMMA, buf) == -1)
2839 - char *buf, *newstr;
2845 - len = vasprintf(&buf, fmt, ap);
2849 - if (ms->o.buf != NULL) {
2850 - len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
2851 - free(buf);
2854 - free(ms->o.buf);
2855 - buf = newstr;
2857 - ms->o.buf = buf;
2873 + char *buf = NULL, *newstr;
2877 + len = vspprintf(&buf, 0, fmt, ap);
2881 + if (ms->o.buf != NULL) {
2882 + len = spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
2883 + if (buf) {
2884 + efree(buf);
2886 + efree(ms->o.buf);
2887 + ms->o.buf = newstr;
2889 + ms->o.buf = buf;
2903 + char *buf = NULL;
2909 - free(ms->o.buf);
2910 + efree(ms->o.buf);
2911 ms->o.buf = NULL;
2914 - if (ms->o.buf && *ms->o.buf)
2920 + vspprintf(&buf, 0, f, va);
2924 + file_printf(ms, "%s (%s)", (*buf ? buf : ""), strerror(error));
2925 + } else if (*buf) {
2926 + file_printf(ms, "%s", buf);
2929 + if (buf) {
2930 + efree(buf);
2949 - const void *buf, size_t nb)
2950 +file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const void *buf,
2962 buffer_init(&b, fd, buf, nb);
3026 if (ms->o.buf) {
3027 - free(ms->o.buf);
3028 + efree(ms->o.buf);
3029 ms->o.buf = NULL;
3070 - while (file_regexec(&rx, ms->o.buf, 1, &rm, 0) == 0) {
3071 - ms->o.buf[rm.rm_so] = '\0';
3073 - rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
3111 + res = php_pcre_replace_impl(pce, NULL, ms->o.buf, strlen(ms->o.buf), repl, -1, &rep_cnt);
3130 + strncpy(ms->o.buf, ZSTR_VAL(res), ZSTR_LEN(res));
3131 + ms->o.buf[ZSTR_LEN(res)] = '\0';
3168 pb->buf = ms->o.buf;
3173 - free(pb->buf);
3175 + efree(pb->buf);
3181 ms->o.buf = pb->buf;
3499 unsigned char *buf;
3519 - if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
3520 + if ((buf = CAST(unsigned char *, emalloc(ms->bytes_max + SLOP))) == NULL)
3600 - while ((r = sread(fd, (void *)&buf[nbytes],
3621 - if ((nbytes = read(fd, (char *)buf, howmany)) == -1) {
3629 + if ((nbytes = php_stream_read(stream, (char *)buf, ms->bytes_max - nbytes)) < 0) {
3634 (void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
3635 - if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
3636 + if (file_buffer(ms, stream, inname, buf, (size_t)nbytes) == -1)
3640 - free(buf);
3645 + efree(buf);
3656 - if (file_buffer(ms, -1, NULL, buf, nb) == -1) {
3657 + if (file_buffer(ms, NULL, NULL, buf, nb) == -1) {
3755 - pp = asctime_r(tm, buf);
3756 + pp = php_asctime_r(tm, buf);
3842 cdf_u16tos8(buf, ce[i].ce_namlen, ce[i].ce_name),
3865 format_clsid(char *buf, size_t len, const uint64_t uuid[2]) {
3866 - snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4"
3867 + snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4"
3875 return buf;
4009 varexpand(char *buf, size_t len, const struct buffer *b, const char *str)