summaryrefslogtreecommitdiff
path: root/ext/intl/breakiterator
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-06-10 13:26:28 +0200
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-06-10 13:26:28 +0200
commit87dd0269ba262649402bf00207f80aede181f1e7 (patch)
tree8fc01828af206a20161d5c48e993008dbfe89498 /ext/intl/breakiterator
parenta4925fae9b89dcd7912dce5852b4170a978e1bd0 (diff)
downloadphp-git-87dd0269ba262649402bf00207f80aede181f1e7.tar.gz
Remove trailing space
Diffstat (limited to 'ext/intl/breakiterator')
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp16
-rw-r--r--ext/intl/breakiterator/breakiterator_class.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp8
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.cpp70
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp28
5 files changed, 62 insertions, 62 deletions
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index f9ea794d41..05b876665a 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -76,11 +76,11 @@ static int BreakIterator_compare_objects(zval *object1,
bio1 = (BreakIterator_object*)zend_object_store_get_object(object1 TSRMLS_CC);
bio2 = (BreakIterator_object*)zend_object_store_get_object(object2 TSRMLS_CC);
-
+
if (bio1->biter == NULL || bio2->biter == NULL) {
return bio1->biter == bio2->biter ? 0 : 1;
}
-
+
return *bio1->biter == *bio2->biter ? 0 : 1;
}
/* }}} */
@@ -136,9 +136,9 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS
zval zv = zval_used_for_init;
BreakIterator_object *bio;
const BreakIterator *biter;
-
+
*is_temp = 1;
-
+
array_init_size(&zv, 8);
bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC);
@@ -149,14 +149,14 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS
return Z_ARRVAL(zv);
}
add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1);
-
+
if (bio->text == NULL) {
add_assoc_null_ex(&zv, "text", sizeof("text"));
} else {
zval_add_ref(&bio->text);
add_assoc_zval_ex(&zv, "text", sizeof("text"), bio->text);
}
-
+
add_assoc_string_ex(&zv, "type", sizeof("type"),
const_cast<char*>(typeid(*biter).name()), 1);
@@ -210,7 +210,7 @@ static zend_object_value BreakIterator_object_create(zend_class_entry *ce TSRMLS
BreakIterator_object* intern;
intern = (BreakIterator_object*)ecalloc(1, sizeof(BreakIterator_object));
-
+
zend_object_std_init(&intern->zo, ce TSRMLS_CC);
#if PHP_VERSION_ID < 50399
zend_hash_copy(intern->zo.properties, &(ce->default_properties),
@@ -324,7 +324,7 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D)
BreakIterator_handlers.compare_objects = BreakIterator_compare_objects;
BreakIterator_handlers.clone_obj = BreakIterator_clone_obj;
BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info;
-
+
zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1,
zend_ce_traversable);
diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h
index a387266283..cc5d51256f 100644
--- a/ext/intl/breakiterator/breakiterator_class.h
+++ b/ext/intl/breakiterator/breakiterator_class.h
@@ -36,7 +36,7 @@ typedef struct {
// ICU break iterator
BreakIterator* biter;
-
+
// current text
zval *text;
} BreakIterator_object;
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index 66f4292259..d3ad050299 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -226,10 +226,10 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv,
U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
-
+
retval = IntlIterator_ce_ptr->create_object(ce TSRMLS_CC);
retval.handlers = &IntlPartsIterator_handlers;
-
+
return retval;
}
@@ -263,7 +263,7 @@ U_CFUNC zend_function *IntlPartsIterator_get_method(zval **object_ptr,
goto end;
}
}
-
+
ret = std_object_handlers.get_method(object_ptr,
method, method_len, key TSRMLS_CC);
@@ -286,7 +286,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
}
INTLITERATOR_METHOD_FETCH_OBJECT;
-
+
zval *biter_zval = static_cast<zval*>(ii->iterator->data);
RETURN_ZVAL(biter_zval, 1, 0);
}
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index 6777f9005f..5b8f859d52 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -46,7 +46,7 @@ static void _breakiter_factory(const char *func_name,
char *msg;
UErrorCode status = UErrorCode();
intl_error_reset(NULL TSRMLS_CC);
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!",
&locale_str, &dummy) == FAILURE) {
spprintf(&msg, NULL, "%s: bad arguments", func_name);
@@ -54,11 +54,11 @@ static void _breakiter_factory(const char *func_name,
efree(msg);
RETURN_NULL();
}
-
+
if (locale_str == NULL) {
locale_str = intl_locale_get_default(TSRMLS_C);
}
-
+
biter = func(Locale::createFromName(locale_str), status);
intl_error_set_code(NULL, status TSRMLS_CC);
if (U_FAILURE(status)) {
@@ -68,7 +68,7 @@ static void _breakiter_factory(const char *func_name,
efree(msg);
RETURN_NULL();
}
-
+
breakiterator_object_create(return_value, biter TSRMLS_CC);
}
@@ -117,9 +117,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text)
"breakiter_get_text: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
if (bio->text == NULL) {
RETURN_NULL();
} else {
@@ -135,31 +135,31 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
zval **textzv;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&text, &text_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_set_text: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
int res = zend_get_parameters_ex(1, &textzv);
assert(res == SUCCESS);
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
/* assert it's safe to use text and text_len because zpp changes the
* arguments in the stack */
assert(text == Z_STRVAL_PP(textzv));
-
+
ut = utext_openUTF8(ut, text, text_len, BREAKITER_ERROR_CODE_P(bio));
INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error opening UText");
-
+
bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio));
utext_close(ut); /* ICU shallow clones the UText */
INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error calling "
"BreakIterator::setText()");
-
+
/* When ICU clones the UText, it does not copy the buffer, so we have to
* keep the string buffer around by holding a reference to its zval. This
* also allows a faste implementation of getText() */
@@ -168,7 +168,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
}
bio->text = *textzv;
zval_add_ref(&bio->text);
-
+
RETURN_TRUE;
}
@@ -180,18 +180,18 @@ static void _breakiter_no_args_ret_int32(
char *msg;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters_none() == FAILURE) {
spprintf(&msg, NULL, "%s: bad arguments", func_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC);
efree(msg);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
int32_t res = (bio->biter->*func)();
-
+
RETURN_LONG((long)res);
}
@@ -204,16 +204,16 @@ static void _breakiter_int32_ret_int32(
long arg;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) {
spprintf(&msg, NULL, "%s: bad arguments", func_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC);
efree(msg);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
if (arg < INT32_MIN || arg > INT32_MAX) {
spprintf(&msg, NULL, "%s: offset argument is outside bounds of "
"a 32-bit wide integer", func_name);
@@ -221,9 +221,9 @@ static void _breakiter_int32_ret_int32(
efree(msg);
RETURN_FALSE;
}
-
+
int32_t res = (bio->biter->*func)((int32_t)arg);
-
+
RETURN_LONG((long)res);
}
@@ -251,7 +251,7 @@ U_CFUNC PHP_FUNCTION(breakiter_previous)
U_CFUNC PHP_FUNCTION(breakiter_next)
{
bool no_arg_version = false;
-
+
if (ZEND_NUM_ARGS() == 0) {
no_arg_version = true;
} else if (ZEND_NUM_ARGS() == 1) {
@@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(breakiter_next)
no_arg_version = false;
}
}
-
+
if (no_arg_version) {
_breakiter_no_args_ret_int32("breakiter_next",
&BreakIterator::next,
@@ -281,17 +281,17 @@ U_CFUNC PHP_FUNCTION(breakiter_current)
{
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_current: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
int32_t res = bio->biter->current();
-
+
RETURN_LONG((long)res);
}
@@ -314,25 +314,25 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
long offset;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
&offset) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_is_boundary: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
if (offset < INT32_MIN || offset > INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_is_boundary: offset argument is outside bounds of "
"a 32-bit wide integer", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
UBool res = bio->biter->isBoundary((int32_t)offset);
-
+
RETURN_BOOL((long)res);
}
@@ -368,7 +368,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator)
{
BREAKITER_METHOD_INIT_VARS;
object = getThis();
-
+
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC);
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 4e96450d28..f0f680355b 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -44,7 +44,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
"rbbi_create_instance: bad arguments", 0 TSRMLS_CC);
RETURN_NULL();
}
-
+
// instantiation of ICU object
RuleBasedBreakIterator *rbbi;
@@ -108,11 +108,11 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules)
"rbbi_get_rules: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
const UnicodeString rules = fetch_rbbi(bio)->getRules();
-
+
Z_TYPE_P(return_value) = IS_STRING;
if (intl_charFromString(rules, &Z_STRVAL_P(return_value),
&Z_STRLEN_P(return_value), BREAKITER_ERROR_CODE_P(bio)) == FAILURE)
@@ -134,9 +134,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status)
"rbbi_get_rule_status: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
RETURN_LONG(fetch_rbbi(bio)->getRuleStatus());
}
@@ -150,9 +150,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
"rbbi_get_rule_status_vec: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0,
BREAKITER_ERROR_CODE(bio));
if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) {
@@ -172,7 +172,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
array_init_size(return_value, num_rules);
for (int32_t i = 0; i < num_rules; i++) {
add_next_index_long(return_value, rules[i]);
@@ -190,22 +190,22 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
"rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
BREAKITER_METHOD_FETCH_OBJECT;
-
+
uint32_t rules_len;
const uint8_t *rules = fetch_rbbi(bio)->getBinaryRules(rules_len);
-
+
if (rules_len > INT_MAX - 1) {
intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio),
"rbbi_get_binary_rules: the rules are too large",
0 TSRMLS_CC);
RETURN_FALSE;
}
-
+
char *ret_rules = static_cast<char*>(emalloc(rules_len + 1));
memcpy(ret_rules, rules, rules_len);
ret_rules[rules_len] = '\0';
-
+
RETURN_STRINGL(ret_rules, rules_len, 0);
}