]> granicus.if.org Git - php/commitdiff
fix #38961 (metaphone() results in segmentation fault on NetBSD)
authorAntony Dovgal <tony2001@php.net>
Wed, 27 Sep 2006 08:31:35 +0000 (08:31 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 27 Sep 2006 08:31:35 +0000 (08:31 +0000)
ext/standard/metaphone.c

index 6ba00cf15110466bf0ffc23dfb325569a943db45..86e96f9a58290b98199534de58e058c5cb0ba936 100644 (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 */