Re: [patch] ext/fribidi
| From: | Andi Gutmans | Date: | Sun, 15 Sep 2002 09:08:03 +0000 |
| Subject: | Re: [patch] ext/fribidi | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-88324@lists.php.net to get a copy of this message | ||
Do you have a CVS account so that I can give you karma?
Andi
At 10:49 AM 9/15/2002 +0200, Tal Peer wrote:
Hello, This patch to fribidi does the following: - Make it compile ;) - Fix a little memory leak (detected by Ilia) - Use php_error_docref PS.: I would like to maintain the fribidi extension from now on. Tal Index: config.m4 =================================================================== RCS file: /repository/php4/ext/fribidi/config.m4,v retrieving revision 1.8 diff -u -r1.8 config.m4--- config.m4 12 Mar 2002 16:18:13 -0000 1.8+++ config.m4 14 Sep 2002 20:29:58 -0000 @@ -36,10 +36,10 @@ dnl check for glib header files - AC_MSG_CHECKING([for glibconfig.h in "usr/lib/glib/include/"]) - if test -f /usr/lib/glib/include/glibconfig.h ; then + AC_MSG_CHECKING([for glib header files]) + if test -fwhich glib-config; thenAC_MSG_RESULT([found]) - GLIB_INCDIR=/usr/lib/glib/include/ + GLIB_INCDIR=elseglib-config --cflagsAC_MSG_RESULT([missing])fi @@ -67,7 +67,7 @@AC_MSG_RESULT([yes])PHP_ADD_INCLUDE("$FRIBIDI_INCDIR") - PHP_ADD_INCLUDE("$GLIB_INCDIR") + PHP_EVAL_INCLINE("$GLIB_INCDIR") PHP_ADD_LIBRARY_WITH_PATH(fribidi,"$FRIBIDI_LIBDIR", FRIBIDI_SHARED_LIBADD)AC_DEFINE(HAVE_FRIBIDI, 1, [ ])Index: fribidi.c =================================================================== RCS file: /repository/php4/ext/fribidi/fribidi.c,v retrieving revision 1.14 diff -u -r1.14 fribidi.c--- fribidi.c 15 Aug 2002 21:43:41 -0000 1.14+++ fribidi.c 14 Sep 2002 20:29:58 -0000 @@ -134,8 +134,8 @@FriBidiCharType base_dir;- guint16 *position_L_to_V_list; - guint16 *position_V_to_L_list; + FriBidiStrIndex *position_L_to_V_list; + FriBidiStrIndex *position_V_to_L_list; guint8 *embedding_level_list;/* get parameters from input */@@ -162,8 +162,8 @@u_logical_str = (FriBidiChar*) emalloc(sizeof(FriBidiChar)*alloc_len); u_visual_str = (FriBidiChar*) emalloc(sizeof(FriBidiChar)*alloc_len);- position_L_to_V_list = (guint16*) emalloc(sizeof(guint16)*alloc_len); - position_V_to_L_list = (guint16*) emalloc(sizeof(guint16)*alloc_len); + position_L_to_V_list = (FriBidiStrIndex*) emalloc(sizeof(FriBidiStrIndex)*alloc_len); + position_V_to_L_list = (FriBidiStrIndex*) emalloc(sizeof(FriBidiStrIndex)*alloc_len); embedding_level_list = (guint8*) emalloc(sizeof(guint8)*alloc_len);outString = (guchar*)emalloc(sizeof(guchar)*alloc_len);@@ -174,25 +174,32 @@switch(Z_LVAL_PP(parameter3)) { case FRIBIDI_CHARSET_UTF8: - utf8_len=fribidi_utf8_to_unicode(inString, u_logical_str); + utf8_len=fribidi_utf8_to_unicode(inString, len, u_logical_str); break; case FRIBIDI_CHARSET_ISO8859_6: - fribidi_iso8859_6_to_unicode(inString, u_logical_str); + fribidi_iso8859_6_to_unicode(inString, len, u_logical_str); break; case FRIBIDI_CHARSET_ISO8859_8: - fribidi_iso8859_8_to_unicode(inString, u_logical_str); + fribidi_iso8859_8_to_unicode(inString, len, u_logical_str); break; case FRIBIDI_CHARSET_CP1255: - fribidi_cp1255_to_unicode(inString, u_logical_str); + fribidi_cp1255_to_unicode(inString, len, u_logical_str); break; case FRIBIDI_CHARSET_CP1256: - fribidi_cp1256_to_unicode(inString, u_logical_str); + fribidi_cp1256_to_unicode(inString, len, u_logical_str); break; case FRIBIDI_CHARSET_ISIRI_3342: - fribidi_isiri_3342_to_unicode(inString, u_logical_str); + fribidi_isiri_3342_to_unicode(inString, len, u_logical_str); break; default: - zend_error(E_ERROR,"unknown character set %d<br />", Z_LVAL_PP(parameter3)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown charset"); + efree(u_logical_str); + efree(u_visual_str); + efree(position_L_to_V_list); + efree(position_V_to_L_list); + efree(embedding_level_list); + efree(outString); + RETURN_FALSE; }Index: php_fribidi.h =================================================================== RCS file: /repository/php4/ext/fribidi/php_fribidi.h,v retrieving revision 1.8 diff -u -r1.8 php_fribidi.h--- php_fribidi.h 9 Sep 2002 09:44:52 -0000 1.8 +++ php_fribidi.h 14 Sep 2002 20:29:59 -0000@@ -23,6 +23,7 @@ #include "fribidi.h" #include "../standard/info.h" +#include <glib.h> extern zend_module_entry fribidi_module_entry; #define phpext_fribidi_ptr &fribidi_module_entry -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php