cvs: php4 /ext/cpdf cpdf.c /ext/pdf pdf.c

From: Date: Mon, 21 May 2001 21:06:07 +0000
Subject: cvs: php4 /ext/cpdf cpdf.c /ext/pdf pdf.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5914@lists.php.net to get a copy of this message
jmoore Mon May 21 14:06:07 2001 EDT Modified files: /php4/ext/pdf pdf.c /php4/ext/cpdf cpdf.c Log: Fix for #8539 Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.79 php4/ext/pdf/pdf.c:1.80 --- php4/ext/pdf/pdf.c:1.79 Mon May 7 17:23:58 2001 +++ php4/ext/pdf/pdf.c Mon May 21 14:06:07 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.79 2001/05/08 00:23:58 jmoore Exp $ */ +/* $Id: pdf.c,v 1.80 2001/05/21 21:06:07 jmoore Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -27,6 +27,7 @@ #include "php.h" #include "php_ini.h" #include "php_globals.h" +#include "zend/zend_list.h" #include "ext/standard/head.h" #include "ext/standard/info.h" #include "ext/standard/file.h" @@ -34,6 +35,7 @@ #if HAVE_LIBGD13 #include "ext/gd/php_gd.h" #include "gd.h" +static int le_gd; #endif #ifdef HAVE_UNISTD_H @@ -314,7 +316,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.79 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.80 $" ); php_info_print_table_end(); } @@ -1897,7 +1899,12 @@ } ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); - ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", phpi_get_le_gd()); + ZEND_GET_RESOURCE_TYPE_ID(le_gd,"gd"); + if(!le_gd) + { + php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded."); + } + ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd); count = 3 * im->sx * im->sy; if(NULL == (buffer = (unsigned char *) emalloc(count))) { Index: php4/ext/cpdf/cpdf.c diff -u php4/ext/cpdf/cpdf.c:1.23 php4/ext/cpdf/cpdf.c:1.24 --- php4/ext/cpdf/cpdf.c:1.23 Fri Mar 30 12:36:18 2001 +++ php4/ext/cpdf/cpdf.c Mon May 21 14:06:07 2001 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cpdf.c,v 1.23 2001/03/30 20:36:18 ohrn Exp $ */ +/* $Id: cpdf.c,v 1.24 2001/05/21 21:06:07 jmoore Exp $ */ /* cpdflib.h -- C language API definitions for ClibPDF library * Copyright (C) 1998 FastIO Systems, All Rights Reserved. */ @@ -40,6 +40,7 @@ #include "php.h" #include "php_globals.h" +#include "zend/zend_list.h" #include "ext/standard/php_standard.h" #include "ext/standard/head.h" #include <math.h> @@ -66,6 +67,9 @@ typedef struct cpdflib_global_struct{ int le_cpdf; int le_outline; +#if HAVE_LIBGD13 + int le_gd; +#endif } cpdflib_global_struct; # define CPDF_GLOBAL(a) cpdflib_globals->a @@ -76,6 +80,9 @@ # define CPDF_TLS_VARS static int le_cpdf; static int le_outline; +#if HAVE_LIBGD13 +static int le_gd; +#endif #endif function_entry cpdf_functions[] = { @@ -2480,7 +2487,14 @@ gid=argv[1]->value.lval; im = zend_list_find(gid, &type); - if (!im || type != phpi_get_le_gd()) { + + ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd),"gd"); + if(!CPDF_GLOBAL(le_gd)) + { + php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded."); + } + + if (!im || type != CPDF_GLOBAL(le_gd)) { php_error(E_WARNING, "cpdf: Unable to find image pointer"); RETURN_FALSE; }

« previous php.cvs (#5914) next »