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()
510 if (FAILURE == phar_tar_process_metadata(newentry, fp TSRMLS_CC)) { in phar_parse_tarfile()
514 php_stream_close(fp); in phar_parse_tarfile()
526 php_stream_close(fp); in phar_parse_tarfile()
531 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
547 php_stream_close(fp); in phar_parse_tarfile()
555 php_stream_seek(fp, pos, SEEK_SET); in phar_parse_tarfile()
561 php_stream_close(fp); in phar_parse_tarfile()
572 php_stream_seek(fp, size, SEEK_CUR); in phar_parse_tarfile()
573 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
577 php_stream_close(fp); in phar_parse_tarfile()
583 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
589 php_stream_close(fp); in phar_parse_tarfile()
603 php_stream_close(fp); in phar_parse_tarfile()
616 myphar->fp = fp; in phar_parse_tarfile()
635 php_stream_close(fp); in phar_parse_tarfile()
703 struct _phar_pass_tar_info *fp = (struct _phar_pass_tar_info *)argument; in phar_tar_writeheaders() local
725 if (fp->error) { in phar_tar_writeheaders()
726 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
735 if (fp->error) { in phar_tar_writeheaders()
736 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
749 if (fp->error) { in phar_tar_writeheaders()
750 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too large f… in phar_tar_writeheaders()
756 if (fp->error) { in phar_tar_writeheaders()
757 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, file modification time of file… in phar_tar_writeheaders()
775 if (fp->error) { in phar_tar_writeheaders()
776 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, checksum of file \"%s\" is too… in phar_tar_writeheaders()
782 entry->header_offset = php_stream_tell(fp->new); in phar_tar_writeheaders()
784 if (sizeof(header) != php_stream_write(fp->new, (char *) &header, sizeof(header))) { in phar_tar_writeheaders()
785 if (fp->error) { in phar_tar_writeheaders()
786 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, header for file \"%s\" could … in phar_tar_writeheaders()
791 pos = php_stream_tell(fp->new); /* save start of file within tar */ in phar_tar_writeheaders()
795 if (FAILURE == phar_open_entry_fp(entry, fp->error, 0 TSRMLS_CC)) { in phar_tar_writeheaders()
800 if (fp->error) { in phar_tar_writeheaders()
801 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
806 …if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->uncomp… in phar_tar_writeheaders()
807 if (fp->error) { in phar_tar_writeheaders()
808 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
814 …php_stream_write(fp->new, padding, ((entry->uncompressed_filesize +511)&~511) - entry->uncompresse… in phar_tar_writeheaders()
821 fp->free_fp = 0; in phar_tar_writeheaders()
824 fp->free_ufp = 0; in phar_tar_writeheaders()
832 if (entry->fp_type == PHAR_MOD && entry->fp != entry->phar->fp && entry->fp != entry->phar->ufp) { in phar_tar_writeheaders()
834 php_stream_close(entry->fp); in phar_tar_writeheaders()
836 entry->fp = NULL; in phar_tar_writeheaders()
862 if (entry->fp && entry->fp_type == PHAR_MOD) { in phar_tar_setmetadata()
863 php_stream_close(entry->fp); in phar_tar_setmetadata()
868 entry->fp = php_stream_fopen_tmpfile(); in phar_tar_setmetadata()
870 if (entry->fp == NULL) { in phar_tar_setmetadata()
874 …if (entry->metadata_str.len != php_stream_write(entry->fp, entry->metadata_str.c, entry->metadata_… in phar_tar_setmetadata()
977 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
978 if (entry.fp == NULL) { in phar_tar_flush()
982 if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { in phar_tar_flush()
1045 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1046 if (entry.fp == NULL) { in phar_tar_flush()
1052 if ((size_t)len != php_stream_write(entry.fp, user_stub, len) in phar_tar_flush()
1053 || 5 != php_stream_write(entry.fp, " ?>\r\n", 5)) { in phar_tar_flush()
1060 php_stream_close(entry.fp); in phar_tar_flush()
1073 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1074 if (entry.fp == NULL) { in phar_tar_flush()
1078 if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { in phar_tar_flush()
1079 php_stream_close(entry.fp); in phar_tar_flush()
1093 php_stream_close(entry.fp); in phar_tar_flush()
1101 php_stream_close(entry.fp); in phar_tar_flush()
1106 php_stream_close(entry.fp); in phar_tar_flush()
1116 if (phar->fp && !phar->is_brandnew) { in phar_tar_flush()
1117 oldfile = phar->fp; in phar_tar_flush()
1211 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1212 if (entry.fp == NULL) { in phar_tar_flush()
1228 …if (8 != (int)php_stream_write(entry.fp, sigbuf, 8) || signature_length != (int)php_stream_write(e… in phar_tar_flush()
1271 if (phar->fp && pass.free_fp) { in phar_tar_flush()
1272 php_stream_close(phar->fp); in phar_tar_flush()
1287 phar->fp = newfile; in phar_tar_flush()
1289 …phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, … in phar_tar_flush()
1290 if (!phar->fp) { in phar_tar_flush()
1291 phar->fp = newfile; in phar_tar_flush()
1309 …_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); in phar_tar_flush()
1314 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1322 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1323 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1326 php_stream_close(phar->fp); in phar_tar_flush()
1328 phar->fp = newfile; in phar_tar_flush()
1332 …filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRML… in phar_tar_flush()
1333 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1334 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1337 php_stream_close(phar->fp); in phar_tar_flush()
1339 phar->fp = newfile; in phar_tar_flush()
1341 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()