Lines Matching refs:buf
22 static uint32_t phar_tar_number(char *buf, size_t len) /* {{{ */ in phar_tar_number() argument
27 while (i < len && buf[i] == ' ') { in phar_tar_number()
31 while (i < len && buf[i] >= '0' && buf[i] <= '7') { in phar_tar_number()
32 num = num * 8 + (buf[i] - '0'); in phar_tar_number()
65 static int phar_tar_octal(char *buf, uint32_t val, int len) /* {{{ */ in phar_tar_octal() argument
67 char *p = buf; in phar_tar_octal()
87 static uint32_t phar_tar_checksum(char *buf, size_t len) /* {{{ */ in phar_tar_checksum() argument
90 char *end = buf + len; in phar_tar_checksum()
92 while (buf != end) { in phar_tar_checksum()
93 sum += (unsigned char)*buf; in phar_tar_checksum()
94 ++buf; in phar_tar_checksum()
100 int phar_is_tar(char *buf, char *fname) /* {{{ */ in phar_is_tar() argument
102 tar_header *header = (tar_header *) buf; in phar_is_tar()
108 if (!strncmp(buf, "<?php", sizeof("<?php")-1)) { in phar_is_tar()
114 ret = (checksum == phar_tar_checksum(buf, 512)); in phar_is_tar()
215 char buf[512], *actual_alias = NULL, *p; in phar_parse_tarfile() local
231 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
233 if (read != sizeof(buf)) { in phar_parse_tarfile()
241 hdr = (tar_header*)buf; in phar_parse_tarfile()
260 pos += sizeof(buf); in phar_parse_tarfile()
266 hdr = (tar_header*) buf; in phar_parse_tarfile()
268 if (sum1 == 0 && phar_tar_checksum(buf, sizeof(buf)) == 0) { in phar_parse_tarfile()
272 sum2 = phar_tar_checksum(buf, old?sizeof(old_tar_header):sizeof(tar_header)); in phar_parse_tarfile()
297 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
313 myphar->sig_flags = PHAR_GET_32(buf); in phar_parse_tarfile()
314 …_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fnam… in phar_parse_tarfile()
338 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
340 if (read != sizeof(buf)) { in phar_parse_tarfile()
349 hdr = (tar_header*) buf; in phar_parse_tarfile()
352 if (sum1 == 0 && phar_tar_checksum(buf, sizeof(buf)) == 0) { in phar_parse_tarfile()
406 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
408 if (read != sizeof(buf)) { in phar_parse_tarfile()
541 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
544 buf[size] = '\0'; in phar_parse_tarfile()
545 if (!phar_validate_alias(buf, size)) { in phar_parse_tarfile()
547 buf[50] = '.'; in phar_parse_tarfile()
548 buf[51] = '.'; in phar_parse_tarfile()
549 buf[52] = '.'; in phar_parse_tarfile()
550 buf[53] = '\0'; in phar_parse_tarfile()
554 … spprintf(error, 4096, "phar error: invalid alias \"%s\" in tar-based phar \"%s\"", buf, fname); in phar_parse_tarfile()
562 actual_alias = pestrndup(buf, size, myphar->is_persistent); in phar_parse_tarfile()
593 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
595 if (read != sizeof(buf)) { in phar_parse_tarfile()
967 char *buf, *signature, *tmp, sigbuf[8]; in phar_tar_flush() local
1283 buf = (char *) ecalloc(1024, 1); in phar_tar_flush()
1284 php_stream_write(newfile, buf, 1024); in phar_tar_flush()
1285 efree(buf); in phar_tar_flush()