Antony Dovgal wrote:
On 11.08.2008 21:54, Phil Oleson wrote:
Was running pspell through g++ and found that a couple of error
conditions segments in pspell.c
are using the wrong cleanup methods. delete_pspell_manager() should
be delete_pspell_can_have_error()
We'd certainly need some more details to get this patch committed, not
just "this should that".
Well I thought the patch was fairly simple but if you'd like a full
explination..
g++ -I. -I/usr/home/phil/vps2/user/contrib/php5/ext/pspell -DPHP_ATOM_INC
-I/usr/home/phil/vps2/user/contrib/php5/ext/pspell/include
-I/usr/home/phil/vps2/user/contrib/php5/ext/pspell/main
-I/usr/home/phil/vps2/user/contrib/php5/ext/pspell
-I/usr/local/php5/include/php -I/usr/local/php5/include/php/main
-I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend
-I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib
-I/usr/local/include/pspell -DHAVE_CONFIG_H -g -O2 -c
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c -fPIC -DPIC -o
.libs/pspell.o
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c: In function `void
zif_pspell_new(int, zval*, zval**, zval*, int)':
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c:254: error: cannot
convert `AspellCanHaveError*' to `AspellSpeller*' for argument `1' to `void
delete_aspell_speller(AspellSpeller*)'
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c: In function `void
zif_pspell_new_personal(int, zval*, zval**, zval*, int)':
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c:377: error: cannot
convert `AspellCanHaveError*' to `AspellSpeller*' for argument `1' to `void
delete_aspell_speller(AspellSpeller*)'
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c: In function `void
zif_pspell_new_config(int, zval*, zval**, zval*, int)':
/usr/home/phil/vps2/user/contrib/php5/ext/pspell/pspell.c:411: error: cannot
convert `AspellCanHaveError*' to `AspellSpeller*' for argument `1' to `void
delete_aspell_speller(AspellSpeller*)'
as you can see we are using the wrong destructor in these three cases. Looking
at the code you find:
PspellCanHaveError *ret;
<snip>
ret = new_pspell_manager(config);
delete_pspell_config(config);
if(pspell_error_number(ret) != 0){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the
dictionary. reason: %s ", pspell_error_message(ret));
delete_pspell_manager(ret);
RETURN_FALSE;
}
----
do a little grep'ing and we find the prototype is..
grep delete_pspell_manager /usr/local/include/pspell/pspell.h
#define delete_pspell_manager delete_aspell_speller
grep delete_aspell_speller /usr/local/include/aspell.h
void delete_aspell_speller(struct AspellSpeller * ths);
I do a little detective work and find...
grep delete_aspell_can_have_error /usr/local/include/aspell.h
void delete_aspell_can_have_error(struct AspellCanHaveError * ths);
transpose this to the pspell wrapper..
grep delete_aspell_can_have_error /usr/local/include/pspell/pspell.h
#define delete_pspell_can_have_error delete_aspell_can_have_error
Thus the diff -u I sent in.. which resolves the above compiler failure with g++.
-Phil.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php