Lines Matching refs:fp

161 static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp) /* {{{ */  in phar_tar_process_metadata()  argument
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()
492 php_stream_close(fp); in phar_parse_tarfile()
510 if (FAILURE == phar_tar_process_metadata(newentry, fp)) { 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()
593 } while (!php_stream_eof(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()
702 struct _phar_pass_tar_info *fp = (struct _phar_pass_tar_info *)argument; in phar_tar_writeheaders_int() local
724 if (fp->error) { in phar_tar_writeheaders_int()
725 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders_int()
734 if (fp->error) { in phar_tar_writeheaders_int()
735 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too long fo… in phar_tar_writeheaders_int()
748 if (fp->error) { in phar_tar_writeheaders_int()
749 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, filename \"%s\" is too large f… in phar_tar_writeheaders_int()
755 if (fp->error) { in phar_tar_writeheaders_int()
756 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, file modification time of file… in phar_tar_writeheaders_int()
766 if (fp->error) { in phar_tar_writeheaders_int()
767 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, link \"%s\" is too long for fo… in phar_tar_writeheaders_int()
779 if (fp->error) { in phar_tar_writeheaders_int()
780 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, checksum of file \"%s\" is too… in phar_tar_writeheaders_int()
786 entry->header_offset = php_stream_tell(fp->new); in phar_tar_writeheaders_int()
788 if (sizeof(header) != php_stream_write(fp->new, (char *) &header, sizeof(header))) { in phar_tar_writeheaders_int()
789 if (fp->error) { in phar_tar_writeheaders_int()
790 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, header for file \"%s\" could … in phar_tar_writeheaders_int()
795 pos = php_stream_tell(fp->new); /* save start of file within tar */ in phar_tar_writeheaders_int()
799 if (FAILURE == phar_open_entry_fp(entry, fp->error, 0)) { in phar_tar_writeheaders_int()
804 if (fp->error) { in phar_tar_writeheaders_int()
805 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders_int()
810 …if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0), fp->new, entry->uncompressed_f… in phar_tar_writeheaders_int()
811 if (fp->error) { in phar_tar_writeheaders_int()
812 …spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could … in phar_tar_writeheaders_int()
818 …php_stream_write(fp->new, padding, ((entry->uncompressed_filesize +511)&~511) - entry->uncompresse… in phar_tar_writeheaders_int()
825 fp->free_fp = 0; in phar_tar_writeheaders_int()
828 fp->free_ufp = 0; in phar_tar_writeheaders_int()
836 if (entry->fp_type == PHAR_MOD && entry->fp != entry->phar->fp && entry->fp != entry->phar->ufp) { in phar_tar_writeheaders_int()
838 php_stream_close(entry->fp); in phar_tar_writeheaders_int()
840 entry->fp = NULL; in phar_tar_writeheaders_int()
871 if (entry->fp && entry->fp_type == PHAR_MOD) { in phar_tar_setmetadata()
872 php_stream_close(entry->fp); in phar_tar_setmetadata()
877 entry->fp = php_stream_fopen_tmpfile(); in phar_tar_setmetadata()
879 if (entry->fp == NULL) { in phar_tar_setmetadata()
883 …if (ZSTR_LEN(entry->metadata_str.s) != php_stream_write(entry->fp, ZSTR_VAL(entry->metadata_str.s)… in phar_tar_setmetadata()
967 entry.fp = NULL; in phar_tar_flush()
985 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
986 if (entry.fp == NULL) { in phar_tar_flush()
991 if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { in phar_tar_flush()
995 php_stream_close(entry.fp); in phar_tar_flush()
1006 php_stream_close(entry.fp); in phar_tar_flush()
1074 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1075 if (entry.fp == NULL) { in phar_tar_flush()
1081 if ((size_t)len != php_stream_write(entry.fp, user_stub, len) in phar_tar_flush()
1082 || 5 != php_stream_write(entry.fp, " ?>\r\n", 5)) { in phar_tar_flush()
1089 php_stream_close(entry.fp); in phar_tar_flush()
1102 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1103 if (entry.fp == NULL) { in phar_tar_flush()
1107 if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { in phar_tar_flush()
1108 php_stream_close(entry.fp); in phar_tar_flush()
1122 php_stream_close(entry.fp); in phar_tar_flush()
1130 php_stream_close(entry.fp); in phar_tar_flush()
1135 php_stream_close(entry.fp); in phar_tar_flush()
1145 if (phar->fp && !phar->is_brandnew) { in phar_tar_flush()
1146 oldfile = phar->fp; in phar_tar_flush()
1240 entry.fp = php_stream_fopen_tmpfile(); in phar_tar_flush()
1241 if (entry.fp == NULL) { in phar_tar_flush()
1257 …if (8 != (int)php_stream_write(entry.fp, sigbuf, 8) || signature_length != (int)php_stream_write(e… in phar_tar_flush()
1300 if (phar->fp && pass.free_fp) { in phar_tar_flush()
1301 php_stream_close(phar->fp); in phar_tar_flush()
1316 phar->fp = newfile; in phar_tar_flush()
1318 …phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, … in phar_tar_flush()
1319 if (!phar->fp) { in phar_tar_flush()
1320 phar->fp = newfile; in phar_tar_flush()
1338 …lter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp)); in phar_tar_flush()
1343 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1351 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1352 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1355 php_stream_close(phar->fp); in phar_tar_flush()
1357 phar->fp = newfile; in phar_tar_flush()
1361 filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp)); in phar_tar_flush()
1362 php_stream_filter_append(&phar->fp->writefilters, filter); in phar_tar_flush()
1363 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()
1366 php_stream_close(phar->fp); in phar_tar_flush()
1368 phar->fp = newfile; in phar_tar_flush()
1370 php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); in phar_tar_flush()