summaryrefslogtreecommitdiff
path: root/ext/intl/grapheme/grapheme_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl/grapheme/grapheme_string.c')
-rw-r--r--ext/intl/grapheme/grapheme_string.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 5caacb4f28..3968508c51 100644
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -44,9 +44,9 @@
*/
void grapheme_register_constants( INIT_FUNC_ARGS )
{
- REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT);
}
/* }}} */
@@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen)
ret_len = grapheme_ascii_check(string, string_len);
if ( ret_len >= 0 )
- RETURN_LONG(ret_len);
+ RETURN_INT(ret_len);
/* convert the string to UTF-16. */
status = U_ZERO_ERROR;
@@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen)
}
if (ret_len >= 0) {
- RETVAL_LONG(ret_len);
+ RETVAL_INT(ret_len);
} else {
RETVAL_FALSE;
}
@@ -111,11 +111,11 @@ PHP_FUNCTION(grapheme_strpos)
unsigned char *haystack, *needle;
int haystack_len, needle_len;
unsigned char *found;
- long loffset = 0;
+ php_int_t loffset = 0;
int32_t offset = 0;
int ret_pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strpos: unable to parse input param", 0 TSRMLS_CC );
@@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos)
/* if it is there, and if the haystack is ascii, we are all done */
if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) {
- RETURN_LONG(found - haystack);
+ RETURN_INT(found - haystack);
}
/* do utf16 part of the strpos */
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC );
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
} else {
RETURN_FALSE;
}
@@ -178,12 +178,12 @@ PHP_FUNCTION(grapheme_stripos)
unsigned char *haystack, *needle, *haystack_dup, *needle_dup;
int haystack_len, needle_len;
unsigned char *found;
- long loffset = 0;
+ php_int_t loffset = 0;
int32_t offset = 0;
int ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_stripos: unable to parse input param", 0 TSRMLS_CC );
@@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos)
efree(needle_dup);
if (found) {
- RETURN_LONG(found - haystack_dup);
+ RETURN_INT(found - haystack_dup);
}
/* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */
@@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC );
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
} else {
RETURN_FALSE;
}
@@ -252,12 +252,12 @@ PHP_FUNCTION(grapheme_strrpos)
{
unsigned char *haystack, *needle;
int haystack_len, needle_len;
- long loffset = 0;
+ php_int_t loffset = 0;
int32_t offset = 0;
int32_t ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC );
@@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos)
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
}
/* if the needle was ascii too, we are done */
@@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC);
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
} else {
RETURN_FALSE;
}
@@ -322,12 +322,12 @@ PHP_FUNCTION(grapheme_strripos)
{
unsigned char *haystack, *needle;
int haystack_len, needle_len;
- long loffset = 0;
+ php_int_t loffset = 0;
int32_t offset = 0;
int32_t ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC );
@@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos)
efree(needle_dup);
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
}
/* if the needle was ascii too, we are done */
@@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC);
if ( ret_pos >= 0 ) {
- RETURN_LONG(ret_pos);
+ RETURN_INT(ret_pos);
} else {
RETURN_FALSE;
}
@@ -401,7 +401,7 @@ PHP_FUNCTION(grapheme_substr)
unsigned char *str, *sub_str;
UChar *ustr;
int str_len, sub_str_len, ustr_len;
- long lstart = 0, length = 0;
+ php_int_t lstart = 0, length = 0;
int32_t start = 0;
int iter_val;
UErrorCode status;
@@ -410,7 +410,7 @@ PHP_FUNCTION(grapheme_substr)
int sub_str_start_pos, sub_str_end_pos;
int32_t (*iter_func)(UBreakIterator *);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (char **)&str, &str_len, &lstart, &length) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_substr: unable to parse input param", 0 TSRMLS_CC );
@@ -816,17 +816,17 @@ PHP_FUNCTION(grapheme_extract)
unsigned char *str, *pstr;
UChar *ustr;
int str_len, ustr_len;
- long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
- long lstart = 0; /* starting position in str in bytes */
+ php_int_t size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
+ php_int_t lstart = 0; /* starting position in str in bytes */
int32_t start = 0;
- long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT;
+ php_int_t extract_type = GRAPHEME_EXTRACT_TYPE_COUNT;
UErrorCode status;
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
UBreakIterator* bi = NULL;
int ret_pos;
zval *next = NULL; /* return offset of next part of the string */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_extract: unable to parse input param", 0 TSRMLS_CC );
@@ -846,7 +846,7 @@ PHP_FUNCTION(grapheme_extract)
/* initialize next */
SEPARATE_ZVAL(next);
zval_dtor(next);
- ZVAL_LONG(next, lstart);
+ ZVAL_INT(next, lstart);
}
}
@@ -898,9 +898,9 @@ PHP_FUNCTION(grapheme_extract)
*/
if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) {
- long nsize = ( size < str_len ? size : str_len );
+ php_int_t nsize = ( size < str_len ? size : str_len );
if ( NULL != next ) {
- ZVAL_LONG(next, start+nsize);
+ ZVAL_INT(next, start+nsize);
}
RETURN_STRINGL(((char *)pstr), nsize);
}
@@ -943,7 +943,7 @@ PHP_FUNCTION(grapheme_extract)
ubrk_close(bi);
if ( NULL != next ) {
- ZVAL_LONG(next, start+ret_pos);
+ ZVAL_INT(next, start+ret_pos);
}
RETURN_STRINGL(((char *)pstr), ret_pos);