Lines Matching refs:fp
158 static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ in phar_tar_process_metadata()
161 size_t save = php_stream_tell(fp), read; in phar_tar_process_metadata()
166 read = php_stream_read(fp, metadata, entry->uncompressed_filesize); in phar_tar_process_metadata()
169 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
176 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
190 php_stream_seek(fp, save, SEEK_SET); in phar_tar_process_metadata()
195 int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar… in phar_parse_tarfile() argument
209 php_stream_seek(fp, 0, SEEK_END); in phar_parse_tarfile()
210 totalsize = php_stream_tell(fp); in phar_parse_tarfile()
211 php_stream_seek(fp, 0, SEEK_SET); in phar_parse_tarfile()
212 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
218 php_stream_close(fp); in phar_parse_tarfile()
246 pos = php_stream_tell(fp); in phar_parse_tarfile()
266 php_stream_close(fp); in phar_parse_tarfile()
270 curloc = php_stream_tell(fp); in phar_parse_tarfile()
271 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
288 …if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf … in phar_parse_tarfile()
296 php_stream_seek(fp, curloc + 512, SEEK_SET); in phar_parse_tarfile()
300 php_stream_seek(fp, 512, SEEK_CUR); in phar_parse_tarfile()
301 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
305 php_stream_close(fp); in phar_parse_tarfile()
311 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
317 php_stream_close(fp); in phar_parse_tarfile()
346 php_stream_close(fp); in phar_parse_tarfile()
352 read = php_stream_read(fp, entry.filename, entry.filename_len); in phar_parse_tarfile()
358 php_stream_close(fp); in phar_parse_tarfile()
368 php_stream_seek(fp, size, SEEK_CUR); in phar_parse_tarfile()
369 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
374 php_stream_close(fp); in phar_parse_tarfile()
379 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
386 php_stream_close(fp); in phar_parse_tarfile()
443 php_stream_close(fp); in phar_parse_tarfile()
475 php_stream_close(fp); in phar_parse_tarfile()
491 if (FAILURE == phar_tar_process_metadata(newentry, fp TSRMLS_CC)) { in phar_parse_tarfile()
495 php_stream_close(fp); in phar_parse_tarfile()
507 php_stream_close(fp); in phar_parse_tarfile()
512 read = php_stream_read(fp, buf, size); in phar_parse_tarfile()
528 php_stream_close(fp); in phar_parse_tarfile()
536 php_stream_seek(fp, pos, SEEK_SET); in phar_parse_tarfile()
542 php_stream_close(fp); in phar_parse_tarfile()
552 php_stream_seek(fp, size, SEEK_CUR); in phar_parse_tarfile()
553 if ((uint)php_stream_tell(fp) > totalsize) { in phar_parse_tarfile()
557 php_stream_close(fp); in phar_parse_tarfile()
563 read = php_stream_read(fp, buf, sizeof(buf)); in phar_parse_tarfile()
569 php_stream_close(fp); in phar_parse_tarfile()
583 php_stream_close(fp); in phar_parse_tarfile()
596 myphar->fp = fp; in phar_parse_tarfile()
615 php_stream_close(fp); in phar_parse_tarfile()
683 struct _phar_pass_tar_info *fp = (struct _phar_pass_tar_info *)argument; in phar_tar_writeheaders() local
705 if (fp->error) { in phar_tar_writeheaders()
706 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
715 if (fp->error) { in phar_tar_writeheaders()
716 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders()
729 if (fp->error) { in phar_tar_writeheaders()
730 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too large f… in phar_tar_writeheaders()
736 if (fp->error) { in phar_tar_writeheaders()
737 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, file modification time of file… in phar_tar_writeheaders()
755 if (fp->error) { in phar_tar_writeheaders()
756 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, checksum of file \"%s\" is too… in phar_tar_writeheaders()
762 entry->header_offset = php_stream_tell(fp->new); in phar_tar_writeheaders()
764 if (sizeof(header) != php_stream_write(fp->new, (char *) &header, sizeof(header))) { in phar_tar_writeheaders()
765 if (fp->error) { in phar_tar_writeheaders()
766 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, header for file \"%s\" could … in phar_tar_writeheaders()
771 pos = php_stream_tell(fp->new); /* save start of file within tar */ in phar_tar_writeheaders()
775 if (FAILURE == phar_open_entry_fp(entry, fp->error, 0 TSRMLS_CC)) { in phar_tar_writeheaders()
780 if (fp->error) { in phar_tar_writeheaders()
781 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
786 …if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->uncomp… in phar_tar_writeheaders()
787 if (fp->error) { in phar_tar_writeheaders()
788 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders()
794 …php_stream_write(fp->new, padding, ((entry->uncompressed_filesize +511)&~511) - entry->uncompresse… in phar_tar_writeheaders()
801 fp->free_fp = 0; in phar_tar_writeheaders()
804 fp->free_ufp = 0; in phar_tar_writeheaders()
812 if (entry->fp_type == PHAR_MOD && entry->fp != entry->phar->fp && entry->fp != entry->phar->ufp) { in phar_tar_writeheaders()
814 php_stream_close(entry->fp); in phar_tar_writeheaders()
816 entry->fp = NULL; in phar_tar_writeheaders()
842 if (entry->fp && entry->fp_type == PHAR_MOD) { in phar_tar_setmetadata()
843 php_stream_close(entry->fp); in phar_tar_setmetadata()
848 entry->fp = php_stream_fopen_tmpfile(); in phar_tar_setmetadata()
850 if (entry->fp == NULL) { in phar_tar_setmetadata()
854 …if (entry->metadata_str.len != php_stream_write(entry->fp, entry->metadata_str.c, entry->metadata_… in phar_tar_setmetadata()
954 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
955 if (entry.fp == NULL) { in phar_tar_flush()
959 if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { in phar_tar_flush()
1022 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1023 if (entry.fp == NULL) { in phar_tar_flush()
1029 if ((size_t)len != php_stream_write(entry.fp, user_stub, len) in phar_tar_flush()
1030 || 5 != php_stream_write(entry.fp, " ?>\r\n", 5)) { in phar_tar_flush()
1037 php_stream_close(entry.fp); in phar_tar_flush()
1050 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1051 if (entry.fp == NULL) { in phar_tar_flush()
1055 if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { in phar_tar_flush()
1056 php_stream_close(entry.fp); in phar_tar_flush()
1070 php_stream_close(entry.fp); in phar_tar_flush()
1078 php_stream_close(entry.fp); in phar_tar_flush()
1083 php_stream_close(entry.fp); in phar_tar_flush()
1093 if (phar->fp && !phar->is_brandnew) { in phar_tar_flush()
1094 oldfile = phar->fp; in phar_tar_flush()
1188 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1189 if (entry.fp == NULL) { in phar_tar_flush()
1205 …if (8 != (int)php_stream_write(entry.fp, sigbuf, 8) || signature_length != (int)php_stream_write(e… in phar_tar_flush()
1248 if (phar->fp && pass.free_fp) { in phar_tar_flush()
1249 php_stream_close(phar->fp); in phar_tar_flush()
1264 phar->fp = newfile; in phar_tar_flush()
1266 …phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, … in phar_tar_flush()
1267 if (!phar->fp) { in phar_tar_flush()
1268 phar->fp = newfile; in phar_tar_flush()
1286 …_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); in phar_tar_flush()
1291 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1299 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1300 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1303 php_stream_close(phar->fp); in phar_tar_flush()
1305 phar->fp = newfile; in phar_tar_flush()
1309 …filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRML… in phar_tar_flush()
1310 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1311 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1314 php_stream_close(phar->fp); in phar_tar_flush()
1316 phar->fp = newfile; in phar_tar_flush()
1318 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()