{
char *str;
char *heb_str, *tmp, *target;
- int block_start, block_end, block_type, block_length, i;
+ size_t block_start, block_end, block_type, block_length, i;
zend_long max_chars=0;
- int begin, end, char_count, orig_begin;
+ size_t begin, end, char_count, orig_begin;
size_t str_len;
zend_string *broken_str;
block_end++;
block_length++;
}
- for (i = block_start; i<= block_end; i++) {
- *target = str[i];
+ for (i = block_start+1; i<= block_end+1; i++) {
+ *target = str[i-1];
switch (*target) {
case '(':
*target = ')';
tmp--;
block_end--;
}
- for (i = block_end; i >= block_start; i--) {
- *target = str[i];
+ for (i = block_end+1; i >= block_start+1; i--) {
+ *target = str[i-1];
target--;
}
block_type = _HEB_BLOCK_TYPE_HEB;
while (1) {
char_count=0;
- while ((!max_chars || char_count < max_chars) && begin > 0) {
+ while ((!max_chars || max_chars > 0 && char_count < max_chars) && begin > 0) {
char_count++;
begin--;
if (begin <= 0 || _isnewline(heb_str[begin])) {
break;
}
}
- if (char_count == max_chars) { /* try to avoid breaking words */
- int new_char_count=char_count, new_begin=begin;
+ if (max_chars >= 0 && char_count == max_chars) { /* try to avoid breaking words */
+ size_t new_char_count=char_count, new_begin=begin;
while (new_char_count > 0) {
if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) {
zend_string *str;
zval *allow=NULL;
char *allowed_tags=NULL;
- int allowed_tags_len=0;
+ size_t allowed_tags_len=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &str, &allow) == FAILURE) {
return;
PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len, zend_bool allow_tag_spaces)
{
char *tbuf, *buf, *p, *tp, *rp, c, lc;
- int br, i=0, depth=0, in_q = 0;
- int state = 0, pos;
+ int br, depth=0, in_q = 0;
+ int state = 0;
+ size_t pos, i = 0;
char *allow_free = NULL;
if (stateptr)
{
zval *args = NULL;
char *str, *format;
- size_t str_len, format_len, result, num_args = 0;
+ size_t str_len, format_len;
+ int result, num_args = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss*", &str, &str_len, &format, &format_len,
&args, &num_args) == FAILURE) {