Re: php source q's >> closer ..

From: Date: Tue, 26 Jul 2005 18:08:46 +0000
Subject: Re: php source q's >> closer ..
References: 1 2 3 4 5  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1473@lists.php.net to get a copy of this message
Since you are NULL-terminating the list, you need to allocate len+1 entries. As far as the warning, it's probably because the function accepts "const gchar **" and you are passing "gchar **". Just declare list as "const gchar** list" and see if it works. -Andrei On Jul 26, 2005, at 9:28 AM, Simon Wheeler wrote:
lol , the errors I were getting were related to me trying to output len elsewhere for debugging , cost me an hour or so ~ , anyway I got this working , though I am sure the code is shonky . I will try and prune it a bit ... how do I get the current key from ... while (zend_hash_get_current_data( etc ? so I can lose the i++ etc ? also during make I get this.. ext/gtk+/gen_gtk.c: In function 'zif_GtkAboutDialog_set_documenters': ext/gtk+/gen_gtk.c:27355: warning: passing argument 2 of 'gtk_about_dialog_set_documenters' from incompatible pointer type I see that in a lot of other places , what does that mean & how is `it cured` /*****************working**********************/ static PHP_METHOD(GtkAboutDialog, set_documenters) { int len, i=0; zval *php_list, **item; gchar **list; HashTable *args_hash; NOT_STATIC_METHOD(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &php_list) == FAILURE ) {
       return;
} args_hash = HASH_OF(php_list); len = zend_hash_num_elements(args_hash); list = g_new( gchar *, len ) ; zend_hash_internal_pointer_reset(Z_ARRVAL_P(php_list)); while (zend_hash_get_current_data(Z_ARRVAL_P(php_list), (void **)&item) == SUCCESS) {
       convert_to_string_ex( item ) ;
       list[i] = Z_STRVAL_PP( item ) ;
       i++;
       zend_hash_move_forward(Z_ARRVAL_P(php_list)) ;
} list[i]=NULL; gtk_about_dialog_set_documenters( GTK_ABOUT_DIALOG(PHPG_GOBJECT(this_ptr)), list ) ; g_free(list); } <?php ...... $dialog->set_documenters( array('Andrei' ,'Steph' , 'Christian' , 'Scott' ,'etc ' , 'etc' ) ) ; Regards, Simon.


« previous php.gtk.dev (#1473) next »