Hi, all.

Ming extension doesn't work with current HEAD.
This patch fixes the problem.


And there is some problems with Ming documentation.
For example, "new SWFBitmap()" waits for _file contents_ to be passed as first 
argument, but manual says:
new swfbitmap ( string filename [, int alphafilename])

Of course it fails if you're trying to pass filename.

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]
--- ming.c.orig Fri Aug 15 11:07:55 2003
+++ ming.c      Thu Sep  4 17:52:17 2003
@@ -4,10 +4,10 @@
   +----------------------------------------------------------------------+
   | Copyright (c) 1997-2003 The PHP Group                                |
   +----------------------------------------------------------------------+
-  | This source file is subject to version 2.02 of the PHP license,      |
+  | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
-  | available at through the world-wide-web at                           |
-  | http://www.php.net/license/2_02.txt.                                 |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_0.txt.                                  |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: ming.c,v 1.42.2.9 2003/08/11 01:55:07 sniper Exp $ */
+/* $Id: ming.c,v 1.54 2003/08/11 01:54:44 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -122,19 +122,20 @@
 static int le_swfspritep;
 static int le_swfinputp;
 
-zend_class_entry movie_class_entry;
-zend_class_entry shape_class_entry;
-zend_class_entry fill_class_entry;
-zend_class_entry gradient_class_entry;
-zend_class_entry bitmap_class_entry;
-zend_class_entry font_class_entry;
-zend_class_entry text_class_entry;
-zend_class_entry textfield_class_entry;
-zend_class_entry displayitem_class_entry;
-zend_class_entry button_class_entry;
-zend_class_entry action_class_entry;
-zend_class_entry morph_class_entry;
-zend_class_entry sprite_class_entry;
+
+static zend_class_entry *movie_class_entry_ptr;
+static zend_class_entry *shape_class_entry_ptr;
+static zend_class_entry *fill_class_entry_ptr;
+static zend_class_entry *gradient_class_entry_ptr;
+static zend_class_entry *bitmap_class_entry_ptr;
+static zend_class_entry *font_class_entry_ptr;
+static zend_class_entry *text_class_entry_ptr;
+static zend_class_entry *textfield_class_entry_ptr;
+static zend_class_entry *displayitem_class_entry_ptr;
+static zend_class_entry *button_class_entry_ptr;
+static zend_class_entry *action_class_entry_ptr;
+static zend_class_entry *morph_class_entry_ptr;
+static zend_class_entry *sprite_class_entry_ptr;
 
 /* {{{ internal function SWFgetProperty
 */
@@ -173,21 +174,21 @@
    Returns the SWFCharacter contained in zval *id */
 static SWFCharacter getCharacter(zval *id TSRMLS_DC)
 {
-       if (Z_OBJCE_P(id) == &shape_class_entry)
+       if (Z_OBJCE_P(id) == shape_class_entry_ptr)
                return (SWFCharacter)getShape(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &font_class_entry)
+       else if (Z_OBJCE_P(id) == font_class_entry_ptr)
                return (SWFCharacter)getFont(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &text_class_entry)
+       else if (Z_OBJCE_P(id) == text_class_entry_ptr)
                return (SWFCharacter)getText(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &textfield_class_entry)
+       else if (Z_OBJCE_P(id) == textfield_class_entry_ptr)
                return (SWFCharacter)getTextField(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &button_class_entry)
+       else if (Z_OBJCE_P(id) == button_class_entry_ptr)
                return (SWFCharacter)getButton(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &morph_class_entry)
+       else if (Z_OBJCE_P(id) == morph_class_entry_ptr)
                return (SWFCharacter)getMorph(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &sprite_class_entry)
+       else if (Z_OBJCE_P(id) == sprite_class_entry_ptr)
                return (SWFCharacter)getSprite(id TSRMLS_CC);
-       else if (Z_OBJCE_P(id) == &bitmap_class_entry)
+       else if (Z_OBJCE_P(id) == bitmap_class_entry_ptr)
                return (SWFCharacter)getBitmap(id TSRMLS_CC);
        else
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
SWFCharacter");
@@ -253,7 +254,7 @@
        
        ret = zend_list_insert(action, le_swfactionp);
 
-       object_init_ex(getThis(), &action_class_entry);
+       object_init_ex(getThis(), action_class_entry_ptr);
        add_property_resource(getThis(), "action", ret);
        zend_list_addref(ret);
 }
@@ -326,7 +327,7 @@
        }
 
        ret = zend_list_insert(bitmap, le_swfbitmapp);
-       object_init_ex(getThis(), &bitmap_class_entry);
+       object_init_ex(getThis(), bitmap_class_entry_ptr);
        add_property_resource(getThis(), "bitmap", ret);
        zend_list_addref(ret);
 }
@@ -388,7 +389,7 @@
        SWFButton button = newSWFButton();
        int ret = zend_list_insert(button, le_swfbuttonp);
 
-       object_init_ex(getThis(), &button_class_entry);
+       object_init_ex(getThis(), button_class_entry_ptr);
        add_property_resource(getThis(), "button", ret);
        zend_list_addref(ret);
 }
@@ -1096,7 +1097,7 @@
 
        ret = zend_list_insert(font, le_swffontp);
 
-       object_init_ex(getThis(), &font_class_entry);
+       object_init_ex(getThis(), font_class_entry_ptr);
        add_property_resource(getThis(), "font", ret);
        zend_list_addref(ret);
 }
@@ -1163,7 +1164,7 @@
        SWFGradient gradient = newSWFGradient();
        int ret = zend_list_insert(gradient, le_swfgradientp);
 
-       object_init_ex(getThis(), &gradient_class_entry);
+       object_init_ex(getThis(), gradient_class_entry_ptr);
        add_property_resource(getThis(), "gradient", ret);
        zend_list_addref(ret);
 }
@@ -1238,7 +1239,7 @@
        SWFMorph morph = newSWFMorphShape();
        int ret = zend_list_insert(morph, le_swfmorphp);
 
-       object_init_ex(getThis(), &morph_class_entry);
+       object_init_ex(getThis(), morph_class_entry_ptr);
        add_property_resource(getThis(), "morph", ret);
        zend_list_addref(ret);
 }
@@ -1270,7 +1271,7 @@
        SWFShape shape = SWFMorph_getShape1(morph);
        int ret = zend_list_insert(shape, le_swfshapep);
 
-       object_init_ex(return_value, &shape_class_entry);
+       object_init_ex(return_value, shape_class_entry_ptr);
        add_property_resource(return_value, "shape", ret);
        zend_list_addref(ret);
 }
@@ -1284,7 +1285,7 @@
        SWFShape shape = SWFMorph_getShape2(morph);
        int ret = zend_list_insert(shape, le_swfshapep);
 
-       object_init_ex(return_value, &shape_class_entry);
+       object_init_ex(return_value, shape_class_entry_ptr);
        add_property_resource(return_value, "shape", ret);
        zend_list_addref(ret);
 }
@@ -1332,7 +1333,7 @@
        
        ret = zend_list_insert(movie, le_swfmoviep);
        
-       object_init_ex(getThis(), &movie_class_entry);
+       object_init_ex(getThis(), movie_class_entry_ptr);
        add_property_resource(getThis(), "movie", ret);
        zend_list_addref(ret);
 }
@@ -1395,7 +1396,7 @@
        convert_to_object_ex(zchar);
 
        /* XXX - SWFMovie_add deals w/ all block types.  Probably will need to add 
that.. */
-       if (Z_OBJCE_PP(zchar) == &action_class_entry) {
+       if (Z_OBJCE_PP(zchar) == action_class_entry_ptr) {
                block = (SWFBlock) getAction(*zchar TSRMLS_CC);
        } else {
                block = (SWFBlock) getCharacter(*zchar TSRMLS_CC);
@@ -1406,7 +1407,7 @@
        if (item != NULL) {
                /* try and create a displayitem object */
                ret = zend_list_insert(item, le_swfdisplayitemp);
-               object_init_ex(return_value, &displayitem_class_entry);
+               object_init_ex(return_value, displayitem_class_entry_ptr);
                add_property_resource(return_value, "displayitem", ret);
        }
 }
@@ -1701,7 +1702,7 @@
        SWFShape shape = newSWFShape();
        int ret = zend_list_insert(shape, le_swfshapep);
 
-       object_init_ex(getThis(), &shape_class_entry);
+       object_init_ex(getThis(), shape_class_entry_ptr);
        add_property_resource(getThis(), "shape", ret);
        zend_list_addref(ret);
 }
@@ -1792,12 +1793,12 @@
 
                convert_to_object_ex(arg1);
 
-               if (Z_OBJCE_PP(arg1) == &gradient_class_entry) {
+               if (Z_OBJCE_PP(arg1) == gradient_class_entry_ptr) {
                        if (flags == 0) {
                                flags = SWFFILL_LINEAR_GRADIENT;
                        }
                        fill = SWFShape_addGradientFill(getShape(getThis() TSRMLS_CC), 
getGradient(*arg1 TSRMLS_CC), flags);
-               } else if (Z_OBJCE_PP(arg1) == &bitmap_class_entry) {
+               } else if (Z_OBJCE_PP(arg1) == bitmap_class_entry_ptr) {
                        if (flags == 0) {
                                flags = SWFFILL_TILED_BITMAP;
                        }
@@ -1841,7 +1842,7 @@
 
        /* return an SWFFill object */
        ret = zend_list_insert(fill, le_swffillp);
-       object_init_ex(return_value, &fill_class_entry);
+       object_init_ex(return_value, fill_class_entry_ptr);
        add_property_resource(return_value, "fill", ret);
 }
 /* }}} */
@@ -2210,7 +2211,7 @@
        SWFMovieClip sprite = newSWFMovieClip();
        int ret = zend_list_insert(sprite, le_swfspritep);
 
-       object_init_ex(getThis(), &sprite_class_entry);
+       object_init_ex(getThis(), sprite_class_entry_ptr);
        add_property_resource(getThis(), "sprite", ret);
        zend_list_addref(ret);
 }
@@ -2250,7 +2251,7 @@
        
        convert_to_object_ex(zchar);
 
-       if (Z_OBJCE_PP(zchar) == &action_class_entry) {
+       if (Z_OBJCE_PP(zchar) == action_class_entry_ptr) {
                block = (SWFBlock)getAction(*zchar TSRMLS_CC);
        } else {
                block = (SWFBlock)getCharacter(*zchar TSRMLS_CC);
@@ -2261,7 +2262,7 @@
        if (item != NULL) {
                /* try and create a displayitem object */
                ret = zend_list_insert(item, le_swfdisplayitemp);
-               object_init_ex(return_value, &displayitem_class_entry);
+               object_init_ex(return_value, displayitem_class_entry_ptr);
                add_property_resource(return_value, "displayitem", ret);
        }
 }
@@ -2346,7 +2347,7 @@
        SWFText text = newSWFText2();
        int ret = zend_list_insert(text, le_swftextp);
 
-       object_init_ex(getThis(), &text_class_entry);
+       object_init_ex(getThis(), text_class_entry_ptr);
        add_property_resource(getThis(), "text", ret);
        zend_list_addref(ret);
 }
@@ -2546,7 +2547,7 @@
        SWFTextField field = newSWFTextField();
        int ret = zend_list_insert(field, le_swftextfieldp);
 
-       object_init_ex(getThis(), &textfield_class_entry);
+       object_init_ex(getThis(), textfield_class_entry_ptr);
        add_property_resource(getThis(), "textfield", ret);
        zend_list_addref(ret);
 
@@ -2835,6 +2836,20 @@
 
 PHP_MINIT_FUNCTION(ming)
 {
+       zend_class_entry shape_class_entry;
+       zend_class_entry fill_class_entry;
+       zend_class_entry gradient_class_entry;
+       zend_class_entry bitmap_class_entry;
+       zend_class_entry text_class_entry;
+       zend_class_entry textfield_class_entry;
+       zend_class_entry font_class_entry;
+       zend_class_entry displayitem_class_entry;
+       zend_class_entry movie_class_entry;
+       zend_class_entry button_class_entry;
+       zend_class_entry action_class_entry;
+       zend_class_entry morph_class_entry;
+       zend_class_entry sprite_class_entry;
+
        Ming_setErrorFunction((void *) php_ming_error);
 
 #define CONSTANT(s,c) REGISTER_LONG_CONSTANT((s), (c), CONST_CS | CONST_PERSISTENT)
@@ -2916,19 +2931,19 @@
        INIT_CLASS_ENTRY(morph_class_entry, "swfmorph", swfmorph_functions);
        INIT_CLASS_ENTRY(sprite_class_entry, "swfsprite", swfsprite_functions);
 
-       zend_register_internal_class(&shape_class_entry TSRMLS_CC);
-       zend_register_internal_class(&fill_class_entry TSRMLS_CC);
-       zend_register_internal_class(&gradient_class_entry TSRMLS_CC);
-       zend_register_internal_class(&bitmap_class_entry TSRMLS_CC);
-       zend_register_internal_class(&text_class_entry TSRMLS_CC);
-       zend_register_internal_class(&textfield_class_entry TSRMLS_CC);
-       zend_register_internal_class(&font_class_entry TSRMLS_CC);
-       zend_register_internal_class(&displayitem_class_entry TSRMLS_CC);
-       zend_register_internal_class(&movie_class_entry TSRMLS_CC);
-       zend_register_internal_class(&button_class_entry TSRMLS_CC);
-       zend_register_internal_class(&action_class_entry TSRMLS_CC);
-       zend_register_internal_class(&morph_class_entry TSRMLS_CC);
-       zend_register_internal_class(&sprite_class_entry TSRMLS_CC);
+       shape_class_entry_ptr = zend_register_internal_class(&shape_class_entry 
TSRMLS_CC);
+       fill_class_entry_ptr = zend_register_internal_class(&fill_class_entry 
TSRMLS_CC);
+       gradient_class_entry_ptr = zend_register_internal_class(&gradient_class_entry 
TSRMLS_CC);
+       bitmap_class_entry_ptr = zend_register_internal_class(&bitmap_class_entry 
TSRMLS_CC);
+       text_class_entry_ptr = zend_register_internal_class(&text_class_entry 
TSRMLS_CC);
+       textfield_class_entry_ptr = 
zend_register_internal_class(&textfield_class_entry TSRMLS_CC);
+       font_class_entry_ptr = zend_register_internal_class(&font_class_entry 
TSRMLS_CC);
+       displayitem_class_entry_ptr = 
zend_register_internal_class(&displayitem_class_entry TSRMLS_CC);
+       movie_class_entry_ptr = zend_register_internal_class(&movie_class_entry 
TSRMLS_CC);
+       button_class_entry_ptr = zend_register_internal_class(&button_class_entry 
TSRMLS_CC);
+       action_class_entry_ptr = zend_register_internal_class(&action_class_entry 
TSRMLS_CC);
+       morph_class_entry_ptr = zend_register_internal_class(&morph_class_entry 
TSRMLS_CC);
+       sprite_class_entry_ptr = zend_register_internal_class(&sprite_class_entry 
TSRMLS_CC);
 
        return SUCCESS;
 }

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to