tony2001                Mon Aug  4 12:19:50 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/ming   ming.c 
  Log:
  numerous int<->long fixes (this code just couldn't work on 64bit OSes)
  here is why we need to put ming to PECL
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ming/ming.c?r1=1.79.2.4.2.8.2.10&r2=1.79.2.4.2.8.2.11&diff_format=u
Index: php-src/ext/ming/ming.c
diff -u php-src/ext/ming/ming.c:1.79.2.4.2.8.2.10 
php-src/ext/ming/ming.c:1.79.2.4.2.8.2.11
--- php-src/ext/ming/ming.c:1.79.2.4.2.8.2.10   Sun Aug  3 12:15:47 2008
+++ php-src/ext/ming/ming.c     Mon Aug  4 12:19:50 2008
@@ -19,7 +19,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: ming.c,v 1.79.2.4.2.8.2.10 2008/08/03 12:15:47 jani Exp $ */
+/* $Id: ming.c,v 1.79.2.4.2.8.2.11 2008/08/04 12:19:50 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -111,7 +111,7 @@
 {
        double num;
 
-        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == 
FAILURE) {
                return;
        }
        Ming_setScale((float)num);
@@ -380,13 +380,12 @@
 }
 /* }}} */
 
-
 /* {{{ proto void swfinput::__construct(string data) */
 PHP_METHOD(swfinput, __construct)
 {
        SWFInput input;
        char *data;
-       long data_len;
+       int data_len;
        int ret;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, 
&data_len) == FAILURE) {
@@ -424,7 +423,7 @@
 PHP_METHOD(swffontcollection, __construct)
 {
        char *filename;
-       long filename_len;
+       int filename_len;
        int ret;
        SWFFontCollection fc;
 
@@ -485,7 +484,6 @@
 };
 /* }}} */
 
-
 /* {{{ SWFBrowserFont */
 static SWFBrowserFont getBrowserFont(zval *id TSRMLS_DC)
 {
@@ -503,7 +501,7 @@
 PHP_METHOD(swfbrowserfont, __construct)
 {
        char *name;
-       long name_len;
+       int name_len;
        int ret;
        SWFBrowserFont font;
 
@@ -531,13 +529,14 @@
        { NULL, NULL, NULL }
 };
 /* }}} */
+
 /* {{{ SWFCXform
 */
 /* {{{ proto void swfcxform::__construct([rAdd, gAdd, bAdd, aAdd, rMult, 
gMult, bMult, aMult]) */
 PHP_METHOD(swfcxform, __construct)
 {
        SWFCXform cx;
-       int rAdd, gAdd, bAdd, aAdd;
+       long rAdd, gAdd, bAdd, aAdd;
        double rMult, gMult, bMult, aMult;
        int ret;
 
@@ -568,7 +567,7 @@
 /* {{{ proto void setColorAdd(r, g, b, a) */
 PHP_METHOD(swfcxform, setColorAdd)
 {
-       int rAdd, gAdd, bAdd, aAdd;
+       long rAdd, gAdd, bAdd, aAdd;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &rAdd, 
&gAdd, &bAdd, &aAdd) == FAILURE) {
                return;
@@ -616,9 +615,6 @@
 };
 /* }}} */
 
-
-
-
 /* {{{ SWFMatrix */
 
 static SWFMatrix getMatrix(zval *id TSRMLS_DC)
@@ -747,7 +743,6 @@
 };
 /* }}} */
 
-
 /* {{{ SWFAction
 */
 /* {{{ proto void swfaction::__construct(string)
@@ -781,7 +776,7 @@
 /* {{{ proto long swfaction::compile(version) */
 PHP_METHOD(swfaction, compile)
 {
-       int version;
+       long version;
        int len, ret;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &version) == 
FAILURE) {
@@ -963,7 +958,7 @@
    sets a button characters depth */
 PHP_METHOD(swfbuttonrecord, setDepth)
 {
-       int depth;
+       long depth;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == 
FAILURE) {
                return;
@@ -976,7 +971,7 @@
    assigns a blend mode to a button's character */
 PHP_METHOD(swfbuttonrecord, setBlendMode)
 {
-       int mode;
+       long mode;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == 
FAILURE) {
                return;
@@ -1063,7 +1058,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto void swfbuttoncharacter::skewX(double x) */
 PHP_METHOD(swfbuttonrecord, skewX)
 {
@@ -2263,7 +2257,7 @@
 PHP_METHOD(swffontchar, addChars)
 {
        char *string;
-       long string_len;
+       int string_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
                return;
@@ -2279,7 +2273,7 @@
 PHP_METHOD(swffontchar, addUTF8Chars)
 {
        char *string;
-       long string_len;
+       int string_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
                return;
@@ -2312,8 +2306,6 @@
 #endif
 /* }}} */
 
-/* {{{ SWFFont
-*/
 /* {{{ internal function SWFText getFont(zval *id)
    Returns the Font object in zval *id */
 static SWFFont getFont(zval *id TSRMLS_DC)
@@ -2332,7 +2324,7 @@
 PHP_METHOD(swffont, __construct)
 {
        char *file;
-       long file_len;
+       int file_len;
        SWFFont font;
        int ret;
 
@@ -2371,7 +2363,7 @@
 PHP_METHOD(swffont, getWidth)
 {
        char *string;
-       long string_len;
+       int string_len;
        float width;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
@@ -2390,7 +2382,7 @@
 PHP_METHOD(swffont, getUTF8Width)
 {
        char *string;
-       long string_len;
+       int string_len;
        float width;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
@@ -2468,7 +2460,6 @@
 
 /* }}} */
 
-
 /* {{{ SWFFilterMatrix
 */
 /* {{{ proto void swffiltermatrix::__construct(cols, rows, array:vals)
@@ -2630,7 +2621,6 @@
 };
 /* }}} */
 
-
 /* {{{ SWFGradient
 */
 /* {{{ proto void swfgradient::__construct()
@@ -3081,8 +3071,6 @@
 };
 /* }}} */
 
-
-
 /* {{{ SWFMorph 
 */
 /* {{{ proto void swfmorph::__construct()
@@ -3238,8 +3226,6 @@
 };
 /* }}} */
 
-
-
 /* {{{ SWFSound */
 /* {{{ internal function SWFSound getSound(zval *id)
    Returns the Sound object in zval *id */
@@ -3325,7 +3311,6 @@
 
 /* }}} */
 
-/* {{{ SWFSoundInstance */
 #ifdef HAVE_NEW_MING
 /* should handle envelope functions */
 /* {{{ internal function SWFSoundInstance getSoundInstance(zval *id)
@@ -3371,6 +3356,7 @@
 }
 
 /* }}} */
+
 /* {{{ swfsoundinstance_loopoutpoint(point) */
 
 PHP_METHOD(swfsoundinstance, loopOutPoint)
@@ -3597,7 +3583,7 @@
 PHP_METHOD(swfbinarydata, __construct)
 {
        char *data;
-       long data_len;
+       int data_len;
        SWFBinaryData bd = NULL;
        int ret;
 
@@ -3768,7 +3754,7 @@
 PHP_METHOD(swfmovie, labelFrame)
 {
        char *label;
-       long label_len;
+       int label_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, 
&label_len) == FAILURE) {
                return;
@@ -3783,7 +3769,7 @@
 PHP_METHOD(swfmovie, namedAnchor)
 {
        char *label;
-       long label_len;
+       int label_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, 
&label_len) == FAILURE) {
                return;
@@ -3798,7 +3784,7 @@
 PHP_METHOD(swfmovie, protect)
 {
        char *passwd = NULL;
-       long passwd_len;
+       int passwd_len;
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &passwd, 
&passwd_len) == FAILURE) {
@@ -3873,7 +3859,7 @@
 {
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
 #if !defined(HAVE_NEW_MING)
-       int limit = -1;
+       long limit = -1;
        int oldval = INT_MIN;
        long out; 
 
@@ -3886,7 +3872,7 @@
                
        RETURN_LONG(out);
 #elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
-       int limit = -1;
+       long limit = -1;
        int argc = ZEND_NUM_ARGS();
 
        if(argc) {
@@ -3923,7 +3909,7 @@
 PHP_METHOD(swfmovie, saveToFile)
 {
        zval *x;
-       int limit = -1;
+       long limit = -1;
 #if !defined(HAVE_NEW_MING)
        int oldval = INT_MIN;
 #endif
@@ -3962,7 +3948,7 @@
 PHP_METHOD(swfmovie, save)
 {
        zval *x;
-       int limit = -1;
+       long limit = -1;
 #if !defined(HAVE_NEW_MING)
        int oldval = INT_MIN;
 #endif
@@ -4077,7 +4063,7 @@
 PHP_METHOD(swfmovie, addMetadata)
 { 
        char *xml;
-       long xml_len;
+       int xml_len;
        
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
   
@@ -4125,7 +4111,7 @@
 {
        zval *zchar;
        char *name;
-       long name_len;
+       int name_len;
        SWFCharacter character;
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
 
@@ -4144,7 +4130,7 @@
 {
        long offset;
        char *name;
-       long name_len;
+       int name_len;
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &offset, 
&name, &name_len) == FAILURE) {
@@ -4237,7 +4223,7 @@
 {
        zval *zchar;
        char *name;
-       long name_len;
+       int name_len;
        SWFBlock block;
        SWFMovie movie = getMovie(getThis() TSRMLS_CC);
 
@@ -4340,7 +4326,7 @@
        SWFFontCharacter res;
        int ret;
        char *libswf, *name;
-       long libswf_len, name_len;
+       int libswf_len, name_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &libswf, 
&libswf_len, &name, &name_len) == FAILURE) {
                return;
@@ -4516,7 +4502,7 @@
        if (ZEND_NUM_ARGS() == 1 || ZEND_NUM_ARGS() == 2) {
                /* it's a gradient or bitmap */
                zval *arg1;
-               unsigned char flags = 0;
+               long flags = 0;
 
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|l", 
&arg1, &flags) == FAILURE) {
                        return;
@@ -4725,8 +4711,8 @@
 {
        zval *font;
        char *c;
-       long c_len;
-       int size = (int)(1024.0f/Ming_getScale());
+       int c_len;
+       long size = (long)(1024.0f/Ming_getScale());
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|l", &font, &c, 
&c_len, &size) == FAILURE) {
                return;
@@ -5114,7 +5100,7 @@
 PHP_METHOD(swfsprite, labelFrame)
 {
        char *label;
-       long label_len;
+       int label_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, 
&label_len) == FAILURE) {
                return;
@@ -5131,7 +5117,7 @@
        long frames;
        SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &frames) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == 
FAILURE) {
                return;
        }
 
@@ -5433,7 +5419,7 @@
 PHP_METHOD(swftext, addString)
 {
        char *s;
-       long s_len;
+       int s_len;
        SWFText text = getText(getThis() TSRMLS_CC);
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) 
== FAILURE) {
@@ -5452,7 +5438,7 @@
 PHP_METHOD(swftext, addUTF8String)
 {
        char *s;
-       long s_len;
+       int s_len;
        SWFText text = getText(getThis() TSRMLS_CC);
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) 
== FAILURE) {
@@ -5470,7 +5456,7 @@
 PHP_METHOD(swftext, addWideString)
 {
        char *s;
-       long s_len;
+       int s_len;
        SWFText text = getText(getThis() TSRMLS_CC);
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) 
== FAILURE) {
@@ -5488,7 +5474,7 @@
 PHP_METHOD(swftext, getWidth)
 {
        char *string;
-       long string_len;
+       int string_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
                return;
@@ -5505,7 +5491,7 @@
 PHP_METHOD(swftext, getUTF8Width)
 {
        char *string;
-       long string_len;
+       int string_len;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
                return;
@@ -5521,7 +5507,7 @@
 PHP_METHOD(swftext, getWideWidth)
 {
        char *string;
-       long string_len;
+       int string_len;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, 
&string_len) == FAILURE) {
                return;
@@ -5802,7 +5788,7 @@
 PHP_METHOD(swftextfield, setName)
 {
        char *name;
-       long name_len;
+       int name_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, 
&name_len) == FAILURE) {
                return;
@@ -5817,7 +5803,7 @@
 PHP_METHOD(swftextfield, addString)
 {
        char *str;
-       long str_len;
+       int str_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
                return;
@@ -5832,7 +5818,7 @@
 PHP_METHOD(swftextfield, addUTF8String)
 {
        char *str;
-       long str_len;
+       int str_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
                return;
@@ -5863,7 +5849,7 @@
 PHP_METHOD(swftextfield, addChars)
 {
        char *str;
-       long str_len;
+       int str_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
                return;
@@ -5957,7 +5943,7 @@
 /* }}} */
 
 #if PHP_API_VERSION == 20020918
-static php4_fix_funcnames(char *class_name, zend_function_entry *funcs)
+static php4_fix_funcnames(char *class_name, zend_function_entry *funcs) /* {{{ 
*/
 {
        zend_function_entry *pf = funcs;
        char *pname;
@@ -5973,10 +5959,11 @@
                funcs++;
        }
 }
+/* }}} */
 #endif
 
 /* custom error handler propagates ming errors up to php */
-static void php_ming_error(const char *msg, ...)
+static void php_ming_error(const char *msg, ...) /* {{{ */
 {
        va_list args;
        char *buffer;
@@ -5990,8 +5977,9 @@
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s", buffer);
        efree(buffer);
 }
+/* }}} */
 
-PHP_RINIT_FUNCTION(ming)
+PHP_RINIT_FUNCTION(ming) /* {{{ */
 {
        /* XXX - this didn't work so well last I tried.. */
 
@@ -6001,6 +5989,7 @@
        }
        return SUCCESS;
 }
+/* }}} */
 
 /* {{{ todo PHP_MINIT_FUNCTION(ming)
 */

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

Reply via email to