[Kde-bindings] playground/bindings/phpqt/src

Thomas Moenicke tm at php-qt.org
Sat Sep 22 20:36:15 UTC 2007


SVN commit 715666 by moenicke:

* improved smokephp_getMethod() which now finds ambiguous methods more safely
* fixed wrong return type in qRound()

CCMAIL: kde-bindings at kde.org



 M  +7 -7      functions.cpp  
 M  +6 -2      smokephp.cpp  


--- trunk/playground/bindings/phpqt/src/functions.cpp #715665:715666
@@ -210,13 +210,13 @@
  * if decimal is greater than .5 it rounds up, otherwise it rounds down
  */
 PHP_FUNCTION(qRound) {
-	double x;
-
-	if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"d",&x)==FAILURE) {
-		php_error(E_PARSE,"wrong parameters for qRound");
-		return;
-	}
-	RETURN_DOUBLE(x >= 0.00 ? (int)(x+0.5) : (int)(x - (int)(x-1) + 0.5) + (int)(x-1));
+    double x;
+    
+    if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"d",&x)==FAILURE) {
+	php_error(E_PARSE,"wrong parameters for qRound");
+	return;
+    }
+    RETURN_LONG(x >= 0.00 ? (int)(x+0.5) : (int)(x - (int)(x-1) + 0.5) + (int)(x-1));
 }
 
 /**
--- trunk/playground/bindings/phpqt/src/smokephp.cpp #715665:715666
@@ -148,7 +148,7 @@
 		// try to compare smoke types with the php ones
 		bool right = false;
 		for(int k=0;k < argc;k++){
-		    uint type = ((int) ((zval) **args[k]).type);
+		    uint type = static_cast<uint>( (**args[k]).type );
 		    switch((PQ::smoke()->types[PQ::smoke()->argumentList[PQ::smoke()->methods[PQ::smoke()->ambiguousMethodList[i]].args+k]].flags & Smoke::tf_elem)){
 		    case Smoke::t_voidp:
 			if(type == IS_ARRAY)
@@ -187,7 +187,11 @@
 					PQ::smoke()->argumentList[
 					    PQ::smoke()->methods[
 						PQ::smoke()->ambiguousMethodList[i]].args+k]].name);
-			    if(name->contains(Z_OBJCE_P((zval*) *args[k])->name))
+			    name->replace("const ","");
+			    name->replace("*","");
+			    name->replace("&","");
+
+			    if( *name == QByteArray(Z_OBJCE_P( static_cast<zval*> (*args[k]))->name ))
 				right = true;
 			}
 			break;



More information about the Kde-bindings mailing list