cvs: php4 /ext/mbstring mbstring.c mbstring.h

From: Date: Fri, 05 Apr 2002 02:13:32 +0000
Subject: cvs: php4 /ext/mbstring mbstring.c mbstring.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10881@lists.php.net to get a copy of this message
yohgaki Thu Apr 4 21:13:32 2002 EDT Modified files: /php4/ext/mbstring mbstring.c mbstring.h Log: Fixed way of exporing functions. (Need PHPAPI for Win) Fixed if statement format. ("if () stmt;" should be "if () \n {stmt;}") Fixed error message so that appropriate function names are displayed. Index: php4/ext/mbstring/mbstring.c diff -u php4/ext/mbstring/mbstring.c:1.51 php4/ext/mbstring/mbstring.c:1.52 --- php4/ext/mbstring/mbstring.c:1.51 Thu Apr 4 20:23:22 2002 +++ php4/ext/mbstring/mbstring.c Thu Apr 4 21:13:32 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.51 2002/04/05 01:23:22 helly Exp $ */ +/* $Id: mbstring.c,v 1.52 2002/04/05 02:13:32 yohgaki Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -2017,8 +2017,8 @@ } /* }}} */ -/* {{{ */ -char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC) +/* {{{ php_mb_convert_encoding */ +PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC) { mbfl_string string, result, *ret; enum mbfl_no_encoding from_encoding, to_encoding; @@ -2026,15 +2026,18 @@ int size, *list; char *output; - if (output_len) *output_len = 0; + if (output_len) { + *output_len = 0; + } if ( !input || !length) { return NULL; } /* new encoding */ - if ( _to_encoding) { + if (_to_encoding) { to_encoding = mbfl_name2no_encoding(_to_encoding); if (to_encoding == mbfl_no_encoding_invalid) { - php_error(E_WARNING, "unknown encoding \"%s\"", _to_encoding); + php_error(E_WARNING, "%s() unknown encoding \"%s\"", _to_encoding, + get_active_function_name(TSRMLS_C)); return NULL; } } else { @@ -2064,13 +2067,15 @@ if (from_encoding != mbfl_no_encoding_invalid) { string.no_encoding = from_encoding; } else { - php_error(E_WARNING, "Unable to detect encoding in mb_convert_encoding()"); + php_error(E_WARNING, "%s() unable to detect character encoding", + get_active_function_name(TSRMLS_C)); from_encoding = mbfl_no_encoding_pass; to_encoding = from_encoding; string.no_encoding = from_encoding; } } else { - php_error(E_WARNING, "illegal from-encoding in mb_convert_encoding()"); + php_error(E_WARNING, "$s() illegal character encoding specified", + get_active_function_name(TSRMLS_C)); } if (list != NULL) { efree((void *)list); @@ -2080,7 +2085,8 @@ /* initialize converter */ convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len); if (convd == NULL) { - php_error(E_WARNING, "Unable to create converter in mb_convert_encoding()"); + php_error(E_WARNING, "%s() unable to create character encoding converter", + get_active_function_name(TSRMLS_C)); return NULL; } mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode)); @@ -2089,7 +2095,9 @@ /* do it */ ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret) { - if (output_len) *output_len = ret->len; + if (output_len) { + *output_len = ret->len; + } output = ret->val; } Index: php4/ext/mbstring/mbstring.h diff -u php4/ext/mbstring/mbstring.h:1.15 php4/ext/mbstring/mbstring.h:1.16 --- php4/ext/mbstring/mbstring.h:1.15 Thu Apr 4 20:23:22 2002 +++ php4/ext/mbstring/mbstring.h Thu Apr 4 21:13:32 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.h,v 1.15 2002/04/05 01:23:22 helly Exp $ */ +/* $Id: mbstring.h,v 1.16 2002/04/05 02:13:32 yohgaki Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -55,7 +55,9 @@ #include "mbfilter.h" -char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC); +#define PHP_MBSTRING_API 20020405 + +PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC); #if HAVE_MBREGEX #include "mbregex.h"

« previous php.cvs (#10881) next »