[php-i18n-commits] cvs commit: php4/ext/mbstring mbstring.c mbstring.h

Back to archive index

Tsukada ttsuk****@users*****
2002年 6月 5日 (水) 06:40:20 JST


ttsukada    02/06/05 06:40:20

  Modified:    ext/mbstring mbstring.c mbstring.h
  Log:
  added mb_converter_flush()
  
  Revision  Changes    Path
  1.12      +40 -5     php4/ext/mbstring/mbstring.c
  
  Index: mbstring.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mbstring.c	3 Jun 2002 18:29:50 -0000	1.11
  +++ mbstring.c	4 Jun 2002 21:40:20 -0000	1.12
  @@ -282,6 +282,7 @@
   	PHP_FALIAS(free,				mb_converter_free,			NULL)
   	PHP_FALIAS(clear,				mb_converter_clear,			NULL)
   	PHP_FALIAS(feed,				mb_converter_feed,			NULL)
  +	PHP_FALIAS(flush,				mb_converter_flush,			NULL)
   	PHP_FALIAS(extract,				mb_converter_extract,		NULL)
   	PHP_FALIAS(length,				mb_converter_length,		NULL)
   	PHP_FALIAS(byte_len,			mb_converter_byte_len,		NULL)
  @@ -5851,6 +5852,36 @@
   }
   /* }}} */
   
  +/* {{{ proto bool mb_converter_flush(object converter)
  +    */
  +PHP_FUNCTION(mb_converter_flush)
  +{
  +	zval **arg_obj, *object, **objid;
  +	int type;
  +	php_mb_bufconv *convd;
  +
  +	PHP_MB_ERRRST();
  +	arg_obj = NULL;
  +	if (ZEND_NUM_ARGS() != 0 &&
  +	   (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_obj) == FAILURE)) {
  +		WRONG_PARAM_COUNT;
  +	}
  +
  +	objid = NULL;
  +	type = 0;
  +	convd = NULL;
  +	PHP_MB_CHECK_OBJECT(object, arg_obj);
  +	PHP_MB_FETCH_CONVERTER(object, objid, type, convd);
  +	php_mb_bufconv_flush(convd  TSRMLS_CC);
  +	if (PHP_MB_IS_ERROR()) {
  +		php_mb_error();
  +		RETVAL_FALSE;
  +	} else {
  +		RETVAL_TRUE;
  +	}
  +}
  +/* }}} */
  +
   /* {{{ proto string mb_converter_extract(object converter)
       */
   PHP_FUNCTION(mb_converter_extract)
  @@ -5906,12 +5937,16 @@
   	PHP_MB_CHECK_OBJECT(object, arg_obj);
   	PHP_MB_FETCH_CONVERTER(object, objid, type, convd);
   
  -	result = _php_mb_strlen(convd->string->value, convd->string->length, convd->string->encoding  TSRMLS_DC);
  -	if (PHP_MB_IS_ERROR()) {
  -		php_mb_error();
  -		RETVAL_FALSE;
  +	if (convd->string->value == NULL || convd->string->length == 0) {
  +		RETVAL_LONG(0);
   	} else {
  -		RETVAL_LONG(result);
  +		result = _php_mb_strlen(convd->string->value, convd->string->length, convd->string->encoding  TSRMLS_DC);
  +		if (PHP_MB_IS_ERROR()) {
  +			php_mb_error();
  +			RETVAL_FALSE;
  +		} else {
  +			RETVAL_LONG(result);
  +		}
   	}
   }
   /* }}} */
  
  
  
  1.8       +1 -0      php4/ext/mbstring/mbstring.h
  
  Index: mbstring.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mbstring.h	3 Jun 2002 18:29:50 -0000	1.7
  +++ mbstring.h	4 Jun 2002 21:40:20 -0000	1.8
  @@ -162,6 +162,7 @@
   PHP_FUNCTION(mb_converter_free);
   PHP_FUNCTION(mb_converter_clear);
   PHP_FUNCTION(mb_converter_feed);
  +PHP_FUNCTION(mb_converter_flush);
   PHP_FUNCTION(mb_converter_extract);
   PHP_FUNCTION(mb_converter_length);
   PHP_FUNCTION(mb_converter_byte_len);
  
  
  



php-i18n-commits メーリングリストの案内
Back to archive index