[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] =?utf-8?q?svn:_/pecl/imagick/branches/imagick-release/_config.w32_imagick=5Fclass.c_imagi
From:       Mikko_Koppanen <mkoppanen () php ! net>
Date:       2011-07-31 1:55:25
Message-ID: svn-mkoppanen-1312077325-313989-999157308 () svn ! php ! net
[Download RAW message or body]

mkoppanen                                Sun, 31 Jul 2011 01:55:25 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313989

Log:
merged trunk

Changed paths:
    _U  pecl/imagick/branches/imagick-release/
    U   pecl/imagick/branches/imagick-release/config.w32
    U   pecl/imagick/branches/imagick-release/imagick_class.c
    U   pecl/imagick/branches/imagick-release/imagick_helpers.c
    U   pecl/imagick/branches/imagick-release/php_imagick_helpers.h


Property changes on: pecl/imagick/branches/imagick-release
___________________________________________________________________
Modified: svn:mergeinfo
   - /pecl/imagick/trunk:301191-308481
   + /pecl/imagick/trunk:301191-313988

Modified: pecl/imagick/branches/imagick-release/config.w32
===================================================================
--- pecl/imagick/branches/imagick-release/config.w32	2011-07-31 01:51:42 UTC (rev \
                313988)
+++ pecl/imagick/branches/imagick-release/config.w32	2011-07-31 01:55:25 UTC (rev \
313989) @@ -8,7 +8,7 @@
 			)
 	{
 		ADD_FLAG("CFLAGS_IMAGICK", "/D IMAGICK_USE_NEW_HEADER /D _MAGICKMOD_ /D _VISUALC_ \
                /D NeedFunctionPrototypes /D _LIB");
-		EXTENSION('imagick', 'imagick_class.c imagickdraw_class.c imagickpixel_class.c \
imagickpixeliterator_class.c imagick_helpers.c imagick_read.c imagick.c'); \
+		EXTENSION('imagick', 'imagick_class.c imagickdraw_class.c imagickpixel_class.c \
imagickpixeliterator_class.c imagick_helpers.c imagick_file.c imagick.c');  \
AC_DEFINE('HAVE_IMAGICK', 1);  } else {
 		WARNING("imagick not enabled; libraries and headers not found");

Modified: pecl/imagick/branches/imagick-release/imagick_class.c
===================================================================
--- pecl/imagick/branches/imagick-release/imagick_class.c	2011-07-31 01:51:42 UTC \
                (rev 313988)
+++ pecl/imagick/branches/imagick-release/imagick_class.c	2011-07-31 01:55:25 UTC \
(rev 313989) @@ -545,17 +545,22 @@
 	draw       = (DrawingWand *)NewDrawingWand();
 	mask_image = (MagickWand *)NewMagickWand();

+#define exit_cleanup() \
+	if (color != NULL) color = DestroyPixelWand(color); \
+	if (draw != NULL) draw = DestroyDrawingWand(draw); \
+	if (mask_image != NULL) mask_image = DestroyMagickWand(mask_image);
+
 	status = PixelSetColor(color, "transparent");

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+        exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", \
1);  }

 	status = MagickNewImage(mask_image, image_width, image_height, color);

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+		exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to allocate mask \
image", 1);  }

@@ -563,7 +568,7 @@
 	status = PixelSetColor(color, "white");

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+		exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", \
1);  }

@@ -571,7 +576,7 @@
 	status = PixelSetColor(color, "black");

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+		exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", \
1);  }

@@ -584,19 +589,20 @@
 	IMAGICK_RESTORE_LOCALE(old_locale, restore);

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+		exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to draw on image", 1);
 	}

 	status = MagickCompositeImage(intern->magick_wand, mask_image, DstInCompositeOp, 0, \
0);

 	if (status == MagickFalse) {
-		deallocate_wands(mask_image, draw, color TSRMLS_CC);
+		exit_cleanup();
 		IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to composite image", \
1);  }

-	deallocate_wands(mask_image, draw, color TSRMLS_CC);
+	exit_cleanup();
 	RETURN_TRUE;
+#undef exit_cleanup
 }
 /* }}} */

@@ -2319,7 +2325,7 @@
 	if (status == MagickFalse) {
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to transform image \
colorspace", 1);  }
-    RETURN_TRUE;
+	RETURN_TRUE;
 }
 /* }}} */
 #endif
@@ -5123,7 +5129,7 @@
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
 		return;
 	}
-
+
 	intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
 	IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);

@@ -5135,6 +5141,7 @@
 	}

 	if (status == MagickFalse) {
+		tmp_wand = DestroyPixelWand(tmp_wand);
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image \
background color", 1);  }

@@ -5201,6 +5208,7 @@
 	}

 	if (status == MagickFalse) {
+		tmp_wand = DestroyPixelWand(tmp_wand);
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image border \
color", 1);  }

@@ -5397,6 +5405,7 @@
 	}

 	if (status == MagickFalse) {
+		tmp_wand = DestroyPixelWand(tmp_wand);
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image colormap \
color", 1);  }

@@ -5741,6 +5750,7 @@
 	}

 	if (status == MagickFalse) {
+		tmp_wand = DestroyPixelWand(tmp_wand);
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable get image matter \
color", 1);  }

@@ -5805,13 +5815,15 @@
 	IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);

 	tmp_wand = NewPixelWand();
-	status = MagickGetImagePixelColor(intern->magick_wand, x, y , tmp_wand);

-	if (tmp_wand == (PixelWand *)NULL) {
-		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image pixel \
color", 1); +	if (!tmp_wand) {
+		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Failed to allocate new \
PixelWand", 1);  }

+	status = MagickGetImagePixelColor(intern->magick_wand, x, y , tmp_wand);
+
 	if (status == MagickFalse) {
+		tmp_wand = DestroyPixelWand(tmp_wand);
 		IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable get image pixel \
color", 1);  }


Modified: pecl/imagick/branches/imagick-release/imagick_helpers.c
===================================================================
--- pecl/imagick/branches/imagick-release/imagick_helpers.c	2011-07-31 01:51:42 UTC \
                (rev 313988)
+++ pecl/imagick/branches/imagick-release/imagick_helpers.c	2011-07-31 01:55:25 UTC \
(rev 313989) @@ -391,21 +391,6 @@
 	return 1;
 }

-void deallocate_wands(MagickWand *magick, DrawingWand *draw, PixelWand *pixel \
                TSRMLS_DC)
-{
-	if (magick != (MagickWand *)NULL) {
-		magick = (MagickWand *)DestroyMagickWand(magick);
-	}
-
-	if (draw != (DrawingWand *)NULL) {
-		draw = (DrawingWand *)DestroyDrawingWand(draw);
-	}
-
-	if (pixel != (PixelWand *)NULL) {
-		pixel = (PixelWand *)DestroyPixelWand(pixel);
-	}
-}
-
 void *get_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC)
 {
 	PointInfo *coordinates;

Modified: pecl/imagick/branches/imagick-release/php_imagick_helpers.h
===================================================================
--- pecl/imagick/branches/imagick-release/php_imagick_helpers.h	2011-07-31 01:51:42 \
                UTC (rev 313988)
+++ pecl/imagick/branches/imagick-release/php_imagick_helpers.h	2011-07-31 01:55:25 \
UTC (rev 313989) @@ -24,8 +24,6 @@

 void add_assoc_string_helper(zval *retvalue, char *name, char *key, char *hash_value \
TSRMLS_DC);

-void deallocate_wands(MagickWand *magick, DrawingWand *draw, PixelWand *pixel \
                TSRMLS_DC);
-
 void *get_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC);

 #if MagickLibVersion <= 0x628



-- 
PECL CVS Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic