GdkPixbuf::get_pixels seems to be wrong, i think
| From: | xxoes | Date: | Wed, 01 Mar 2006 10:47:10 +0000 |
| Subject: | GdkPixbuf::get_pixels seems to be wrong, i think | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2469@lists.php.net to get a copy of this message | ||
static PHP_METHOD(GdkPixbuf, get_pixels)
{
const gchar *php_retval;
gchar *cp_ret;
gsize cp_len;
zend_bool free_result;
NOT_STATIC_METHOD();
if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
return;php_retval = gdk_pixbuf_get_pixels(GDK_PIXBUF(PHPG_GOBJECT(this_ptr))); if (php_retval) {
cp_ret = phpg_from_utf8(php_retval, strlen(php_retval), &cp_len, &free_result TSRMLS_CC);
if (cp_ret) {
RETVAL_STRINGL((char *)cp_ret, cp_len, 1);
} else {
php_error(E_WARNING, "%s::%s(): could not convert return value from UTF-8", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
}
if (free_result)
g_free(cp_ret);
} else {
RETVAL_NULL();} } I think its wrong, because gdk_pixbuf_get_pixels return a pointer to a binary memory area and not to a string that can be converted to/from UTF-8. php_retval = gdk_pixbuf_get_pixels(pixbuf); cp_len = gdk_pixbuf_get_rowstride(pixbuf)*gdk_pixbuf_get_height(pixbuf); RETVAL_STRINGL((char *)php_retval, cp_len, 1); mfg xxoes sorry for my english ;)