Lines Matching refs:fp
161 static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ in phar_tar_process_metadata()
164 size_t save = php_stream_tell(fp), read; in phar_tar_process_metadata()
169 read = php_stream_read(fp, metadata, entry->uncompressed_filesize); in phar_tar_process_metadata()
172 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
179 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
193 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
205 int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar… in phar_parse_tarfile() argument
220 php_stream_seek(fp, 0, SEEK_END); in phar_parse_tarfile()
221 totalsize = php_stream_tell(fp); in phar_parse_tarfile()
222 php_stream_seek(fp, 0, SEEK_SET); in phar_parse_tarfile()
223 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
229 php_stream_close(fp); in phar_parse_tarfile()
257 pos = php_stream_tell(fp); in phar_parse_tarfile()
283 php_stream_close(fp); in phar_parse_tarfile()
287 curloc = php_stream_tell(fp); in phar_parse_tarfile()
288 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
305 …if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf … in phar_parse_tarfile()
313 php_stream_seek(fp, curloc + 512, SEEK_SET); in phar_parse_tarfile()
317 php_stream_seek(fp, 512, SEEK_CUR); in phar_parse_tarfile()
318 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
322 php_stream_close(fp); in phar_parse_tarfile()
328 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
334 php_stream_close(fp); in phar_parse_tarfile()
363 php_stream_close(fp); in phar_parse_tarfile()
369 read = php_stream_read(fp, entry.filename, entry.filename_len); in phar_parse_tarfile()
375 php_stream_close(fp); in phar_parse_tarfile()
385 php_stream_seek(fp, size, SEEK_CUR); in phar_parse_tarfile()
386 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
391 php_stream_close(fp); in phar_parse_tarfile()
396 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
403 php_stream_close(fp); in phar_parse_tarfile()
460 php_stream_close(fp); in phar_parse_tarfile()
494 php_stream_close(fp); in phar_parse_tarfile()
512 if (FAILURE == phar_tar_process_metadata(newentry, fp TSRMLS_CC)) { in phar_parse_tarfile()
516 php_stream_close(fp); in phar_parse_tarfile()
528 php_stream_close(fp); in phar_parse_tarfile()
533 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
549 php_stream_close(fp); in phar_parse_tarfile()
557 php_stream_seek(fp, pos, SEEK_SET); in phar_parse_tarfile()
563 php_stream_close(fp); in phar_parse_tarfile()
574 php_stream_seek(fp, size, SEEK_CUR); in phar_parse_tarfile()
575 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
579 php_stream_close(fp); in phar_parse_tarfile()
585 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
591 php_stream_close(fp); in phar_parse_tarfile()
605 php_stream_close(fp); in phar_parse_tarfile()
618 myphar->fp = fp; in phar_parse_tarfile()
637 php_stream_close(fp); in phar_parse_tarfile()
705 struct _phar_pass_tar_info *fp = (struct _phar_pass_tar_info *)argument; in phar_tar_writeheaders() local
727 if (fp->error) { in phar_tar_writeheaders()
728 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
737 if (fp->error) { in phar_tar_writeheaders()
738 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
751 if (fp->error) { in phar_tar_writeheaders()
752 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too large f… in phar_tar_writeheaders()
758 if (fp->error) { in phar_tar_writeheaders()
759 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, file modification time of file… in phar_tar_writeheaders()
777 if (fp->error) { in phar_tar_writeheaders()
778 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, checksum of file \"%s\" is too… in phar_tar_writeheaders()
784 entry->header_offset = php_stream_tell(fp->new); in phar_tar_writeheaders()
786 if (sizeof(header) != php_stream_write(fp->new, (char *) &header, sizeof(header))) { in phar_tar_writeheaders()
787 if (fp->error) { in phar_tar_writeheaders()
788 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, header for file \"%s\" could … in phar_tar_writeheaders()
793 pos = php_stream_tell(fp->new); /* save start of file within tar */ in phar_tar_writeheaders()
797 if (FAILURE == phar_open_entry_fp(entry, fp->error, 0 TSRMLS_CC)) { in phar_tar_writeheaders()
802 if (fp->error) { in phar_tar_writeheaders()
803 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
808 …if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->unco… in phar_tar_writeheaders()
809 if (fp->error) { in phar_tar_writeheaders()
810 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
816 …php_stream_write(fp->new, padding, ((entry->uncompressed_filesize +511)&~511) - entry->uncompresse… in phar_tar_writeheaders()
823 fp->free_fp = 0; in phar_tar_writeheaders()
826 fp->free_ufp = 0; in phar_tar_writeheaders()
834 if (entry->fp_type == PHAR_MOD && entry->fp != entry->phar->fp && entry->fp != entry->phar->ufp) { in phar_tar_writeheaders()
836 php_stream_close(entry->fp); in phar_tar_writeheaders()
838 entry->fp = NULL; in phar_tar_writeheaders()
864 if (entry->fp && entry->fp_type == PHAR_MOD) { in phar_tar_setmetadata()
865 php_stream_close(entry->fp); in phar_tar_setmetadata()
870 entry->fp = php_stream_fopen_tmpfile(); in phar_tar_setmetadata()
872 if (entry->fp == NULL) { in phar_tar_setmetadata()
876 …if (entry->metadata_str.len != php_stream_write(entry->fp, entry->metadata_str.c, entry->metadata_… in phar_tar_setmetadata()
979 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
980 if (entry.fp == NULL) { in phar_tar_flush()
984 if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { in phar_tar_flush()
1047 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1048 if (entry.fp == NULL) { in phar_tar_flush()
1054 if ((size_t)len != php_stream_write(entry.fp, user_stub, len) in phar_tar_flush()
1055 || 5 != php_stream_write(entry.fp, " ?>\r\n", 5)) { in phar_tar_flush()
1062 php_stream_close(entry.fp); in phar_tar_flush()
1075 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1076 if (entry.fp == NULL) { in phar_tar_flush()
1080 if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { in phar_tar_flush()
1081 php_stream_close(entry.fp); in phar_tar_flush()
1095 php_stream_close(entry.fp); in phar_tar_flush()
1103 php_stream_close(entry.fp); in phar_tar_flush()
1108 php_stream_close(entry.fp); in phar_tar_flush()
1118 if (phar->fp && !phar->is_brandnew) { in phar_tar_flush()
1119 oldfile = phar->fp; in phar_tar_flush()
1213 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1214 if (entry.fp == NULL) { in phar_tar_flush()
1230 …if (8 != (int)php_stream_write(entry.fp, sigbuf, 8) || signature_length != (int)php_stream_write(e… in phar_tar_flush()
1273 if (phar->fp && pass.free_fp) { in phar_tar_flush()
1274 php_stream_close(phar->fp); in phar_tar_flush()
1289 phar->fp = newfile; in phar_tar_flush()
1291 …phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, … in phar_tar_flush()
1292 if (!phar->fp) { in phar_tar_flush()
1293 phar->fp = newfile; in phar_tar_flush()
1311 …_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); in phar_tar_flush()
1316 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1324 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1325 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1328 php_stream_close(phar->fp); in phar_tar_flush()
1330 phar->fp = newfile; in phar_tar_flush()
1334 …filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRML… in phar_tar_flush()
1335 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1336 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1339 php_stream_close(phar->fp); in phar_tar_flush()
1341 phar->fp = newfile; in phar_tar_flush()
1343 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()