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

Thomas Moenicke tm at php-qt.org
Fri Sep 7 13:19:32 UTC 2007


SVN commit 709415 by moenicke:

* replaced code in php_to_primitive<char*> method by a QByteArray
* adding Q_UNUSED() for uic
* allocating more memory for the argument stack (double marshalling caused malloc errors)

CCMAIL: kde-bindings at kde.org



 M  +3 -5      marshall_primitives.h  
 M  +2 -3      marshall_types.cpp  
 M  +1 -0      php_qt.cpp  


--- trunk/playground/bindings/phpqt/php_qt/marshall_primitives.h #709414:709415
@@ -210,11 +210,9 @@
 	if(rv == Qnil)
 		return 0;
 
-	int len = rv->value.str.len;
-	char* mem = (char*) malloc(len+1);
-	memcpy(mem, rv->value.str.val, len);
-	mem[len] ='\0';
-	return (char*) mem;
+	QByteArray* b = new QByteArray(rv->value.str.val);
+	return (char*) b->constData();
+	
 }
 
 template <>
--- trunk/playground/bindings/phpqt/php_qt/marshall_types.cpp #709414:709415
@@ -460,7 +460,7 @@
  */
 
 MethodCall::MethodCall(Smoke *smoke, Smoke::Index method, zval* target, zval ***sp, int items, zval *retval, zval** return_value_ptr) :
- 	MethodCallBase(smoke,method,return_value_ptr), _target(target), _current_object(0), _sp(sp), _items(items), _retval(retval)
+ 	MethodCallBase(smoke,method,return_value_ptr), _target(target), _current_object(0), _sp(sp), _retval(retval)
 {
     if(target != NULL)
     {
@@ -478,8 +478,7 @@
     _args = _smoke->argumentList + _smoke->methods[_method].args;
     _items = _smoke->methods[_method].numArgs;
 
-    _stack = new Smoke::StackItem[items + 1];
-
+    _stack = new Smoke::StackItem[items + 2];
 }
 
 MethodCall::~MethodCall()
--- trunk/playground/bindings/phpqt/php_qt/php_qt.cpp #709414:709415
@@ -95,6 +95,7 @@
 	PHP_FE(qobject_cast,	phpqt_cast_arginfo)
 	PHP_FE(tr,	NULL)
 	PHP_FE(check_qobject,	NULL)
+	PHP_FE(Q_UNUSED,	NULL)
 	{NULL, NULL, NULL}	/* Must be the last line in php_qt_functions[] */
 };
 



More information about the Kde-bindings mailing list