diff options
author | Wez Furlong <wez@php.net> | 2002-09-25 15:46:47 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-09-25 15:46:47 +0000 |
commit | 0141e970526bf07dc37d2519c444b6d83fe1863c (patch) | |
tree | 045b681cf8a1e00d122b7db8183000bf80f8c622 /ext/pdf | |
parent | 696e0a2301f2641d2ef8c4f94f0287ddbcb6ae10 (diff) | |
download | php-git-0141e970526bf07dc37d2519c444b6d83fe1863c.tar.gz |
Make these all work with persistent streams too.
Diffstat (limited to 'ext/pdf')
-rw-r--r-- | ext/pdf/pdf.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index ddc7262aec..ce169f7bdd 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -449,30 +449,30 @@ PHP_FUNCTION(pdf_set_info_keywords) PHP_FUNCTION(pdf_open) { zval **file; - void *what; - int type; FILE *fp = NULL; PDF *pdf; int argc = ZEND_NUM_ARGS(); - if(argc > 1) + if(argc > 1) { WRONG_PARAM_COUNT; - if (argc != 1 || zend_get_parameters_ex(1, &file) == FAILURE) { + } else if (argc != 1 || zend_get_parameters_ex(1, &file) == FAILURE) { fp = NULL; } else { - what = zend_fetch_resource(file TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream()); - ZEND_VERIFY_RESOURCE(what); + php_stream *stream; + + php_stream_from_zval(stream, file); - if (php_stream_cast((php_stream*)what, PHP_STREAM_AS_STDIO, (void*)&fp, 1) == FAILURE) { + if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, 1) == FAILURE) { RETURN_FALSE; } - /* XXX should do a zend_list_addref for <fp> here! */ } pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL); if(fp) { - if (PDF_open_fp(pdf, fp) < 0) RETURN_FALSE; + if (PDF_open_fp(pdf, fp) < 0) { + RETURN_FALSE; + } } else { PDF_open_mem(pdf, pdf_flushwrite); } |