Lines Matching refs:stream

100 static struct gfxinfo *php_handle_gif (php_stream * stream)  in php_handle_gif()  argument
105 if (php_stream_seek(stream, 3, SEEK_CUR)) in php_handle_gif()
108 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_gif()
122 static struct gfxinfo *php_handle_psd (php_stream * stream) in php_handle_psd() argument
127 if (php_stream_seek(stream, 11, SEEK_CUR)) in php_handle_psd()
130 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_psd()
142 static struct gfxinfo *php_handle_bmp (php_stream * stream) in php_handle_bmp() argument
148 if (php_stream_seek(stream, 11, SEEK_CUR)) in php_handle_bmp()
151 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_bmp()
192 static struct gfxinfo *php_handle_swc(php_stream * stream) in php_handle_swc() argument
204 if (php_stream_seek(stream, 5, SEEK_CUR)) { in php_handle_swc()
208 if (php_stream_read(stream, (char *) a, sizeof(a)) != sizeof(a)) { in php_handle_swc()
216 if (php_stream_seek(stream, 8, SEEK_SET)) { in php_handle_swc()
221 bufz = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0); in php_handle_swc()
273 static struct gfxinfo *php_handle_swf (php_stream * stream) in php_handle_swf() argument
279 if (php_stream_seek(stream, 5, SEEK_CUR)) in php_handle_swf()
282 if (php_stream_read(stream, (char*)a, sizeof(a)) != sizeof(a)) in php_handle_swf()
299 static struct gfxinfo *php_handle_png (php_stream * stream) in php_handle_png() argument
312 if (php_stream_seek(stream, 8, SEEK_CUR)) in php_handle_png()
315 if((php_stream_read(stream, (char*)dim, sizeof(dim))) < sizeof(dim)) in php_handle_png()
366 static unsigned short php_read2(php_stream * stream) in php_read2() argument
371 if((php_stream_read(stream, (char *) a, sizeof(a))) < sizeof(a)) return 0; in php_read2()
379 static unsigned int php_next_marker(php_stream * stream, int last_marker, int ff_read) in php_next_marker() argument
387 while ((marker = php_stream_getc(stream)) != 0xff) { in php_next_marker()
399 if ((marker = php_stream_getc(stream)) == EOF) in php_next_marker()
415 static int php_skip_variable(php_stream * stream) in php_skip_variable() argument
417 zend_off_t length = ((unsigned int)php_read2(stream)); in php_skip_variable()
423 php_stream_seek(stream, (zend_long)length, SEEK_CUR); in php_skip_variable()
428 static size_t php_read_stream_all_chunks(php_stream *stream, char *buffer, size_t length) in php_read_stream_all_chunks() argument
432 ssize_t read_now = php_stream_read(stream, buffer, length - read_total); in php_read_stream_all_chunks()
434 if (read_now < stream->chunk_size && read_total != length) { in php_read_stream_all_chunks()
443 static int php_read_APP(php_stream * stream, unsigned int marker, zval *info) in php_read_APP() argument
450 length = php_read2(stream); in php_read_APP()
458 if (php_read_stream_all_chunks(stream, buffer, length) != length) { in php_read_APP()
477 static struct gfxinfo *php_handle_jpeg (php_stream * stream, zval *info) in php_handle_jpeg() argument
484 marker = php_next_marker(stream, marker, ff_read); in php_handle_jpeg()
503 length = php_read2(stream); in php_handle_jpeg()
504 result->bits = php_stream_getc(stream); in php_handle_jpeg()
505 result->height = php_read2(stream); in php_handle_jpeg()
506 result->width = php_read2(stream); in php_handle_jpeg()
507 result->channels = php_stream_getc(stream); in php_handle_jpeg()
511 if (php_stream_seek(stream, length - 8, SEEK_CUR)) { /* file error after info */ in php_handle_jpeg()
515 if (!php_skip_variable(stream)) { in php_handle_jpeg()
538 if (!php_read_APP(stream, marker, info)) { /* read all the app marks... */ in php_handle_jpeg()
542 if (!php_skip_variable(stream)) { in php_handle_jpeg()
553 if (!php_skip_variable(stream)) { /* anything else isn't interesting */ in php_handle_jpeg()
565 static unsigned int php_read4(php_stream * stream) in php_read4() argument
570 if ((php_stream_read(stream, (char*)a, sizeof(a))) != sizeof(a)) return 0; in php_read4()
605 static struct gfxinfo *php_handle_jpc(php_stream * stream) in php_handle_jpc() argument
620 first_marker_id = php_stream_getc(stream); in php_handle_jpc()
630 php_read2(stream); /* Lsiz */ in php_handle_jpc()
631 php_read2(stream); /* Rsiz */ in php_handle_jpc()
632 result->width = php_read4(stream); /* Xsiz */ in php_handle_jpc()
633 result->height = php_read4(stream); /* Ysiz */ in php_handle_jpc()
636 php_read4(stream); /* XOsiz */ in php_handle_jpc()
637 php_read4(stream); /* YOsiz */ in php_handle_jpc()
638 php_read4(stream); /* XTsiz */ in php_handle_jpc()
639 php_read4(stream); /* YTsiz */ in php_handle_jpc()
640 php_read4(stream); /* XTOsiz */ in php_handle_jpc()
641 php_read4(stream); /* YTOsiz */ in php_handle_jpc()
643 if (php_stream_seek(stream, 24, SEEK_CUR)) { in php_handle_jpc()
649 result->channels = php_read2(stream); /* Csiz */ in php_handle_jpc()
650 if ((result->channels == 0 && php_stream_eof(stream)) || result->channels > 256) { in php_handle_jpc()
658 bit_depth = php_stream_getc(stream); /* Ssiz[i] */ in php_handle_jpc()
664 php_stream_getc(stream); /* XRsiz[i] */ in php_handle_jpc()
665 php_stream_getc(stream); /* YRsiz[i] */ in php_handle_jpc()
676 static struct gfxinfo *php_handle_jp2(php_stream *stream) in php_handle_jp2() argument
694 box_length = php_read4(stream); /* LBox */ in php_handle_jp2()
696 if (php_stream_read(stream, (void *)&box_type, sizeof(box_type)) != sizeof(box_type)) { in php_handle_jp2()
709 php_stream_seek(stream, 3, SEEK_CUR); in php_handle_jp2()
711 result = php_handle_jpc(stream); in php_handle_jp2()
721 if (php_stream_seek(stream, box_length - 8, SEEK_CUR)) { in php_handle_jp2()
802 static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int motorola_intel) in php_handle_tiff() argument
811 if (php_stream_read(stream, ifd_ptr, 4) != 4) in php_handle_tiff()
814 if (php_stream_seek(stream, ifd_addr-8, SEEK_CUR)) in php_handle_tiff()
818 if (php_stream_read(stream, ifd_data, 2) != 2) { in php_handle_tiff()
826 if (php_stream_read(stream, ifd_data+2, dir_size-2) != dir_size-2) { in php_handle_tiff()
882 static struct gfxinfo *php_handle_iff(php_stream * stream) in php_handle_iff() argument
890 if (php_stream_read(stream, (char *) a, 8) != 8) { in php_handle_iff()
899 if (php_stream_read(stream, (char*)a, 8) != 8) { in php_handle_iff()
911 if (size < 9 || php_stream_read(stream, (char*)a, 9) != 9) { in php_handle_iff()
926 if (php_stream_seek(stream, size, SEEK_CUR)) { in php_handle_iff()
943 static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check) in php_get_wbmp() argument
947 if (php_stream_rewind(stream)) { in php_get_wbmp()
952 if (php_stream_getc(stream) != 0) { in php_get_wbmp()
958 i = php_stream_getc(stream); in php_get_wbmp()
966 i = php_stream_getc(stream); in php_get_wbmp()
979 i = php_stream_getc(stream); in php_get_wbmp()
1004 static struct gfxinfo *php_handle_wbmp(php_stream * stream) in php_handle_wbmp() argument
1008 if (!php_get_wbmp(stream, &result, 0)) { in php_handle_wbmp()
1018 static int php_get_xbm(php_stream *stream, struct gfxinfo **result) in php_get_xbm() argument
1029 if (php_stream_rewind(stream)) { in php_get_xbm()
1032 while ((fline=php_stream_gets(stream, NULL, 0)) != NULL) { in php_get_xbm()
1077 static struct gfxinfo *php_handle_xbm(php_stream * stream) in php_handle_xbm() argument
1080 php_get_xbm(stream, &result); in php_handle_xbm()
1086 static struct gfxinfo *php_handle_ico(php_stream * stream) in php_handle_ico() argument
1092 if (php_stream_read(stream, (char *) dim, 2) != 2) in php_handle_ico()
1104 if (php_stream_read(stream, (char *) dim, sizeof(dim)) != sizeof(dim)) in php_handle_ico()
1127 static struct gfxinfo *php_handle_webp(php_stream * stream) in php_handle_webp() argument
1134 if (php_stream_read(stream, (char *) buf, 18) != 18) in php_handle_webp()
1176 static struct gfxinfo *php_handle_avif(php_stream * stream) { in php_handle_avif() argument
1213 bool php_is_image_avif(php_stream * stream) { in php_is_image_avif() argument
1217 ZEND_ASSERT(stream != NULL); in php_is_image_avif()
1219 if (php_stream_read(stream, (char *) &header_size_reversed, 4) != 4) { in php_is_image_avif()
1226 if (php_stream_read(stream, box_type, 4) != 4) { in php_is_image_avif()
1235 if (php_stream_read(stream, brand, 4) != 4) { in php_is_image_avif()
1244 if (php_stream_read(stream, brand, 4) != 4) { in php_is_image_avif()
1252 if (php_stream_read(stream, brand, 4) != 4) { in php_is_image_avif()
1399 PHPAPI int php_getimagetype(php_stream *stream, const char *input, char *filetype) in php_getimagetype() argument
1405 if((php_stream_read(stream, filetype, 3)) != 3) { in php_getimagetype()
1416 if (php_stream_read(stream, filetype+3, 5) != 5) { in php_getimagetype()
1437 if (php_stream_read(stream, filetype+3, 9) != 9) { in php_getimagetype()
1448 if (php_stream_read(stream, filetype+3, 1) != 1) { in php_getimagetype()
1464 twelve_bytes_read = (php_stream_read(stream, filetype+4, 8) == 8); in php_getimagetype()
1471 if (!php_stream_rewind(stream) && php_is_image_avif(stream)) { in php_getimagetype()
1476 if (php_get_wbmp(stream, NULL, 1)) { in php_getimagetype()
1485 if (php_get_xbm(stream, NULL)) { in php_getimagetype()
1493 static void php_getimagesize_from_stream(php_stream *stream, char *input, zval *info, INTERNAL_FUNC… in php_getimagesize_from_stream() argument
1498 if (!stream) { in php_getimagesize_from_stream()
1502 itype = php_getimagetype(stream, input, NULL); in php_getimagesize_from_stream()
1505 result = php_handle_gif(stream); in php_getimagesize_from_stream()
1509 result = php_handle_jpeg(stream, info); in php_getimagesize_from_stream()
1511 result = php_handle_jpeg(stream, NULL); in php_getimagesize_from_stream()
1515 result = php_handle_png(stream); in php_getimagesize_from_stream()
1518 result = php_handle_swf(stream); in php_getimagesize_from_stream()
1522 result = php_handle_swc(stream); in php_getimagesize_from_stream()
1528 result = php_handle_psd(stream); in php_getimagesize_from_stream()
1531 result = php_handle_bmp(stream); in php_getimagesize_from_stream()
1534 result = php_handle_tiff(stream, NULL, 0); in php_getimagesize_from_stream()
1537 result = php_handle_tiff(stream, NULL, 1); in php_getimagesize_from_stream()
1540 result = php_handle_jpc(stream); in php_getimagesize_from_stream()
1543 result = php_handle_jp2(stream); in php_getimagesize_from_stream()
1546 result = php_handle_iff(stream); in php_getimagesize_from_stream()
1549 result = php_handle_wbmp(stream); in php_getimagesize_from_stream()
1552 result = php_handle_xbm(stream); in php_getimagesize_from_stream()
1555 result = php_handle_ico(stream); in php_getimagesize_from_stream()
1558 result = php_handle_webp(stream); in php_getimagesize_from_stream()
1561 result = php_handle_avif(stream); in php_getimagesize_from_stream()
1596 php_stream *stream = NULL; in php_getimagesize_from_any() local
1619stream = php_stream_open_wrapper(ZSTR_VAL(input), "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH… in php_getimagesize_from_any()
1621 stream = php_stream_memory_open(TEMP_STREAM_READONLY, input); in php_getimagesize_from_any()
1624 if (!stream) { in php_getimagesize_from_any()
1628 php_getimagesize_from_stream(stream, ZSTR_VAL(input), info, INTERNAL_FUNCTION_PARAM_PASSTHRU); in php_getimagesize_from_any()
1629 php_stream_close(stream); in php_getimagesize_from_any()