Lines Matching refs:stream

69 static struct gfxinfo *php_handle_gif (php_stream * stream)  in php_handle_gif()  argument
74 if (php_stream_seek(stream, 3, SEEK_CUR)) in php_handle_gif()
77 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_gif()
91 static struct gfxinfo *php_handle_psd (php_stream * stream) in php_handle_psd() argument
96 if (php_stream_seek(stream, 11, SEEK_CUR)) in php_handle_psd()
99 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_psd()
111 static struct gfxinfo *php_handle_bmp (php_stream * stream) in php_handle_bmp() argument
117 if (php_stream_seek(stream, 11, SEEK_CUR)) in php_handle_bmp()
120 if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim)) in php_handle_bmp()
161 static struct gfxinfo *php_handle_swc(php_stream * stream) in php_handle_swc() argument
173 if (php_stream_seek(stream, 5, SEEK_CUR)) { in php_handle_swc()
177 if (php_stream_read(stream, (char *) a, sizeof(a)) != sizeof(a)) { in php_handle_swc()
185 if (php_stream_seek(stream, 8, SEEK_SET)) { in php_handle_swc()
190 bufz = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0); in php_handle_swc()
242 static struct gfxinfo *php_handle_swf (php_stream * stream) in php_handle_swf() argument
248 if (php_stream_seek(stream, 5, SEEK_CUR)) in php_handle_swf()
251 if (php_stream_read(stream, (char*)a, sizeof(a)) != sizeof(a)) in php_handle_swf()
268 static struct gfxinfo *php_handle_png (php_stream * stream) in php_handle_png() argument
281 if (php_stream_seek(stream, 8, SEEK_CUR)) in php_handle_png()
284 if((php_stream_read(stream, (char*)dim, sizeof(dim))) < sizeof(dim)) in php_handle_png()
335 static unsigned short php_read2(php_stream * stream) in php_read2() argument
340 if((php_stream_read(stream, (char *) a, sizeof(a))) < sizeof(a)) return 0; in php_read2()
348 static unsigned int php_next_marker(php_stream * stream, int last_marker, int ff_read) in php_next_marker() argument
356 while ((marker = php_stream_getc(stream)) != 0xff) { in php_next_marker()
368 if ((marker = php_stream_getc(stream)) == EOF) in php_next_marker()
384 static int php_skip_variable(php_stream * stream) in php_skip_variable() argument
386 zend_off_t length = ((unsigned int)php_read2(stream)); in php_skip_variable()
392 php_stream_seek(stream, (zend_long)length, SEEK_CUR); in php_skip_variable()
397 static size_t php_read_stream_all_chunks(php_stream *stream, char *buffer, size_t length) in php_read_stream_all_chunks() argument
401 ssize_t read_now = php_stream_read(stream, buffer, length - read_total); in php_read_stream_all_chunks()
403 if (read_now < stream->chunk_size && read_total != length) { in php_read_stream_all_chunks()
412 static int php_read_APP(php_stream * stream, unsigned int marker, zval *info) in php_read_APP() argument
419 length = php_read2(stream); in php_read_APP()
427 if (php_read_stream_all_chunks(stream, buffer, length) != length) { in php_read_APP()
446 static struct gfxinfo *php_handle_jpeg (php_stream * stream, zval *info) in php_handle_jpeg() argument
453 marker = php_next_marker(stream, marker, ff_read); in php_handle_jpeg()
472 length = php_read2(stream); in php_handle_jpeg()
473 result->bits = php_stream_getc(stream); in php_handle_jpeg()
474 result->height = php_read2(stream); in php_handle_jpeg()
475 result->width = php_read2(stream); in php_handle_jpeg()
476 result->channels = php_stream_getc(stream); in php_handle_jpeg()
480 if (php_stream_seek(stream, length - 8, SEEK_CUR)) { /* file error after info */ in php_handle_jpeg()
484 if (!php_skip_variable(stream)) { in php_handle_jpeg()
507 if (!php_read_APP(stream, marker, info)) { /* read all the app marks... */ in php_handle_jpeg()
511 if (!php_skip_variable(stream)) { in php_handle_jpeg()
522 if (!php_skip_variable(stream)) { /* anything else isn't interesting */ in php_handle_jpeg()
534 static unsigned int php_read4(php_stream * stream) in php_read4() argument
539 if ((php_stream_read(stream, (char*)a, sizeof(a))) != sizeof(a)) return 0; in php_read4()
574 static struct gfxinfo *php_handle_jpc(php_stream * stream) in php_handle_jpc() argument
589 first_marker_id = php_stream_getc(stream); in php_handle_jpc()
599 php_read2(stream); /* Lsiz */ in php_handle_jpc()
600 php_read2(stream); /* Rsiz */ in php_handle_jpc()
601 result->width = php_read4(stream); /* Xsiz */ in php_handle_jpc()
602 result->height = php_read4(stream); /* Ysiz */ in php_handle_jpc()
605 php_read4(stream); /* XOsiz */ in php_handle_jpc()
606 php_read4(stream); /* YOsiz */ in php_handle_jpc()
607 php_read4(stream); /* XTsiz */ in php_handle_jpc()
608 php_read4(stream); /* YTsiz */ in php_handle_jpc()
609 php_read4(stream); /* XTOsiz */ in php_handle_jpc()
610 php_read4(stream); /* YTOsiz */ in php_handle_jpc()
612 if (php_stream_seek(stream, 24, SEEK_CUR)) { in php_handle_jpc()
618 result->channels = php_read2(stream); /* Csiz */ in php_handle_jpc()
619 if ((result->channels == 0 && php_stream_eof(stream)) || result->channels > 256) { in php_handle_jpc()
627 bit_depth = php_stream_getc(stream); /* Ssiz[i] */ in php_handle_jpc()
633 php_stream_getc(stream); /* XRsiz[i] */ in php_handle_jpc()
634 php_stream_getc(stream); /* YRsiz[i] */ in php_handle_jpc()
645 static struct gfxinfo *php_handle_jp2(php_stream *stream) in php_handle_jp2() argument
663 box_length = php_read4(stream); /* LBox */ in php_handle_jp2()
665 if (php_stream_read(stream, (void *)&box_type, sizeof(box_type)) != sizeof(box_type)) { in php_handle_jp2()
678 php_stream_seek(stream, 3, SEEK_CUR); in php_handle_jp2()
680 result = php_handle_jpc(stream); in php_handle_jp2()
690 if (php_stream_seek(stream, box_length - 8, SEEK_CUR)) { in php_handle_jp2()
771 static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int motorola_intel) in php_handle_tiff() argument
780 if (php_stream_read(stream, ifd_ptr, 4) != 4) in php_handle_tiff()
783 if (php_stream_seek(stream, ifd_addr-8, SEEK_CUR)) in php_handle_tiff()
787 if (php_stream_read(stream, ifd_data, 2) != 2) { in php_handle_tiff()
795 if (php_stream_read(stream, ifd_data+2, dir_size-2) != dir_size-2) { in php_handle_tiff()
851 static struct gfxinfo *php_handle_iff(php_stream * stream) in php_handle_iff() argument
859 if (php_stream_read(stream, (char *) a, 8) != 8) { in php_handle_iff()
868 if (php_stream_read(stream, (char*)a, 8) != 8) { in php_handle_iff()
880 if (size < 9 || php_stream_read(stream, (char*)a, 9) != 9) { in php_handle_iff()
895 if (php_stream_seek(stream, size, SEEK_CUR)) { in php_handle_iff()
912 static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check) in php_get_wbmp() argument
916 if (php_stream_rewind(stream)) { in php_get_wbmp()
921 if (php_stream_getc(stream) != 0) { in php_get_wbmp()
927 i = php_stream_getc(stream); in php_get_wbmp()
935 i = php_stream_getc(stream); in php_get_wbmp()
948 i = php_stream_getc(stream); in php_get_wbmp()
973 static struct gfxinfo *php_handle_wbmp(php_stream * stream) in php_handle_wbmp() argument
977 if (!php_get_wbmp(stream, &result, 0)) { in php_handle_wbmp()
987 static int php_get_xbm(php_stream *stream, struct gfxinfo **result) in php_get_xbm() argument
998 if (php_stream_rewind(stream)) { in php_get_xbm()
1001 while ((fline=php_stream_gets(stream, NULL, 0)) != NULL) { in php_get_xbm()
1046 static struct gfxinfo *php_handle_xbm(php_stream * stream) in php_handle_xbm() argument
1049 php_get_xbm(stream, &result); in php_handle_xbm()
1055 static struct gfxinfo *php_handle_ico(php_stream * stream) in php_handle_ico() argument
1061 if (php_stream_read(stream, (char *) dim, 2) != 2) in php_handle_ico()
1073 if (php_stream_read(stream, (char *) dim, sizeof(dim)) != sizeof(dim)) in php_handle_ico()
1096 static struct gfxinfo *php_handle_webp(php_stream * stream) in php_handle_webp() argument
1103 if (php_stream_read(stream, (char *) buf, 18) != 18) in php_handle_webp()
1143 php_stream* stream; member
1147 static const uint8_t* php_avif_stream_read(void* stream, size_t num_bytes) { in php_avif_stream_read() argument
1148 struct php_avif_stream* avif_stream = (struct php_avif_stream*)stream; in php_avif_stream_read()
1150 if (avif_stream == NULL || avif_stream->stream == NULL) { in php_avif_stream_read()
1153 if (php_stream_read(avif_stream->stream, (char*)avif_stream->buffer, num_bytes) != num_bytes) { in php_avif_stream_read()
1154 avif_stream->stream = NULL; /* fail further calls */ in php_avif_stream_read()
1160 static void php_avif_stream_skip(void* stream, size_t num_bytes) { in php_avif_stream_skip() argument
1161 struct php_avif_stream* avif_stream = (struct php_avif_stream*)stream; in php_avif_stream_skip()
1163 if (avif_stream == NULL || avif_stream->stream == NULL) { in php_avif_stream_skip()
1166 if (php_stream_seek(avif_stream->stream, num_bytes, SEEK_CUR)) { in php_avif_stream_skip()
1167 avif_stream->stream = NULL; /* fail further calls */ in php_avif_stream_skip()
1181 static struct gfxinfo *php_handle_avif(php_stream * stream) { in php_handle_avif() argument
1185 avif_stream.stream = stream; in php_handle_avif()
1204 bool php_is_image_avif(php_stream* stream) { in php_is_image_avif() argument
1206 avif_stream.stream = stream; in php_is_image_avif()
1349 PHPAPI int php_getimagetype(php_stream *stream, const char *input, char *filetype) in php_getimagetype() argument
1355 if((php_stream_read(stream, filetype, 3)) != 3) { in php_getimagetype()
1366 if (php_stream_read(stream, filetype+3, 5) != 5) { in php_getimagetype()
1387 if (php_stream_read(stream, filetype+3, 9) != 9) { in php_getimagetype()
1398 if (php_stream_read(stream, filetype+3, 1) != 1) { in php_getimagetype()
1414 twelve_bytes_read = (php_stream_read(stream, filetype+4, 8) == 8); in php_getimagetype()
1421 if (!php_stream_rewind(stream) && php_is_image_avif(stream)) { in php_getimagetype()
1426 if (php_get_wbmp(stream, NULL, 1)) { in php_getimagetype()
1435 if (php_get_xbm(stream, NULL)) { in php_getimagetype()
1443 static void php_getimagesize_from_stream(php_stream *stream, char *input, zval *info, INTERNAL_FUNC… in php_getimagesize_from_stream() argument
1448 if (!stream) { in php_getimagesize_from_stream()
1452 itype = php_getimagetype(stream, input, NULL); in php_getimagesize_from_stream()
1455 result = php_handle_gif(stream); in php_getimagesize_from_stream()
1459 result = php_handle_jpeg(stream, info); in php_getimagesize_from_stream()
1461 result = php_handle_jpeg(stream, NULL); in php_getimagesize_from_stream()
1465 result = php_handle_png(stream); in php_getimagesize_from_stream()
1468 result = php_handle_swf(stream); in php_getimagesize_from_stream()
1472 result = php_handle_swc(stream); in php_getimagesize_from_stream()
1478 result = php_handle_psd(stream); in php_getimagesize_from_stream()
1481 result = php_handle_bmp(stream); in php_getimagesize_from_stream()
1484 result = php_handle_tiff(stream, NULL, 0); in php_getimagesize_from_stream()
1487 result = php_handle_tiff(stream, NULL, 1); in php_getimagesize_from_stream()
1490 result = php_handle_jpc(stream); in php_getimagesize_from_stream()
1493 result = php_handle_jp2(stream); in php_getimagesize_from_stream()
1496 result = php_handle_iff(stream); in php_getimagesize_from_stream()
1499 result = php_handle_wbmp(stream); in php_getimagesize_from_stream()
1502 result = php_handle_xbm(stream); in php_getimagesize_from_stream()
1505 result = php_handle_ico(stream); in php_getimagesize_from_stream()
1508 result = php_handle_webp(stream); in php_getimagesize_from_stream()
1511 result = php_handle_avif(stream); in php_getimagesize_from_stream()
1546 php_stream *stream = NULL; in php_getimagesize_from_any() local
1569stream = php_stream_open_wrapper(ZSTR_VAL(input), "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH… in php_getimagesize_from_any()
1571 stream = php_stream_memory_open(TEMP_STREAM_READONLY, input); in php_getimagesize_from_any()
1574 if (!stream) { in php_getimagesize_from_any()
1578 php_getimagesize_from_stream(stream, ZSTR_VAL(input), info, INTERNAL_FUNCTION_PARAM_PASSTHRU); in php_getimagesize_from_any()
1579 php_stream_close(stream); in php_getimagesize_from_any()