helly           Tue Nov 12 08:16:14 2002 EDT

  Modified files:              
    /php4/ext/ming      ming.c 
  Log:
  php_error() => php_error_docref()
  
  
Index: php4/ext/ming/ming.c
diff -u php4/ext/ming/ming.c:1.38 php4/ext/ming/ming.c:1.39
--- php4/ext/ming/ming.c:1.38   Wed Sep 25 11:46:44 2002
+++ php4/ext/ming/ming.c        Tue Nov 12 08:16:12 2002
@@ -136,7 +136,7 @@
   
        if (id) {
                if (zend_hash_find(Z_OBJPROP_P(id), name, namelen+1, (void **)&tmp) == 
FAILURE) {
-                       php_error(E_WARNING, "unable to find property %s", name);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find 
+property %s", name);
                        return NULL;
                }
                id_to_find = Z_LVAL_PP(tmp);
@@ -147,7 +147,7 @@
        property = zend_list_find(id_to_find, &type);
 
        if (!property || type != proptype) {
-               php_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find identifier 
+(%d)", id_to_find);
                return NULL;
        }
 
@@ -179,7 +179,7 @@
        else if (Z_OBJCE_P(id) == &bitmap_class_entry)
                return (SWFCharacter)getBitmap(id TSRMLS_CC);
        else
-               php_error(E_ERROR, "called object is not an SWFCharacter");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFCharacter");
                return NULL;
 }
 /* }}} */
@@ -237,7 +237,7 @@
        action = compileSWFActionCode(Z_STRVAL_PP(script));
 
        if (!action) {
-               php_error(E_ERROR, "Couldn't compile actionscript.");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Couldn't compile 
+actionscript");
        }
        
        ret = zend_list_insert(action, le_swfactionp);
@@ -256,7 +256,7 @@
        void *action = SWFgetProperty(id, "action", 6, le_swfactionp TSRMLS_CC);
 
        if (!action) {
-               php_error(E_ERROR, "called object is not an SWFAction!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFAction");
        }
        return (SWFAction)action;
 }
@@ -333,7 +333,7 @@
        void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp TSRMLS_CC);
 
        if (!bitmap) {
-               php_error(E_ERROR, "called object is not an SWFBitmap!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFBitmap");
        }
        return (SWFBitmap)bitmap;
 }
@@ -395,7 +395,7 @@
        void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp TSRMLS_CC);
 
        if(!button) {
-               php_error(E_ERROR, "called object is not an SWFButton!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFButton");
        }
        return (SWFButton)button;
 }
@@ -543,7 +543,7 @@
        convert_to_string_ex(key);
 
        if (Z_STRLEN_PP(key) > 1) {
-               php_error(E_ERROR, "SWFBUTTON_KEYPRESS expects only one character!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Only one character 
+expected");
        }
        
        c = Z_STRVAL_PP(key)[0];
@@ -582,7 +582,7 @@
        void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp 
TSRMLS_CC);
 
        if (!item) {
-               php_error(E_ERROR, "called object is not an SWFDisplayItem!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFDisplayItem");
        }
 
        return (SWFDisplayItem)item;
@@ -915,7 +915,7 @@
    Returns a new SWFFill object */
 PHP_FUNCTION(swffill_init)
 {
-  php_error(E_ERROR, "Instantiating SWFFill won't do any good- use 
SWFShape::addFill() instead!");
+  php_error_docref(NULL TSRMLS_CC, E_ERROR, "Instantiating SWFFill won't do any good- 
+use SWFShape::addFill() instead");
 }
 
 static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
@@ -934,7 +934,7 @@
        void *fill = SWFgetProperty(id, "fill", 4, le_swffillp TSRMLS_CC);
 
        if (!fill) {
-               php_error(E_ERROR, "called object is not an SWFFill!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFFill");
        }
        return (SWFFill)fill;
 }
@@ -1042,7 +1042,7 @@
        void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC);
 
        if (!font) {
-               php_error(E_ERROR, "called object is not an SWFFont!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFFont");
        }
        return (SWFFont)font;
 }
@@ -1170,7 +1170,7 @@
        void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp TSRMLS_CC);
 
        if (!gradient) {
-               php_error(E_ERROR, "called object is not an SWFGradient!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFGradient");
        }
        return (SWFGradient)gradient;
 }
@@ -1245,7 +1245,7 @@
        void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp TSRMLS_CC);
 
        if (!morph) {
-               php_error(E_ERROR, "called object is not an SWFMorph!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFMorph");
        }
        return (SWFMorph)morph;
 }
@@ -1337,7 +1337,7 @@
        void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep TSRMLS_CC);
 
        if (!movie) {
-               php_error(E_ERROR, "called object is not an SWFMovie!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFMovie");
        }
        return (SWFMovie)movie;
 }
@@ -1623,7 +1623,7 @@
        void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep TSRMLS_CC);
 
        if (!shape) {
-               php_error(E_ERROR, "called object is not an SWFShape!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFShape");
        }
        return (SWFShape)shape;
 }
@@ -1706,7 +1706,7 @@
                        }
                        fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), 
getBitmap(*arg1 TSRMLS_CC), flags);
                } else {
-                       php_error(E_ERROR, "argument to addfill not a bitmap nor a 
gradient");
+                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "Argument is not a 
+bitmap nor a gradient");
                }
 
        } else if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
@@ -1737,7 +1737,7 @@
        }
        
        if (!fill) {
-               php_error(E_ERROR, "Error adding fill to shape!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error adding fill to 
+shape");
        }
 
        /* return an SWFFill object */
@@ -2129,7 +2129,7 @@
        void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep TSRMLS_CC);
 
        if (!sprite) {
-               php_error(E_ERROR, "called object is not an SWFSprite!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFSprite");
        }
        return (SWFMovieClip)sprite;
 }
@@ -2265,7 +2265,7 @@
        void *text = SWFgetProperty(id, "text", 4, le_swftextp TSRMLS_CC);
 
        if (!text) {
-               php_error(E_ERROR, "called object is not an SWFText!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFText");
        }
        return (SWFText)text;
 }
@@ -2474,7 +2474,7 @@
        void *field = SWFgetProperty(id, "textfield", 9, le_swftextfieldp TSRMLS_CC);
 
        if (!field) {
-               php_error(E_ERROR, "called object is not an SWFTextField!");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an 
+SWFTextField");
        }
        return (SWFTextField)field;
 }
@@ -2707,19 +2707,20 @@
 
 /* {{{ todo PHP_MINIT_FUNCTION(ming)
 */
-#define ERROR_BUFSIZE 1024
-
 /* custom error handler propagates ming errors up to php */
 static void php_ming_error(char *msg, ...)
 {
+       TSRMLS_FETCH();
+
        va_list args;
-       char buffer[ERROR_BUFSIZE];
+       char *buffer;
 
        va_start(args, msg);
-       vsnprintf(buffer, ERROR_BUFSIZE, msg, args);
+       vspprintf(&buffer, 0, msg, args);
        va_end(args);
 
-       php_error(E_ERROR, buffer);
+       php_error_docref(NULL TSRMLS_CC, E_ERROR, buffer);
+       efree(buffer);
 }
 
 PHP_RINIT_FUNCTION(ming)
@@ -2727,7 +2728,7 @@
        /* XXX - this didn't work so well last I tried.. */
 
        if (Ming_init() != 0) {
-               php_error(E_ERROR, "Error initializing Ming module");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error initializing Ming 
+module");
                return FAILURE;
        }
        return SUCCESS;



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

Reply via email to