[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard metaphone.c /ext/standard/tests/strings bug48709.phpt

2009-06-30 Thread Felipe Pena
felipe  Tue Jun 30 11:46:20 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug48709.phpt 

  Modified files:  
/php-src/ext/standard   metaphone.c 
  Log:
  - MFH: Fixed bug #48709 (metaphone and 'wh')
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.4.2.5r2=1.28.2.1.2.4.2.6diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.5 
php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.6
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.5   Wed Feb 18 22:34:06 2009
+++ php-src/ext/standard/metaphone.cTue Jun 30 11:46:20 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: metaphone.c,v 1.28.2.1.2.4.2.5 2009/02/18 22:34:06 felipe Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.4.2.6 2009/06/30 11:46:20 felipe Exp $ */
 
 /*
Based on CPANs Text-Metaphone-1.96 by Michael G Schwern 
schw...@pobox.com 
@@ -225,15 +225,14 @@
w_idx += 2;
}
break;
-   /* WH becomes H, 
+   /* WH becomes W, 
   WR becomes R 
   W if followed by a vowel */
case 'W':
-   if (Next_Letter == 'H' ||
-   Next_Letter == 'R') {
+   if (Next_Letter == 'R') {
Phonize(Next_Letter);
w_idx += 2;
-   } else if (isvowel(Next_Letter)) {
+   } else if (Next_Letter == 'H' || isvowel(Next_Letter)) {
Phonize('W');
w_idx += 2;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug48709.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug48709.phpt
+++ php-src/ext/standard/tests/strings/bug48709.phpt
--TEST--
Bug #48709 (metaphone and 'wh')
--FILE--
?php

/* Initial letter exceptions */
$exceptions = array(
'kn', // Drop first letter
'gn', // ditto
'pn', // ditto
'ae', // ditto
'wr', // ditto
'x',  // s
'wh', // w
'wa'  // w
);  

foreach ($exceptions as $letter) {
printf(%s = %s\n, $letter, metaphone($letter));
}

?
--EXPECT--
kn = N
gn = N
pn = N
ae = E
wr = R
x = S
wh = W
wa = W



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard metaphone.c

2009-02-18 Thread Felipe Pena
felipe  Wed Feb 18 22:34:06 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   metaphone.c 
  Log:
  - MFH: Fixed bug #47443 (metaphone('scratch') returns wrong result)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.4.2.4r2=1.28.2.1.2.4.2.5diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.4 
php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.5
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.4   Wed Dec 31 11:15:45 2008
+++ php-src/ext/standard/metaphone.cWed Feb 18 22:34:06 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: metaphone.c,v 1.28.2.1.2.4.2.4 2008/12/31 11:15:45 sebastian Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.4.2.5 2009/02/18 22:34:06 felipe Exp $ */
 
 /*
Based on CPANs Text-Metaphone-1.96 by Michael G Schwern 
schw...@pobox.com 
@@ -421,7 +421,7 @@
} else if (Next_Letter == 'H') {
Phonize(TH);
skip_letter++;
-   } else {
+   } else if (!(Next_Letter == 'C'  After_Next_Letter == 
'H')) {
Phonize('T');
}
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard metaphone.c

2008-02-26 Thread Felipe Pena
felipe  Wed Feb 27 01:19:05 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   metaphone.c 
  Log:
  MFB: Improved fix for #44242
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.4.2.2r2=1.28.2.1.2.4.2.3diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.2 
php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.3
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.2   Mon Feb 25 22:54:57 2008
+++ php-src/ext/standard/metaphone.cWed Feb 27 01:19:05 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: metaphone.c,v 1.28.2.1.2.4.2.2 2008/02/25 22:54:57 felipe Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.4.2.3 2008/02/27 01:19:05 felipe Exp $ */
 
 /*
Based on CPANs Text-Metaphone-1.96 by Michael G Schwern [EMAIL 
PROTECTED] 
@@ -144,7 +144,7 @@
  * could be one though; or more too). */
 #define Phonize(c) { \
if (p_idx = max_buffer_len) { \
-   *phoned_word = 
erealloc(*phoned_word, max_buffer_len + 2); \
+   *phoned_word = 
safe_erealloc(*phoned_word, 2, sizeof(char), max_buffer_len); \
max_buffer_len += 2; \
} \
(*phoned_word)[p_idx++] = c; \
@@ -152,7 +152,7 @@
 /* Slap a null character on the end of the phoned word */
 #define End_Phoned_Word{ \
if (p_idx == 
max_buffer_len) { \
-   *phoned_word = 
erealloc(*phoned_word, max_buffer_len + 1); \
+   *phoned_word = 
safe_erealloc(*phoned_word, 1, sizeof(char), max_buffer_len); \
} \
(*phoned_word)[p_idx] = 
'\0'; \
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard metaphone.c /ext/standard/tests/strings bug44242.phpt

2008-02-25 Thread Felipe Pena
felipe  Mon Feb 25 22:54:58 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug44242.phpt 

  Modified files:  
/php-src/ext/standard   metaphone.c 
  Log:
  MFB: Fixed bug #44242 (metaphone('CMXFXM') crashes PHP)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.4.2.1r2=1.28.2.1.2.4.2.2diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.1 
php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.2
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.1   Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/metaphone.cMon Feb 25 22:54:57 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: metaphone.c,v 1.28.2.1.2.4.2.1 2007/12/31 07:17:15 sebastian Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.4.2.2 2008/02/25 22:54:57 felipe Exp $ */
 
 /*
Based on CPANs Text-Metaphone-1.96 by Michael G Schwern [EMAIL 
PROTECTED] 
@@ -150,7 +150,12 @@
(*phoned_word)[p_idx++] = c; \
}
 /* Slap a null character on the end of the phoned word */
-#define End_Phoned_Word{(*phoned_word)[p_idx] = '\0';}
+#define End_Phoned_Word{ \
+   if (p_idx == 
max_buffer_len) { \
+   *phoned_word = 
erealloc(*phoned_word, max_buffer_len + 1); \
+   } \
+   (*phoned_word)[p_idx] = 
'\0'; \
+   }
 /* How long is the phoned word? */
 #define Phone_Len  (p_idx)
 

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug44242.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug44242.phpt
+++ php-src/ext/standard/tests/strings/bug44242.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php