MFH: fix #38961 (metaphone() results in segmentation fault on NetBSD)

This commit is contained in:
Antony Dovgal 2006-09-27 08:32:24 +00:00
parent 4b286026c3
commit b805c9e089
2 changed files with 5 additions and 3 deletions

2
NEWS
View File

@ -6,6 +6,8 @@ PHP NEWS
- Fixed mess with CGI/CLI -d option (now it works with cgi; constants are
working exactly like in php.ini; with FastCGI -d affects all requests).
(Dmitry)
- Fixed bug #38961 (metaphone() results in segmentation fault on NetBSD).
(Tony)
- Fixed bug #38942 (Double old-style-ctor inheritance). (Dmitry)
- Fixed bug #38941 (imap extension does not compile against new version of
the imap library). (Ilia)

View File

@ -25,7 +25,7 @@
#include "php.h"
#include "php_metaphone.h"
static int metaphone(char *word, int word_len, long max_phonemes, char **phoned_word, int traditional);
static int metaphone(unsigned char *word, int word_len, long max_phonemes, char **phoned_word, int traditional);
/* {{{ proto string metaphone(string text[, int phones])
Break english phrases down into their phonemes */
@ -41,7 +41,7 @@ PHP_FUNCTION(metaphone)
return;
}
if (metaphone(str, str_len, phones, &result, 1) == 0) {
if (metaphone((unsigned char *)str, str_len, phones, &result, 1) == 0) {
RETVAL_STRING(result, 0);
} else {
if (result) {
@ -159,7 +159,7 @@ static char Lookahead(char *word, int how_far)
/* {{{ metaphone
*/
static int metaphone(char *word, int word_len, long max_phonemes, char **phoned_word, int traditional)
static int metaphone(unsigned char *word, int word_len, long max_phonemes, char **phoned_word, int traditional)
{
int w_idx = 0; /* point in the phonization we're at. */
int p_idx = 0; /* end of the phoned phrase */