Re: cvs: php4 /ext/standard string.c
| From: | Andi Gutmans | Date: | Mon, 10 Sep 2001 04:18:24 +0000 |
| Subject: | Re: cvs: php4 /ext/standard string.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-7354@lists.php.net to get a copy of this message | ||
When I fixed MAC OS X support for PHP a while ago I took line endings as "\r" and not "\n\r". This is what several people told me who were using MAC's. Any idea who was right?
Andi
At 11:42 AM 9/9/2001 +0000, Derick Rethans wrote:
derick Sun Sep 9 07:42:37 2001 EDTModified files:/php4/ext/standard string.cLog: - Fix for bug 11904 #- This is possibly not the best solution... feel free to improve Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.237 php4/ext/standard/string.c:1.238--- php4/ext/standard/string.c:1.237 Thu Sep 6 04:56:24 2001+++ php4/ext/standard/string.c Sun Sep 9 07:42:36 2001 @@ -18,7 +18,7 @@+----------------------------------------------------------------------+*/ -/* $Id: string.c,v 1.237 2001/09/06 08:56:24 sterling Exp $ */ +/* $Id: string.c,v 1.238 2001/09/09 11:42:36 derick Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2978,14 +2978,27 @@ PHP_FUNCTION(nl2br) {zval **str; + char* tmp; + int new_length;if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str)==FAILURE) { WRONG_PARAM_COUNT; }convert_to_string_ex(str);-- php_char_to_str((*str)->value.str.val, (*str)->value.str.len,'\n', "<br />\n", 7, return_value);++ /* Windows style line-endings */ + tmp = boyer_str_to_str((*str)->value.str.val, (*str)->value.str.len, "\r\n", 2, "<br />\r\n", 8, &new_length); + if (new_length != (*str)->value.str.len) + RETURN_STRINGL (tmp, new_length, 0); + efree (tmp); + /* Mac style line-endings */ + tmp = boyer_str_to_str((*str)->value.str.val, (*str)->value.str.len, "\n\r", 2, "<br />\n\r", 8, &new_length); + if (new_length != (*str)->value.str.len) + RETURN_STRINGL (tmp, new_length, 0); + efree (tmp); + /* Unix style line-endings */ + php_char_to_str((*str)->value.str.val,(*str)->value.str.len, '\n',"<br />\n", 7, return_value);} /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net