#37455 [NEW]: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
| From: | cweiske@php.net | Date: | Tue, 16 May 2006 04:32:47 +0000 |
| Subject: | #37455 [NEW]: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2852@lists.php.net to get a copy of this message | ||
From: cweiske@php.net
Operating system: Any
PHP version: 5.1.4
PHP Bug Type: PHP-GTK related
Bug description: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
Description:
------------
Attached is a patch for
gtk_selection_data_set_uris/gtk_selection_data_get_uris. It can be found
at
http://xml.cweiske.de/selectiondata.diff
Reproduce code:
---------------
--- ext/gtk+/gtk.overrides2006-05-16 06:28:22.000000000 +0200
+++ ../gtk.overrides2006-05-16 06:28:03.000000000 +0200
@@ -750,6 +750,13 @@
}
%%
+add-arginfo GtkAboutDialog set_artists
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+ ZEND_ARG_INFO(0, artists)
+ZEND_END_ARG_INFO();
+
+%%
override gtk_about_dialog_set_artists
PHP_METHOD
{
@@ -780,6 +787,13 @@
}
%%
+add-arginfo GtkAboutDialog set_authors
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+ ZEND_ARG_INFO(0, authors)
+ZEND_END_ARG_INFO();
+
+%%
override gtk_about_dialog_set_authors
PHP_METHOD
{
@@ -810,6 +824,13 @@
}
%%
+add-arginfo GtkAboutDialog set_documenters
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+ ZEND_ARG_INFO(0, documenters)
+ZEND_END_ARG_INFO();
+
+%%
override gtk_about_dialog_set_documenters
PHP_METHOD
{
@@ -2879,6 +2900,83 @@
%% }}}
+
+%% {{{ GtkSelectionData
+
+%%
+override gtk_selection_data_get_uris
+PHP_METHOD
+{
+ gchar **ret;
+ gchar *cp_str;
+ gsize cp_len;
+ zend_bool free_cp_str;
+ GtkSelectionData *selection_data = NULL;
+
+ if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
+ return;
+
+ selection_data = (GtkSelectionData *) PHPG_GBOXED(this_ptr);
+ ret = gtk_selection_data_get_uris(selection_data);
+ if (ret) {
+ array_init(return_value);
+ while (*ret) {
+ cp_str = phpg_from_utf8(*ret, strlen(*ret), &cp_len,
&free_cp_str TSRMLS_CC);
+ if (cp_str) {
+ add_next_index_stringl(return_value, cp_str, cp_len,
!free_cp_str);
+ } else {
+ zval_dtor(return_value);
+ RETURN_NULL();
+ }
+ *ret++;
+ }
+// g_strfreev(*ret);
+ } else {
+ RETURN_NULL();
+ }
+}
+
+%%
+add-arginfo GtkSelectionData set_uris
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+ ZEND_ARG_INFO(0, uris)
+ZEND_END_ARG_INFO();
+
+%%
+override gtk_selection_data_set_uris
+PHP_METHOD
+{
+ gchar **uris;
+ zval *arr = NULL;
+ zval **data;
+ int i, arr_count;
+ GtkSelectionData *selection_data = NULL;
+
+ if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "a", &arr)) {
+ return;
+ }
+
+ arr_count = zend_hash_num_elements(Z_ARRVAL_P(arr));
+ uris = safe_emalloc(arr_count+1, sizeof (gchar *), 0);
+
+ for (i=0, zend_hash_internal_pointer_reset(Z_ARRVAL_P(arr));
+ zend_hash_get_current_data(Z_ARRVAL_P(arr), (void **)&data) ==
SUCCESS;
+ zend_hash_move_forward(Z_ARRVAL_P(arr))) {
+
+ convert_to_string_ex(data);
+ uris[i++] = Z_STRVAL_PP(data);
+
+ }
+
+ uris[i] = NULL;
+ selection_data = (GtkSelectionData *) PHPG_GBOXED(this_ptr);
+ gtk_selection_data_set_uris(selection_data, (gchar **)uris);
+ efree(uris);
+}
+
+%% }}}
+
%% {{{ GtkSpinButton
%%
--
Edit bug report at http://bugs.php.net/?id=37455&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37455&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37455&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37455&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37455&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37455&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37455&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37455&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37455&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37455&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37455&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37455&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37455&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37455&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37455&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37455&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37455&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37455&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37455&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37455&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37455&r=mysqlcfg