Nuke int32_t (everywhere except streams layer) and signed/unsigned warnings

This commit is contained in:
Dmitry Stogov 2006-03-02 13:12:45 +00:00
parent 8f567a5abb
commit c366cc6d1a
41 changed files with 252 additions and 235 deletions

View file

@ -215,7 +215,7 @@ ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *tar
/* }}} */ /* }}} */
/* {{{ zend_convert_from_unicode */ /* {{{ zend_convert_from_unicode */
ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t *target_len, const UChar *source, int32_t source_len, UErrorCode *status) ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int *target_len, const UChar *source, int source_len, UErrorCode *status)
{ {
char *buffer = NULL; char *buffer = NULL;
char *output; char *output;
@ -262,8 +262,8 @@ ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t
/* {{{ zend_convert_encodings */ /* {{{ zend_convert_encodings */
ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv,
char **target, int32_t *target_len, char **target, int *target_len,
const char *source, int32_t source_len, UErrorCode *status) const char *source, int source_len, UErrorCode *status)
{ {
char *buffer = NULL; char *buffer = NULL;
char *output; char *output;
@ -362,7 +362,7 @@ ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC)
#endif #endif
UChar *u = Z_USTRVAL_P(string); UChar *u = Z_USTRVAL_P(string);
int32_t u_len = Z_USTRLEN_P(string); int u_len = Z_USTRLEN_P(string);
Z_TYPE_P(string) = IS_STRING; Z_TYPE_P(string) = IS_STRING;
zend_convert_from_unicode(conv, &s, &s_len, u, u_len, &status); zend_convert_from_unicode(conv, &s, &s_len, u, u_len, &status);
@ -383,7 +383,7 @@ ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv)
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
int retval = TRUE; int retval = TRUE;
UChar *u = NULL; UChar *u = NULL;
int32_t u_len; int u_len;
char *s = Z_STRVAL_P(string); char *s = Z_STRVAL_P(string);
int s_len = Z_STRLEN_P(string); int s_len = Z_STRLEN_P(string);
@ -413,7 +413,7 @@ ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len)
{ {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u = NULL; UChar *u = NULL;
int32_t u_len; int u_len;
int retval = TRUE; int retval = TRUE;
TSRMLS_FETCH(); TSRMLS_FETCH();
@ -434,13 +434,13 @@ ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len)
* range U+0000 .. U+007F, we can simply casst ASCII chars to Unicode values and avoid * range U+0000 .. U+007F, we can simply casst ASCII chars to Unicode values and avoid
* memory allocation. * memory allocation.
*/ */
ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int32_t ulen, char *str, int32_t slen) ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int ulen, char *str, int slen)
{ {
int32_t result; int result;
uint len = MIN(ulen, slen); uint len = MIN(ulen, slen);
while (len--) { while (len--) {
result = (int32_t)(uint16_t)*ustr - (int32_t)(uint16_t)*str; result = (int)(uint16_t)*ustr - (int)(uint16_t)*str;
if (result != 0) if (result != 0)
return result; return result;
ustr++; ustr++;
@ -452,10 +452,11 @@ ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int32_t ulen, char *str,
/* }}} */ /* }}} */
/* {{{ zend_is_valid_identifier */ /* {{{ zend_is_valid_identifier */
ZEND_API int zend_is_valid_identifier(UChar *ident, int32_t ident_len) ZEND_API int zend_is_valid_identifier(UChar *ident, int len)
{ {
UChar32 codepoint; UChar32 codepoint;
int32_t i; int32_t i;
int32_t ident_len = len;
UProperty id_prop = UCHAR_XID_START; UProperty id_prop = UCHAR_XID_START;
for (i = 0; i < ident_len; ) { for (i = 0; i < ident_len; ) {
@ -472,7 +473,7 @@ ZEND_API int zend_is_valid_identifier(UChar *ident, int32_t ident_len)
/* }}} */ /* }}} */
/* {{{ zend_normalize_string */ /* {{{ zend_normalize_string */
static inline void zend_normalize_string(UChar **dest, int32_t *dest_len, UChar *src, int32_t src_len, UErrorCode *status) static inline void zend_normalize_string(UChar **dest, int32_t *dest_len, UChar *src, int src_len, UErrorCode *status)
{ {
UChar *buffer = NULL; UChar *buffer = NULL;
int32_t buffer_len; int32_t buffer_len;

View file

@ -43,25 +43,25 @@ void zend_set_converter_error_mode(UConverter *conv, uint8_t error_mode);
/* API functions */ /* API functions */
ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status); ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status);
ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t *target_len, const UChar *source, int32_t source_len, UErrorCode *status); ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int *target_len, const UChar *source, int source_len, UErrorCode *status);
ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, char **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status); ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, char **target, int *target_len, const char *source, int source_len, UErrorCode *status);
ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv); ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv);
ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC); ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC);
ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC); ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC);
ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len); ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len);
ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int32_t ulen, char* str, int32_t slen); ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int ulen, char* str, int slen);
ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status); ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status);
ZEND_API int zend_is_valid_identifier(UChar *ident, int32_t ident_len); ZEND_API int zend_is_valid_identifier(UChar *ident, int ident_len);
ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case); ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case);
/* /*
* Function to get a codepoint at position n. Iterates over codepoints starting from the * Function to get a codepoint at position n. Iterates over codepoints starting from the
* beginning of the string. Does not check for n > length, this is left up to the caller. * beginning of the string. Does not check for n > length, this is left up to the caller.
*/ */
static inline UChar32 zend_get_codepoint_at(UChar *str, int32_t length, int32_t n) static inline UChar32 zend_get_codepoint_at(UChar *str, int length, int n)
{ {
int32_t offset = 0; int32_t offset = 0;
UChar32 c = 0; UChar32 c = 0;

View file

@ -508,7 +508,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno TSRMLS_DC
if (UG(unicode)) { if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, value, value_len, &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, value, value_len, &status);
ZVAL_UNICODEL(dest, u_str, u_len, 0); ZVAL_UNICODEL(dest, u_str, u_len, 0);

View file

@ -1912,7 +1912,7 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_ke
if (UG(unicode)) { if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
int32_t u_len; int u_len;
namelen = xmlStrlen(curnode->name); namelen = xmlStrlen(curnode->name);
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &str_key->u, &u_len, (char*)curnode->name, namelen, &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &str_key->u, &u_len, (char*)curnode->name, namelen, &status);

View file

@ -1685,7 +1685,7 @@ PHP_FUNCTION(sqlite_fetch_column_types)
char *tmp = colnames[ncols + i] ? (char *)colnames[ncols + i] : ""; char *tmp = colnames[ncols + i] ? (char *)colnames[ncols + i] : "";
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, tmp, strlen(tmp), &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, tmp, strlen(tmp), &status);
if (result_type == PHPSQLITE_ASSOC) { if (result_type == PHPSQLITE_ASSOC) {
@ -1851,7 +1851,7 @@ static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend
if (UG(unicode)) { if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status);
ZVAL_UNICODEL(decoded, u_str, u_len, 0); ZVAL_UNICODEL(decoded, u_str, u_len, 0);
@ -1939,7 +1939,7 @@ static void php_sqlite_fetch_column(struct php_sqlite_result *res, zval *which,
} else if (UG(unicode)) { } else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status);
RETVAL_UNICODEL(u_str, u_len, 0); RETVAL_UNICODEL(u_str, u_len, 0);
@ -2271,7 +2271,7 @@ static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool dec
} else if (UG(unicode)) { } else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, decoded, decoded_len, &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, decoded, decoded_len, &status);
if (free_decoded) { if (free_decoded) {

View file

@ -1738,7 +1738,7 @@ PHP_FUNCTION(range)
goto err; goto err;
} }
for (; *low >= *high; (*low) -= (unsigned int)lstep) { for (; *low >= *high; (*low) -= (unsigned int)lstep) {
add_next_index_stringl(return_value, low, 1, 1); add_next_index_stringl(return_value, (char*)low, 1, 1);
if (((signed int)*low - lstep) < 0) { if (((signed int)*low - lstep) < 0) {
break; break;
} }
@ -1749,13 +1749,13 @@ PHP_FUNCTION(range)
goto err; goto err;
} }
for (; *low <= *high; (*low) += (unsigned int)lstep) { for (; *low <= *high; (*low) += (unsigned int)lstep) {
add_next_index_stringl(return_value, low, 1, 1); add_next_index_stringl(return_value, (char*)low, 1, 1);
if (((signed int)*low + lstep) > 255) { if (((signed int)*low + lstep) > 255) {
break; break;
} }
} }
} else { } else {
add_next_index_stringl(return_value, low, 1, 1); add_next_index_stringl(return_value, (char*)low, 1, 1);
} }
} else if (Z_TYPE_P(zlow) == IS_UNICODE && } else if (Z_TYPE_P(zlow) == IS_UNICODE &&
Z_USTRLEN_P(zlow) >= 1 && Z_USTRLEN_P(zhigh) >= 1) { Z_USTRLEN_P(zlow) >= 1 && Z_USTRLEN_P(zhigh) >= 1) {
@ -2095,7 +2095,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
zval **stack, /* Input stack */ zval **stack, /* Input stack */
**val; /* Value to be popped */ **val; /* Value to be popped */
zstr key = NULL_ZSTR; zstr key = NULL_ZSTR;
int key_len = 0; uint key_len = 0;
ulong index; ulong index;
zend_uchar key_type; zend_uchar key_type;
@ -2927,6 +2927,7 @@ PHP_FUNCTION(array_change_key_case)
zstr string_key; zstr string_key;
zstr new_key; zstr new_key;
uint str_key_len; uint str_key_len;
int str_len;
ulong num_key; ulong num_key;
ulong change_to_upper=0; ulong change_to_upper=0;
@ -2968,13 +2969,12 @@ PHP_FUNCTION(array_change_key_case)
break; break;
case HASH_KEY_IS_UNICODE: case HASH_KEY_IS_UNICODE:
new_key.u = eustrndup(string_key.u, str_key_len - 1); new_key.u = eustrndup(string_key.u, str_key_len - 1);
str_key_len--; str_len = str_key_len - 1;
if (change_to_upper) if (change_to_upper)
new_key.u = php_u_strtoupper(&new_key.u, &str_key_len, UG(default_locale)); new_key.u = php_u_strtoupper(&new_key.u, &str_len, UG(default_locale));
else else
new_key.u = php_u_strtolower(&new_key.u, &str_key_len, UG(default_locale)); new_key.u = php_u_strtolower(&new_key.u, &str_len, UG(default_locale));
str_key_len++; zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key, str_len+1, entry, sizeof(entry), NULL);
zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key, str_key_len, entry, sizeof(entry), NULL);
efree(new_key.u); efree(new_key.u);
break; break;
} }

View file

@ -207,9 +207,9 @@ PHP_FUNCTION(base64_encode)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return; return;
} }
result = php_base64_encode(str, str_len, &ret_length); result = php_base64_encode((unsigned char*)str, str_len, &ret_length);
if (result != NULL) { if (result != NULL) {
RETVAL_STRINGL(result, ret_length, 0); RETVAL_STRINGL((char*)result, ret_length, 0);
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -228,9 +228,9 @@ PHP_FUNCTION(base64_decode)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return; return;
} }
result = php_base64_decode(str, str_len, &ret_length); result = php_base64_decode((unsigned char*)str, str_len, &ret_length);
if (result != NULL) { if (result != NULL) {
RETVAL_STRINGL(result, ret_length, 0); RETVAL_STRINGL((char*)result, ret_length, 0);
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -462,11 +462,11 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
add_assoc_string(*subarray, "type", "HINFO", 1); add_assoc_string(*subarray, "type", "HINFO", 1);
n = *cp & 0xFF; n = *cp & 0xFF;
cp++; cp++;
add_assoc_stringl(*subarray, "cpu", cp, n, 1); add_assoc_stringl(*subarray, "cpu", (char*)cp, n, 1);
cp += n; cp += n;
n = *cp & 0xFF; n = *cp & 0xFF;
cp++; cp++;
add_assoc_stringl(*subarray, "os", cp, n, 1); add_assoc_stringl(*subarray, "os", (char*)cp, n, 1);
cp += n; cp += n;
break; break;
case DNS_T_TXT: case DNS_T_TXT:
@ -476,7 +476,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
memcpy(tp, cp + 1, n); memcpy(tp, cp + 1, n);
tp[n] = '\0'; tp[n] = '\0';
cp += dlen; cp += dlen;
add_assoc_stringl(*subarray, "txt", tp, n, 0); add_assoc_stringl(*subarray, "txt", (char*)tp, n, 0);
break; break;
case DNS_T_SOA: case DNS_T_SOA:
add_assoc_string(*subarray, "type", "SOA", 1); add_assoc_string(*subarray, "type", "SOA", 1);
@ -504,7 +504,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
add_assoc_long(*subarray, "minimum-ttl", n); add_assoc_long(*subarray, "minimum-ttl", n);
break; break;
case DNS_T_AAAA: case DNS_T_AAAA:
tp = name; tp = (u_char*)name;
for(i=0; i < 8; i++) { for(i=0; i < 8; i++) {
GETSHORT(s, cp); GETSHORT(s, cp);
if (s != 0) { if (s != 0) {
@ -513,7 +513,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
tp[0] = ':'; tp[0] = ':';
tp++; tp++;
} }
tp += sprintf(tp,"%x",s); tp += sprintf((char*)tp,"%x",s);
} else { } else {
if (!have_v6_break) { if (!have_v6_break) {
have_v6_break = 1; have_v6_break = 1;
@ -542,7 +542,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
n = ((int)cp[0]) & 0xFF; n = ((int)cp[0]) & 0xFF;
cp++; cp++;
add_assoc_long(*subarray, "masklen", n); add_assoc_long(*subarray, "masklen", n);
tp = name; tp = (u_char*)name;
if (n > 15) { if (n > 15) {
have_v6_break = 1; have_v6_break = 1;
in_v6_break = 1; in_v6_break = 1;
@ -557,7 +557,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
tp[0] = ':'; tp[0] = ':';
tp++; tp++;
} }
sprintf(tp, "%x", cp[0] & 0xFF); sprintf((char*)tp, "%x", cp[0] & 0xFF);
} else { } else {
if (!have_v6_break) { if (!have_v6_break) {
have_v6_break = 1; have_v6_break = 1;
@ -581,7 +581,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
tp[0] = ':'; tp[0] = ':';
tp++; tp++;
} }
tp += sprintf(tp,"%x",s); tp += sprintf((char*)tp,"%x",s);
} else { } else {
if (!have_v6_break) { if (!have_v6_break) {
have_v6_break = 1; have_v6_break = 1;
@ -633,13 +633,13 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
GETSHORT(n, cp); GETSHORT(n, cp);
add_assoc_long(*subarray, "pref", n); add_assoc_long(*subarray, "pref", n);
n = (cp[0] & 0xFF); n = (cp[0] & 0xFF);
add_assoc_stringl(*subarray, "flags", ++cp, n, 1); add_assoc_stringl(*subarray, "flags", (char*)++cp, n, 1);
cp += n; cp += n;
n = (cp[0] & 0xFF); n = (cp[0] & 0xFF);
add_assoc_stringl(*subarray, "services", ++cp, n, 1); add_assoc_stringl(*subarray, "services", (char*)++cp, n, 1);
cp += n; cp += n;
n = (cp[0] & 0xFF); n = (cp[0] & 0xFF);
add_assoc_stringl(*subarray, "regex", ++cp, n, 1); add_assoc_stringl(*subarray, "regex", (char*)++cp, n, 1);
cp += n; cp += n;
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
if (n < 0) { if (n < 0) {

View file

@ -61,7 +61,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
FILE *fp; FILE *fp;
char *buf, *tmp=NULL; char *buf, *tmp=NULL;
int l, pclose_return; int l, pclose_return;
char *cmd_p, *b, *c, *d=NULL; char *cmd_p, *b, *d=NULL;
php_stream *stream; php_stream *stream;
size_t buflen, bufl = 0; size_t buflen, bufl = 0;
#if PHP_SIGCHILD #if PHP_SIGCHILD

View file

@ -625,8 +625,8 @@ PHP_FUNCTION(file_put_contents)
numbytes = -1; numbytes = -1;
break; break;
} else if (wrote_bytes != UBYTES(Z_USTRLEN_PP(tmp))) { } else if (wrote_bytes != UBYTES(Z_USTRLEN_PP(tmp))) {
int32_t ustrlen = u_countChar32(Z_USTRVAL_PP(tmp), Z_USTRLEN_PP(tmp)); int ustrlen = u_countChar32(Z_USTRVAL_PP(tmp), Z_USTRLEN_PP(tmp));
int32_t numchars = u_countChar32(Z_USTRVAL_PP(tmp), wrote_bytes / UBYTES(1)); int numchars = u_countChar32(Z_USTRVAL_PP(tmp), wrote_bytes / UBYTES(1));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d characters written, possibly out of free disk space", numchars, ustrlen); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d characters written, possibly out of free disk space", numchars, ustrlen);
numbytes = -1; numbytes = -1;
@ -675,8 +675,8 @@ PHP_FUNCTION(file_put_contents)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d characters to %s", Z_USTRLEN_P(data), filename); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d characters to %s", Z_USTRLEN_P(data), filename);
numbytes = -1; numbytes = -1;
} else if (numbytes != UBYTES(Z_USTRLEN_P(data))) { } else if (numbytes != UBYTES(Z_USTRLEN_P(data))) {
int32_t ustrlen = u_countChar32(Z_USTRVAL_P(data), Z_USTRLEN_P(data)); int ustrlen = u_countChar32(Z_USTRVAL_P(data), Z_USTRLEN_P(data));
int32_t numchars = u_countChar32(Z_USTRVAL_P(data), numbytes / UBYTES(1)); int numchars = u_countChar32(Z_USTRVAL_P(data), numbytes / UBYTES(1));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d characters written, possibly out of free disk space", numchars, ustrlen); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d characters written, possibly out of free disk space", numchars, ustrlen);
numbytes = -1; numbytes = -1;
@ -935,8 +935,7 @@ PHP_FUNCTION(popen)
{ {
zval **arg1, **arg2; zval **arg1, **arg2;
FILE *fp; FILE *fp;
char *p, *tmp = NULL; char *p;
char *b, *buf = 0;
php_stream *stream; php_stream *stream;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
@ -1076,7 +1075,7 @@ PHPAPI PHP_FUNCTION(fgetc)
} else { } else {
if (is_unicode) { if (is_unicode) {
UChar *ubuf = (UChar *)buf; UChar *ubuf = (UChar *)buf;
int32_t num_u16 = num_bytes >> 1; int num_u16 = num_bytes >> 1;
ubuf[num_u16] = 0; ubuf[num_u16] = 0;
RETURN_UNICODEL(ubuf, num_u16, 1); RETURN_UNICODEL(ubuf, num_u16, 1);
} else { } else {

View file

@ -1362,7 +1362,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie
static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len) static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len)
{ {
long l; ulong l;
php_conv_err_t err; php_conv_err_t err;
*pretval = 0; *pretval = 0;

View file

@ -210,7 +210,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
} }
#define PHP_FTP_CNTRL_CHK(val, val_len, err_msg) { \ #define PHP_FTP_CNTRL_CHK(val, val_len, err_msg) { \
unsigned char *s = val, *e = s + val_len; \ unsigned char *s = (unsigned char*)val, *e = s + val_len; \
while (s < e) { \ while (s < e) { \
if (iscntrl(*s)) { \ if (iscntrl(*s)) { \
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, err_msg, val); \ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, err_msg, val); \

View file

@ -875,8 +875,9 @@ size_t php_utf32_utf8(unsigned char *buf, int k)
/* {{{ php_unescape_html_entities /* {{{ php_unescape_html_entities
*/ */
PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC) PHPAPI char *php_unescape_html_entities(char *orig, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
{ {
unsigned char *old = (unsigned char*)orig;
int retlen; int retlen;
int j, k; int j, k;
char *replaced, *ret, *p, *q, *lim, *next; char *replaced, *ret, *p, *q, *lim, *next;
@ -884,7 +885,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
unsigned char replacement[15]; unsigned char replacement[15];
int replacement_len; int replacement_len;
ret = estrndup(old, oldlen); ret = estrndup((char*)old, oldlen);
retlen = oldlen; retlen = oldlen;
if (!retlen) { if (!retlen) {
goto empty_source; goto empty_source;
@ -897,7 +898,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
continue; continue;
for (k = entity_map[j].basechar; k <= entity_map[j].endchar; k++) { for (k = entity_map[j].basechar; k <= entity_map[j].endchar; k++) {
unsigned char entity[32]; char entity[32];
int entity_length = 0; int entity_length = 0;
if (entity_map[j].table[k - entity_map[j].basechar] == NULL) if (entity_map[j].table[k - entity_map[j].basechar] == NULL)
@ -943,7 +944,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
} }
if (php_memnstr(ret, entity, entity_length, ret+retlen)) { if (php_memnstr(ret, entity, entity_length, ret+retlen)) {
replaced = php_str_to_str(ret, retlen, entity, entity_length, replacement, replacement_len, &retlen); replaced = php_str_to_str(ret, retlen, entity, entity_length, (char*)replacement, replacement_len, &retlen);
efree(ret); efree(ret);
ret = replaced; ret = replaced;
} }
@ -960,7 +961,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
replacement[1] = '\0'; replacement[1] = '\0';
if (php_memnstr(ret, basic_entities[j].entity, basic_entities[j].entitylen, ret+retlen)) { if (php_memnstr(ret, basic_entities[j].entity, basic_entities[j].entitylen, ret+retlen)) {
replaced = php_str_to_str(ret, retlen, basic_entities[j].entity, basic_entities[j].entitylen, replacement, 1, &retlen); replaced = php_str_to_str(ret, retlen, basic_entities[j].entity, basic_entities[j].entitylen, (char*)replacement, 1, &retlen);
efree(ret); efree(ret);
ret = replaced; ret = replaced;
} }
@ -985,7 +986,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
if (next != NULL && *next == ';') { if (next != NULL && *next == ';') {
switch (charset) { switch (charset) {
case cs_utf_8: case cs_utf_8:
q += php_utf32_utf8(q, code); q += php_utf32_utf8((unsigned char*)q, code);
break; break;
case cs_8859_1: case cs_8859_1:
@ -1075,8 +1076,9 @@ empty_source:
/* {{{ php_escape_html_entities /* {{{ php_escape_html_entities
*/ */
PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC) PHPAPI char *php_escape_html_entities(char *orig, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
{ {
unsigned char *old = (unsigned char *)orig;
int i, j, maxlen, len; int i, j, maxlen, len;
char *replaced; char *replaced;
enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC); enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
@ -1101,14 +1103,14 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle
if (all) { if (all) {
/* look for a match in the maps for this charset */ /* look for a match in the maps for this charset */
unsigned char *rep = NULL; char *rep = NULL;
for (j = 0; entity_map[j].charset != cs_terminator; j++) { for (j = 0; entity_map[j].charset != cs_terminator; j++) {
if (entity_map[j].charset == charset if (entity_map[j].charset == charset
&& this_char >= entity_map[j].basechar && this_char >= entity_map[j].basechar
&& this_char <= entity_map[j].endchar) { && this_char <= entity_map[j].endchar) {
rep = (unsigned char*)entity_map[j].table[this_char - entity_map[j].basechar]; rep = (char*)entity_map[j].table[this_char - entity_map[j].basechar];
if (rep == NULL) { if (rep == NULL) {
/* there is no entity for this position; fall through and /* there is no entity for this position; fall through and
* just output the character itself */ * just output the character itself */

View file

@ -37,6 +37,6 @@ PHP_FUNCTION(htmlspecialchars_decode);
PHP_FUNCTION(html_entity_decode); PHP_FUNCTION(html_entity_decode);
PHP_FUNCTION(get_html_translation_table); PHP_FUNCTION(get_html_translation_table);
PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC); PHPAPI char *php_escape_html_entities(char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC);
#endif /* HTML_H */ #endif /* HTML_H */

View file

@ -33,7 +33,8 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
{ {
zstr key; zstr key;
char *ekey, *newprefix, *p; char *ekey, *newprefix, *p;
int arg_sep_len, key_len, ekey_len, key_type, newprefix_len; uint key_len;
int arg_sep_len, ekey_len, key_type, newprefix_len;
ulong idx; ulong idx;
zval **zdata = NULL, *copyzval; zval **zdata = NULL, *copyzval;

View file

@ -378,7 +378,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
strcat(scratch, ":"); strcat(scratch, ":");
strcat(scratch, resource->pass); strcat(scratch, resource->pass);
tmp = php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL); tmp = (char*)php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL);
if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) { if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) {
php_stream_write(stream, scratch, strlen(scratch)); php_stream_write(stream, scratch, strlen(scratch));
@ -627,7 +627,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
unsigned char *s, *e; \ unsigned char *s, *e; \
int l; \ int l; \
l = php_url_decode(val, strlen(val)); \ l = php_url_decode(val, strlen(val)); \
s = val; e = s + l; \ s = (unsigned char*)val; e = s + l; \
while (s < e) { \ while (s < e) { \
if (iscntrl(*s)) { \ if (iscntrl(*s)) { \
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect url! %s", new_path); \ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect url! %s", new_path); \

View file

@ -101,7 +101,7 @@ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC)
if (php_stream_seek(stream, 3, SEEK_CUR)) if (php_stream_seek(stream, 3, SEEK_CUR))
return NULL; return NULL;
if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim))
return NULL; return NULL;
result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
@ -124,7 +124,7 @@ static struct gfxinfo *php_handle_psd (php_stream * stream TSRMLS_DC)
if (php_stream_seek(stream, 11, SEEK_CUR)) if (php_stream_seek(stream, 11, SEEK_CUR))
return NULL; return NULL;
if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim))
return NULL; return NULL;
result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
@ -146,7 +146,7 @@ static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC)
if (php_stream_seek(stream, 11, SEEK_CUR)) if (php_stream_seek(stream, 11, SEEK_CUR))
return NULL; return NULL;
if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) if (php_stream_read(stream, (char*)dim, sizeof(dim)) != sizeof(dim))
return NULL; return NULL;
size = (((unsigned int)dim[ 3]) << 24) + (((unsigned int)dim[ 2]) << 16) + (((unsigned int)dim[ 1]) << 8) + ((unsigned int) dim[ 0]); size = (((unsigned int)dim[ 3]) << 24) + (((unsigned int)dim[ 2]) << 16) + (((unsigned int)dim[ 1]) << 8) + ((unsigned int) dim[ 0]);
@ -196,22 +196,22 @@ static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC)
unsigned long len=64, szlength; unsigned long len=64, szlength;
int factor=1,maxfactor=16; int factor=1,maxfactor=16;
int slength, status=0; int slength, status=0;
char *b, *buf=NULL, *bufz=NULL; unsigned char *b, *buf=NULL, *bufz=NULL;
b = ecalloc (1, len + 1); b = ecalloc (1, len + 1);
if (php_stream_seek(stream, 5, SEEK_CUR)) if (php_stream_seek(stream, 5, SEEK_CUR))
return NULL; return NULL;
if (php_stream_read(stream, a, sizeof(a)) != sizeof(a)) if (php_stream_read(stream, (char*)a, sizeof(a)) != sizeof(a))
return NULL; return NULL;
if (uncompress(b, &len, a, sizeof(a)) != Z_OK) { if (uncompress((unsigned char*)b, &len, a, sizeof(a)) != Z_OK) {
/* failed to decompress the file, will try reading the rest of the file */ /* failed to decompress the file, will try reading the rest of the file */
if (php_stream_seek(stream, 8, SEEK_SET)) if (php_stream_seek(stream, 8, SEEK_SET))
return NULL; return NULL;
slength = php_stream_copy_to_mem(stream, &bufz, PHP_STREAM_COPY_ALL, 0); slength = php_stream_copy_to_mem(stream, (char**)&bufz, PHP_STREAM_COPY_ALL, 0);
/* /*
* zlib::uncompress() wants to know the output data length * zlib::uncompress() wants to know the output data length
@ -223,7 +223,7 @@ static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC)
do { do {
szlength=slength*(1<<factor++); szlength=slength*(1<<factor++);
buf = (char *) erealloc(buf,szlength); buf = (unsigned char *) erealloc(buf,szlength);
status = uncompress(buf, &szlength, bufz, slength); status = uncompress(buf, &szlength, bufz, slength);
} while ((status==Z_BUF_ERROR)&&(factor<maxfactor)); } while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
@ -268,7 +268,7 @@ static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC)
if (php_stream_seek(stream, 5, SEEK_CUR)) if (php_stream_seek(stream, 5, SEEK_CUR))
return NULL; return NULL;
if (php_stream_read(stream, a, sizeof(a)) != sizeof(a)) if (php_stream_read(stream, (char*)a, sizeof(a)) != sizeof(a))
return NULL; return NULL;
result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo)); result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo));
@ -301,7 +301,7 @@ static struct gfxinfo *php_handle_png (php_stream * stream TSRMLS_DC)
if (php_stream_seek(stream, 8, SEEK_CUR)) if (php_stream_seek(stream, 8, SEEK_CUR))
return NULL; return NULL;
if((php_stream_read(stream, dim, sizeof(dim))) < sizeof(dim)) if((php_stream_read(stream, (char*)dim, sizeof(dim))) < sizeof(dim))
return NULL; return NULL;
result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
@ -358,7 +358,7 @@ static unsigned short php_read2(php_stream * stream TSRMLS_DC)
unsigned char a[2]; unsigned char a[2];
/* just return 0 if we hit the end-of-file */ /* just return 0 if we hit the end-of-file */
if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0; if((php_stream_read(stream, (char*)a, sizeof(a))) <= 0) return 0;
return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]); return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]);
} }
@ -437,8 +437,8 @@ static int php_skip_variable(php_stream * stream TSRMLS_DC)
static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSRMLS_DC) static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSRMLS_DC)
{ {
unsigned short length; unsigned short length;
unsigned char *buffer; char *buffer;
unsigned char markername[16]; char markername[16];
zval *tmp; zval *tmp;
length = php_read2(stream TSRMLS_CC); length = php_read2(stream TSRMLS_CC);
@ -562,7 +562,7 @@ static unsigned int php_read4(php_stream * stream TSRMLS_DC)
unsigned char a[4]; unsigned char a[4];
/* just return 0 if we hit the end-of-file */ /* just return 0 if we hit the end-of-file */
if ((php_stream_read(stream, a, sizeof(a))) != sizeof(a)) return 0; if ((php_stream_read(stream, (char*)a, sizeof(a))) != sizeof(a)) return 0;
return (((unsigned int)a[0]) << 24) return (((unsigned int)a[0]) << 24)
+ (((unsigned int)a[1]) << 16) + (((unsigned int)a[1]) << 16)
@ -803,7 +803,8 @@ static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int mot
unsigned char *dir_entry; unsigned char *dir_entry;
size_t ifd_size, dir_size, entry_value, width=0, height=0, ifd_addr; size_t ifd_size, dir_size, entry_value, width=0, height=0, ifd_addr;
int entry_tag , entry_type; int entry_tag , entry_type;
char *ifd_data, ifd_ptr[4]; unsigned char *ifd_data;
char ifd_ptr[4];
if (php_stream_read(stream, ifd_ptr, 4) != 4) if (php_stream_read(stream, ifd_ptr, 4) != 4)
return NULL; return NULL;
@ -812,7 +813,7 @@ static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int mot
return NULL; return NULL;
ifd_size = 2; ifd_size = 2;
ifd_data = emalloc(ifd_size); ifd_data = emalloc(ifd_size);
if (php_stream_read(stream, ifd_data, 2) != 2) { if (php_stream_read(stream, (char*)ifd_data, 2) != 2) {
efree(ifd_data); efree(ifd_data);
return NULL; return NULL;
} }
@ -820,7 +821,7 @@ static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int mot
dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
ifd_size = dir_size; ifd_size = dir_size;
ifd_data = erealloc(ifd_data,ifd_size); ifd_data = erealloc(ifd_data,ifd_size);
if (php_stream_read(stream, ifd_data+2, dir_size-2) != dir_size-2) { if (php_stream_read(stream, (char*)ifd_data+2, dir_size-2) != dir_size-2) {
efree(ifd_data); efree(ifd_data);
return NULL; return NULL;
} }
@ -885,16 +886,16 @@ static struct gfxinfo *php_handle_iff(php_stream * stream TSRMLS_DC)
int size; int size;
short width, height, bits; short width, height, bits;
if (php_stream_read(stream, a, 8) != 8) { if (php_stream_read(stream, (char*)a, 8) != 8) {
return NULL; return NULL;
} }
if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4)) { if (strncmp((char*)a+4, "ILBM", 4) && strncmp((char*)a+4, "PBM ", 4)) {
return NULL; return NULL;
} }
/* loop chunks to find BMHD chunk */ /* loop chunks to find BMHD chunk */
do { do {
if (php_stream_read(stream, a, 8) != 8) { if (php_stream_read(stream, (char*)a, 8) != 8) {
return NULL; return NULL;
} }
chunkId = php_ifd_get32s(a+0, 1); chunkId = php_ifd_get32s(a+0, 1);
@ -906,7 +907,7 @@ static struct gfxinfo *php_handle_iff(php_stream * stream TSRMLS_DC)
size++; size++;
} }
if (chunkId == 0x424d4844) { /* BMHD chunk */ if (chunkId == 0x424d4844) { /* BMHD chunk */
if (size < 9 || php_stream_read(stream, a, 9) != 9) { if (size < 9 || php_stream_read(stream, (char*)a, 9) != 9) {
return NULL; return NULL;
} }
width = php_ifd_get16s(a+0, 1); width = php_ifd_get16s(a+0, 1);

View file

@ -508,7 +508,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
HashTable *url_stream_wrappers_hash; HashTable *url_stream_wrappers_hash;
zstr stream_protocol; zstr stream_protocol;
char *stream_protocols_buf = NULL; char *stream_protocols_buf = NULL;
int stream_protocol_len, stream_protocols_buf_len = 0; uint stream_protocol_len, stream_protocols_buf_len = 0;
ulong num_key; ulong num_key;
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) { if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
@ -540,7 +540,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
HashTable *stream_xport_hash; HashTable *stream_xport_hash;
zstr xport_name; zstr xport_name;
char *xport_buf = NULL; char *xport_buf = NULL;
int xport_name_len, xport_buf_len = 0, xport_buf_size = 0; uint xport_name_len, xport_buf_len = 0, xport_buf_size = 0;
ulong num_key; ulong num_key;
if ((stream_xport_hash = php_stream_xport_get_hash())) { if ((stream_xport_hash = php_stream_xport_get_hash())) {
@ -582,7 +582,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
HashTable *stream_filter_hash; HashTable *stream_filter_hash;
zstr filter_name; zstr filter_name;
char *filter_buf = NULL; char *filter_buf = NULL;
int filter_name_len, filter_buf_len = 0, filter_buf_size = 0; uint filter_name_len, filter_buf_len = 0, filter_buf_size = 0;
ulong num_key; ulong num_key;
if ((stream_filter_hash = php_get_stream_filters_hash())) { if ((stream_filter_hash = php_get_stream_filters_hash())) {

View file

@ -286,7 +286,7 @@ PHP_FUNCTION(iptcembed)
fclose(fp); fclose(fp);
if (spool < 2) { if (spool < 2) {
RETVAL_STRINGL(spoolbuf, poi - spoolbuf, 0); RETVAL_STRINGL((char*)spoolbuf, poi - spoolbuf, 0);
} else { } else {
RETURN_TRUE; RETURN_TRUE;
} }
@ -300,7 +300,7 @@ PHP_FUNCTION(iptcparse)
unsigned int length, inx, len, tagsfound; unsigned int length, inx, len, tagsfound;
unsigned char *buffer; unsigned char *buffer;
unsigned char recnum, dataset; unsigned char recnum, dataset;
unsigned char key[ 16 ]; char key[16];
zval *values, **str, **element; zval *values, **str, **element;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
@ -310,7 +310,7 @@ PHP_FUNCTION(iptcparse)
inx = 0; inx = 0;
length = Z_STRLEN_PP(str); length = Z_STRLEN_PP(str);
buffer = Z_STRVAL_PP(str); buffer = (unsigned char*)Z_STRVAL_PP(str);
tagsfound = 0; /* number of tags already found */ tagsfound = 0; /* number of tags already found */
@ -359,7 +359,7 @@ PHP_FUNCTION(iptcparse)
zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(zval*), (void **) &element); zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(zval*), (void **) &element);
} }
add_next_index_stringl(*element, buffer+inx, len, 1); add_next_index_stringl(*element, (char*)buffer+inx, len, 1);
inx += len; inx += len;

View file

@ -27,7 +27,7 @@
/* {{{ reference_levdist /* {{{ reference_levdist
* reference implementation, only optimized for memory usage, not speed */ * reference implementation, only optimized for memory usage, not speed */
static int reference_levdist(void *s1, int32_t l1, void *s2, int32_t l2, zend_uchar str_type, int cost_ins, int cost_rep, int cost_del ) static int reference_levdist(void *s1, int l1, void *s2, int l2, zend_uchar str_type, int cost_ins, int cost_rep, int cost_del )
{ {
int *p1, *p2, *tmp; int *p1, *p2, *tmp;
int32_t i1, i2, j1, j2, cp1, cp2; int32_t i1, i2, j1, j2, cp1, cp2;
@ -104,7 +104,7 @@ PHP_FUNCTION(levenshtein)
{ {
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
void *str1, *str2; void *str1, *str2;
int32_t str1_len, str2_len; int str1_len, str2_len;
zend_uchar str1_type, str2_type; zend_uchar str1_type, str2_type;
long cost_ins, cost_rep, cost_del; long cost_ins, cost_rep, cost_del;
char *callback_name; char *callback_name;

View file

@ -55,10 +55,10 @@ PHP_NAMED_FUNCTION(php_if_md5)
md5str[0] = '\0'; md5str[0] = '\0';
PHP_MD5Init(&context); PHP_MD5Init(&context);
PHP_MD5Update(&context, arg, arg_len); PHP_MD5Update(&context, (unsigned char*)arg, arg_len);
PHP_MD5Final(digest, &context); PHP_MD5Final(digest, &context);
if (raw_output) { if (raw_output) {
RETURN_STRINGL(digest, 16, 1); RETURN_STRINGL((char*)digest, 16, 1);
} else { } else {
make_digest(md5str, digest); make_digest(md5str, digest);
RETVAL_ASCII_STRING(md5str, 1); RETVAL_ASCII_STRING(md5str, 1);
@ -92,7 +92,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
PHP_MD5Init(&context); PHP_MD5Init(&context);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { while ((n = php_stream_read(stream, (char*)buf, sizeof(buf))) > 0) {
PHP_MD5Update(&context, buf, n); PHP_MD5Update(&context, buf, n);
} }
@ -105,7 +105,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
} }
if (raw_output) { if (raw_output) {
RETURN_STRINGL(digest, 16, 1); RETURN_STRINGL((char*)digest, 16, 1);
} else { } else {
make_digest(md5str, digest); make_digest(md5str, digest);
RETVAL_ASCII_STRING(md5str, 1); RETVAL_ASCII_STRING(md5str, 1);

View file

@ -117,30 +117,30 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out);
PHPAPI char *php_strtoupper(char *s, size_t len); PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len); PHPAPI char *php_strtolower(char *s, size_t len);
PHPAPI UChar *php_u_strtoupper(UChar **s, int32_t *len, const char *locale); PHPAPI UChar *php_u_strtoupper(UChar **s, int *len, const char *locale);
PHPAPI UChar *php_u_strtolower(UChar **s, int32_t *len, const char *locale); PHPAPI UChar *php_u_strtolower(UChar **s, int *len, const char *locale);
PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
PHPAPI UChar *php_u_addslashes(UChar *str, int32_t length, int32_t *new_length, int freeit TSRMLS_DC); PHPAPI UChar *php_u_addslashes(UChar *str, int length, int *new_length, int freeit TSRMLS_DC);
PHPAPI UChar *php_u_addslashes_ex(UChar *str, int32_t length, int32_t *new_length, int freeit, int ignore_sybase TSRMLS_DC); PHPAPI UChar *php_u_addslashes_ex(UChar *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC);
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC); PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC);
PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC); PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC);
PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC); PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC);
PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
PHPAPI void php_u_stripslashes(UChar *str, int32_t *len TSRMLS_DC); PHPAPI void php_u_stripslashes(UChar *str, int *len TSRMLS_DC);
PHPAPI void php_stripcslashes(char *str, int *len); PHPAPI void php_stripcslashes(char *str, int *len);
PHPAPI void php_basename(char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC); PHPAPI void php_basename(char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC);
PHPAPI size_t php_dirname(char *str, size_t len); PHPAPI size_t php_dirname(char *str, size_t len);
PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int32_t s_len, int32_t t_len); PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int s_len, int t_len);
PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len); PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len);
PHPAPI int32_t php_u_strspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end); PHPAPI int php_u_strspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end);
PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
PHPAPI int32_t php_u_strcspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end); PHPAPI int php_u_strcspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end);
PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle, PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle,
int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count); int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count);
PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
int needle_len, char *str, int str_len, int *_new_length); int needle_len, char *str, int str_len, int *_new_length);
PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar str_type, zval *return_value, int mode TSRMLS_DC); PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar str_type, zval *return_value, int mode TSRMLS_DC);
PHPAPI int32_t php_u_strip_tags(UChar *rbuf, int32_t len, int *stateptr, UChar *allow, int32_t allow_len TSRMLS_DC); PHPAPI int php_u_strip_tags(UChar *rbuf, int len, int *stateptr, UChar *allow, int allow_len TSRMLS_DC);
PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len); PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len);
PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count); PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count);
PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result); PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result);

View file

@ -53,10 +53,10 @@ PHP_FUNCTION(sha1)
sha1str[0] = '\0'; sha1str[0] = '\0';
PHP_SHA1Init(&context); PHP_SHA1Init(&context);
PHP_SHA1Update(&context, arg, arg_len); PHP_SHA1Update(&context, (unsigned char*)arg, arg_len);
PHP_SHA1Final(digest, &context); PHP_SHA1Final(digest, &context);
if (raw_output) { if (raw_output) {
RETURN_STRINGL(digest, 20, 1); RETURN_STRINGL((char*)digest, 20, 1);
} else { } else {
make_sha1_digest(sha1str, digest); make_sha1_digest(sha1str, digest);
RETVAL_ASCII_STRING(sha1str, 1); RETVAL_ASCII_STRING(sha1str, 1);
@ -92,7 +92,7 @@ PHP_FUNCTION(sha1_file)
PHP_SHA1Init(&context); PHP_SHA1Init(&context);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { while ((n = php_stream_read(stream, (char*)buf, sizeof(buf))) > 0) {
PHP_SHA1Update(&context, buf, n); PHP_SHA1Update(&context, buf, n);
} }
@ -105,7 +105,7 @@ PHP_FUNCTION(sha1_file)
} }
if (raw_output) { if (raw_output) {
RETURN_STRINGL(digest, 20, 1); RETURN_STRINGL((char*)digest, 20, 1);
} else { } else {
make_sha1_digest(sha1str, digest); make_sha1_digest(sha1str, digest);
RETVAL_ASCII_STRING(sha1str, 1); RETVAL_ASCII_STRING(sha1str, 1);

View file

@ -524,7 +524,7 @@ PHP_FUNCTION(stream_get_transports)
{ {
HashTable *stream_xport_hash; HashTable *stream_xport_hash;
zstr stream_xport; zstr stream_xport;
int stream_xport_len; uint stream_xport_len;
ulong num_key; ulong num_key;
if (ZEND_NUM_ARGS() != 0) { if (ZEND_NUM_ARGS() != 0) {
@ -552,7 +552,7 @@ PHP_FUNCTION(stream_get_wrappers)
{ {
HashTable *url_stream_wrappers_hash; HashTable *url_stream_wrappers_hash;
zstr stream_protocol; zstr stream_protocol;
int key_flags, stream_protocol_len = 0; uint key_flags, stream_protocol_len = 0;
ulong num_key; ulong num_key;
if (ZEND_NUM_ARGS() != 0) { if (ZEND_NUM_ARGS() != 0) {
@ -859,7 +859,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
HashPosition pos, opos; HashPosition pos, opos;
zval **wval, **oval; zval **wval, **oval;
zstr wkey, okey; zstr wkey, okey;
int wkey_len, okey_len; uint wkey_len, okey_len;
int ret = SUCCESS; int ret = SUCCESS;
ulong num_key; ulong num_key;
@ -871,8 +871,12 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
if (HASH_KEY_IS_UNICODE == wtype) { if (HASH_KEY_IS_UNICODE == wtype) {
/* fold to string */ /* fold to string */
UErrorCode errCode = 0; UErrorCode errCode = 0;
char *tmp;
int tmp_len;
zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &wkey.s, &wkey_len, wkey.u, wkey_len, &errCode); zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &tmp, &tmp_len, wkey.u, wkey_len, &errCode);
wkey.s = tmp;
wkey_len = tmp_len;
} }
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos);
@ -881,8 +885,12 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
if (HASH_KEY_IS_UNICODE == otype) { if (HASH_KEY_IS_UNICODE == otype) {
/* fold to string */ /* fold to string */
UErrorCode errCode = 0; UErrorCode errCode = 0;
char *tmp;
int tmp_len;
zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &okey.s, &okey_len, okey.u, okey_len, &errCode); zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &tmp, &tmp_len, okey.u, okey_len, &errCode);
okey.s = tmp;
okey_len = tmp_len;
php_stream_context_set_option(context, wkey.s, okey.s, *oval); php_stream_context_set_option(context, wkey.s, okey.s, *oval);
efree(okey.v); efree(okey.v);
} }

View file

@ -120,7 +120,7 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *
register unsigned char *result = NULL; register unsigned char *result = NULL;
size_t i, j; size_t i, j;
result = (char *) safe_emalloc(oldlen * 2, sizeof(char), 1); result = (unsigned char *) safe_emalloc(oldlen * 2, sizeof(char), 1);
for (i = j = 0; i < oldlen; i++) { for (i = j = 0; i < oldlen; i++) {
result[j++] = hexconvtab[old[i] >> 4]; result[j++] = hexconvtab[old[i] >> 4];
@ -131,7 +131,7 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *
if (newlen) if (newlen)
*newlen = oldlen * 2 * sizeof(char); *newlen = oldlen * 2 * sizeof(char);
return result; return (char*)result;
} }
/* }}} */ /* }}} */
@ -572,9 +572,9 @@ PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar str
char mask[256]; char mask[256];
if (what) { if (what) {
php_charmask(what, what_len, mask TSRMLS_CC); php_charmask((unsigned char*)what, what_len, mask TSRMLS_CC);
} else { } else {
php_charmask(" \n\r\t\v\0", 6, mask TSRMLS_CC); php_charmask((unsigned char*)" \n\r\t\v\0", 6, mask TSRMLS_CC);
} }
if (mode & 1) { if (mode & 1) {
@ -611,7 +611,7 @@ PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar str
* Expands possible ranges of the form 'a..b' in input charlist, * Expands possible ranges of the form 'a..b' in input charlist,
* where a < b in code-point order * where a < b in code-point order
*/ */
static int php_expand_u_trim_range(UChar **range, int32_t *range_len TSRMLS_DC) static int php_expand_u_trim_range(UChar **range, int *range_len TSRMLS_DC)
{ {
UChar32 *codepts, *tmp, *input, *end, c; UChar32 *codepts, *tmp, *input, *end, c;
int32_t len, tmp_len, idx; int32_t len, tmp_len, idx;
@ -693,7 +693,7 @@ static int php_expand_u_trim_range(UChar **range, int32_t *range_len TSRMLS_DC)
/* {{{ php_u_trim() /* {{{ php_u_trim()
* Unicode capable version of php_trim() * Unicode capable version of php_trim()
*/ */
static UChar *php_u_trim(UChar *c, int32_t len, UChar *what, int32_t what_len, zval *return_value, int mode TSRMLS_DC) static UChar *php_u_trim(UChar *c, int len, UChar *what, int what_len, zval *return_value, int mode TSRMLS_DC)
{ {
int32_t i,j; int32_t i,j;
UChar ch,wh; UChar ch,wh;
@ -1470,7 +1470,7 @@ PHPAPI char *php_strtoupper(char *s, size_t len)
{ {
unsigned char *c, *e; unsigned char *c, *e;
c = s; c = (unsigned char*)s;
e = c+len; e = c+len;
while (c < e) { while (c < e) {
@ -1483,10 +1483,10 @@ PHPAPI char *php_strtoupper(char *s, size_t len)
/* {{{ php_u_strtoupper /* {{{ php_u_strtoupper
*/ */
PHPAPI UChar* php_u_strtoupper(UChar **s, int32_t *len, const char* locale) PHPAPI UChar* php_u_strtoupper(UChar **s, int *len, const char* locale)
{ {
UChar *dest = NULL; UChar *dest = NULL;
int32_t dest_len; int dest_len;
UErrorCode status; UErrorCode status;
dest_len = *len; dest_len = *len;
@ -1536,10 +1536,10 @@ PHP_FUNCTION(strtoupper)
/* {{{ php_u_strtolower /* {{{ php_u_strtolower
*/ */
PHPAPI UChar *php_u_strtolower(UChar **s, int32_t *len, const char* locale) PHPAPI UChar *php_u_strtolower(UChar **s, int *len, const char* locale)
{ {
UChar *dest = NULL; UChar *dest = NULL;
int32_t dest_len; int dest_len;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
dest_len = *len; dest_len = *len;
@ -1570,7 +1570,7 @@ PHPAPI char *php_strtolower(char *s, size_t len)
{ {
unsigned char *c, *e; unsigned char *c, *e;
c = s; c = (unsigned char*)s;
e = c+len; e = c+len;
while (c < e) { while (c < e) {
@ -1879,7 +1879,7 @@ PHP_FUNCTION(pathinfo)
/* {{{ php_u_stristr /* {{{ php_u_stristr
Unicode version of case insensitve strstr */ Unicode version of case insensitve strstr */
PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int32_t s_len, int32_t t_len) PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int s_len, int t_len)
{ {
int32_t i,j, last; int32_t i,j, last;
UChar32 ch1, ch2; UChar32 ch1, ch2;
@ -1928,7 +1928,7 @@ PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int32_t s_len, int32_t t_len)
/* {{{ php_stristr /* {{{ php_stristr
case insensitve strstr */ case insensitve strstr */
PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len) PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len)
{ {
php_strtolower(s, s_len); php_strtolower(s, s_len);
php_strtolower(t, t_len); php_strtolower(t, t_len);
@ -1938,11 +1938,12 @@ PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_
/* {{{ php_u_strspn /* {{{ php_u_strspn
*/ */
PHPAPI int32_t php_u_strspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end) PHPAPI int php_u_strspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end)
{ {
int32_t len1 = s1_end - s1; int32_t len1 = s1_end - s1;
int32_t len2 = s2_end - s2; int32_t len2 = s2_end - s2;
int32_t i, codepts; int32_t i;
int codepts;
UChar32 ch; UChar32 ch;
for (i = 0, codepts = 0 ; i < len1 ; codepts++) { for (i = 0, codepts = 0 ; i < len1 ; codepts++) {
@ -1975,11 +1976,12 @@ cont:
/* {{{ php_u_strcspn /* {{{ php_u_strcspn
*/ */
PHPAPI int32_t php_u_strcspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end) PHPAPI int php_u_strcspn(UChar *s1, UChar *s2, UChar *s1_end, UChar *s2_end)
{ {
int32_t len1 = s1_end - s1; int32_t len1 = s1_end - s1;
int32_t len2 = s2_end - s2; int32_t len2 = s2_end - s2;
int32_t i, codepts; int32_t i;
int codepts;
UChar32 ch; UChar32 ch;
for (i = 0, codepts = 0 ; i < len1 ; codepts++) { for (i = 0, codepts = 0 ; i < len1 ; codepts++) {
@ -2021,7 +2023,7 @@ PHP_FUNCTION(stristr)
zend_uchar str_type; zend_uchar str_type;
char needle_char[2]; char needle_char[2];
UChar u_needle_char[3]; UChar u_needle_char[3];
int32_t needle_len; int needle_len;
char *haystack_copy; char *haystack_copy;
zstr target; zstr target;
void *found = NULL; void *found = NULL;
@ -2120,7 +2122,7 @@ PHP_FUNCTION(strstr)
void *found = NULL; void *found = NULL;
char needle_char[2]; char needle_char[2];
UChar u_needle_char[3]; UChar u_needle_char[3];
int32_t n_len = 0; int n_len = 0;
size_t found_offset; size_t found_offset;
zend_bool part = 0; zend_bool part = 0;
@ -2230,7 +2232,7 @@ PHP_FUNCTION(strpos)
void *found = NULL; void *found = NULL;
char needle_char[2]; char needle_char[2];
UChar u_needle_char[3]; UChar u_needle_char[3];
int32_t n_len = 0; int n_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tZ|l", &haystack, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tZ|l", &haystack,
&haystack_len, &haystack_type, &needle, &offset) == FAILURE) { &haystack_len, &haystack_type, &needle, &offset) == FAILURE) {
@ -2318,7 +2320,7 @@ PHP_FUNCTION(stripos)
{ {
zval *haystack, *needle; zval *haystack, *needle;
long offset = 0; long offset = 0;
int32_t haystack_len, needle_len = 0; int haystack_len, needle_len = 0;
zend_uchar str_type; zend_uchar str_type;
void *haystack_dup, *needle_dup = NULL; void *haystack_dup, *needle_dup = NULL;
char needle_char[2]; char needle_char[2];
@ -2442,7 +2444,7 @@ PHP_FUNCTION(strrpos)
{ {
zval *zhaystack, *zneedle; zval *zhaystack, *zneedle;
zstr haystack, needle; zstr haystack, needle;
int32_t haystack_len, needle_len = 0; int haystack_len, needle_len = 0;
zend_uchar str_type; zend_uchar str_type;
long offset = 0; long offset = 0;
char *p, *e, ord_needle[2]; char *p, *e, ord_needle[2];
@ -2647,7 +2649,7 @@ PHP_FUNCTION(strripos)
/* {{{ php_u_strrchr /* {{{ php_u_strrchr
*/ */
UChar *php_u_strrchr(UChar *s, UChar32 ch, int32_t s_len) UChar *php_u_strrchr(UChar *s, UChar32 ch, int s_len)
{ {
UChar32 ch1; UChar32 ch1;
int32_t i = s_len; int32_t i = s_len;
@ -2670,7 +2672,7 @@ PHP_FUNCTION(strrchr)
zend_uchar str_type; zend_uchar str_type;
UChar32 ch; UChar32 ch;
void *found = NULL; void *found = NULL;
int32_t found_offset; int found_offset;
if (ZEND_NUM_ARGS() != 2 || zend_parse_parameters(2 TSRMLS_CC, "zz", &haystack, &needle) == FAILURE) { if (ZEND_NUM_ARGS() != 2 || zend_parse_parameters(2 TSRMLS_CC, "zz", &haystack, &needle) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
@ -2823,7 +2825,7 @@ PHP_FUNCTION(substr)
{ {
void *str; void *str;
int str_len; int str_len;
int32_t cp_len; int cp_len;
zend_uchar str_type; zend_uchar str_type;
long l = -1; long l = -1;
long f; long f;
@ -2885,9 +2887,9 @@ PHP_FUNCTION(substr)
/* {{{ php_adjust_limits /* {{{ php_adjust_limits
*/ */
PHPAPI void php_adjust_limits(zval **str, int32_t *f, int32_t *l) PHPAPI void php_adjust_limits(zval **str, int *f, int *l)
{ {
int32_t str_codepts; int str_codepts;
if (Z_TYPE_PP(str) == IS_UNICODE) { if (Z_TYPE_PP(str) == IS_UNICODE) {
str_codepts = u_countChar32(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str)); str_codepts = u_countChar32(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str));
@ -2921,7 +2923,7 @@ PHPAPI void php_adjust_limits(zval **str, int32_t *f, int32_t *l)
/* {{{ php_do_substr_replace /* {{{ php_do_substr_replace
*/ */
PHPAPI int32_t php_do_substr_replace(void **result, zval **str, zval **repl, int32_t f, int32_t l TSRMLS_DC) PHPAPI int php_do_substr_replace(void **result, zval **str, zval **repl, int f, int l TSRMLS_DC)
{ {
void *buf; void *buf;
int32_t buf_len, idx; int32_t buf_len, idx;
@ -2981,9 +2983,9 @@ PHP_FUNCTION(substr_replace)
zval **len = NULL; zval **len = NULL;
zval **repl; zval **repl;
void *result; void *result;
int32_t result_len; int result_len;
int32_t l = 0; int l = 0;
int32_t f; int f;
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
HashPosition pos_str, pos_from, pos_repl, pos_len; HashPosition pos_str, pos_from, pos_repl, pos_len;
@ -3234,7 +3236,7 @@ PHP_FUNCTION(chr)
if (UG(unicode)) { if (UG(unicode)) {
UChar buf[2]; UChar buf[2];
int32_t buf_len; int buf_len;
if (Z_LVAL_PP(num) > UCHAR_MAX_VALUE) { if (Z_LVAL_PP(num) > UCHAR_MAX_VALUE) {
php_error(E_WARNING, "Codepoint value cannot be greater than %X", UCHAR_MAX_VALUE); php_error(E_WARNING, "Codepoint value cannot be greater than %X", UCHAR_MAX_VALUE);
@ -3637,10 +3639,10 @@ PHP_FUNCTION(strrev)
/* {{{ php_u_similar_str /* {{{ php_u_similar_str
*/ */
static void php_u_similar_str(const UChar *txt1, int32_t len1, static void php_u_similar_str(const UChar *txt1, int len1,
const UChar *txt2, int32_t len2, const UChar *txt2, int len2,
int32_t *pos1, int32_t *end1, int *pos1, int *end1,
int32_t *pos2, int32_t *end2, int *max) int *pos2, int *end2, int *max)
{ {
int32_t i1, i2, j1, j2, l; int32_t i1, i2, j1, j2, l;
UChar32 ch1, ch2; UChar32 ch1, ch2;
@ -3719,10 +3721,10 @@ static int php_similar_char(const char *txt1, int len1, const char *txt2, int le
/* {{{ php_u_similar_char /* {{{ php_u_similar_char
*/ */
static int php_u_similar_char(const UChar *txt1, int32_t len1, const UChar *txt2, int32_t len2) static int php_u_similar_char(const UChar *txt1, int len1, const UChar *txt2, int len2)
{ {
int sum, max; int sum, max;
int32_t pos1, pos2, end1, end2; int pos1, pos2, end1, end2;
php_u_similar_str(txt1, len1, txt2, len2, &pos1, &end1, &pos2, &end2, &max); php_u_similar_str(txt1, len1, txt2, len2, &pos1, &end1, &pos2, &end2, &max);
if ((sum = max)) { if ((sum = max)) {
@ -3795,26 +3797,26 @@ PHP_FUNCTION(similar_text)
/* {{{ php_u_stripslashes /* {{{ php_u_stripslashes
* *
* be careful, this edits the string in-place */ * be careful, this edits the string in-place */
PHPAPI void php_u_stripslashes(UChar *str, int32_t *len TSRMLS_DC) PHPAPI void php_u_stripslashes(UChar *str, int *len TSRMLS_DC)
{ {
int32_t tmp_len = 0, i = 0; int32_t tmp_len = 0, i = 0, src_len = *len;
UChar32 ch1, ch2; UChar32 ch1, ch2;
ch1 = -1; ch2 = -1; ch1 = -1; ch2 = -1;
if (PG(magic_quotes_sybase)) { if (PG(magic_quotes_sybase)) {
while (i < *len) { while (i < src_len) {
U16_NEXT(str, i, *len, ch1); U16_NEXT(str, i, src_len, ch1);
if (ch1 == '\'') { if (ch1 == '\'') {
tmp_len += zend_codepoint_to_uchar(ch1, str+tmp_len); tmp_len += zend_codepoint_to_uchar(ch1, str+tmp_len);
if (i < *len) { if (i < src_len) {
U16_NEXT(str, i, *len, ch2); U16_NEXT(str, i, src_len, ch2);
if (ch2 != '\'') { if (ch2 != '\'') {
tmp_len += zend_codepoint_to_uchar(ch2, str+tmp_len); tmp_len += zend_codepoint_to_uchar(ch2, str+tmp_len);
} }
} }
} else if (ch1 == '\\') { } else if (ch1 == '\\') {
if (i < *len) { if (i < src_len) {
U16_NEXT(str, i, *len, ch2); U16_NEXT(str, i, src_len, ch2);
if (ch2 == '0') { if (ch2 == '0') {
tmp_len += zend_codepoint_to_uchar('\0', str+tmp_len); tmp_len += zend_codepoint_to_uchar('\0', str+tmp_len);
} else { } else {
@ -3829,11 +3831,11 @@ PHPAPI void php_u_stripslashes(UChar *str, int32_t *len TSRMLS_DC)
} }
} }
} else { } else {
while (i < *len) { while (i < src_len) {
U16_NEXT(str, i, *len, ch1); U16_NEXT(str, i, src_len, ch1);
if (ch1 == '\\') { if (ch1 == '\\') {
if (i < *len) { if (i < src_len) {
U16_NEXT(str, i, *len, ch2); U16_NEXT(str, i, src_len, ch2);
if (ch2 == '0') { if (ch2 == '0') {
tmp_len += zend_codepoint_to_uchar('\0', str+tmp_len); tmp_len += zend_codepoint_to_uchar('\0', str+tmp_len);
} else { } else {
@ -3957,7 +3959,7 @@ PHP_FUNCTION(addslashes)
{ {
zval **str; zval **str;
void *tmp = NULL; void *tmp = NULL;
int32_t tmp_len = 0; int tmp_len = 0;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
@ -4120,7 +4122,7 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
length = strlen(str); length = strlen(str);
} }
php_charmask(what, wlength, flags TSRMLS_CC); php_charmask((unsigned char*)what, wlength, flags TSRMLS_CC);
for (source = str, end = source + length, target = new_str; (c = *source) || (source < end); source++) { for (source = str, end = source + length, target = new_str; (c = *source) || (source < end); source++) {
if (flags[(unsigned char)c]) { if (flags[(unsigned char)c]) {
@ -4159,7 +4161,7 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
/* {{{ php_u_addslashes /* {{{ php_u_addslashes
*/ */
PHPAPI UChar *php_u_addslashes(UChar *str, int32_t length, int32_t *new_length, int should_free TSRMLS_DC) PHPAPI UChar *php_u_addslashes(UChar *str, int length, int *new_length, int should_free TSRMLS_DC)
{ {
return php_u_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC); return php_u_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC);
} }
@ -4167,7 +4169,7 @@ PHPAPI UChar *php_u_addslashes(UChar *str, int32_t length, int32_t *new_length,
/* {{{ php_u_addslashes_ex /* {{{ php_u_addslashes_ex
*/ */
PHPAPI UChar *php_u_addslashes_ex(UChar *str, int32_t length, int32_t *new_length, int should_free, int ignore_sybase TSRMLS_DC) PHPAPI UChar *php_u_addslashes_ex(UChar *str, int length, int *new_length, int should_free, int ignore_sybase TSRMLS_DC)
{ {
UChar *buf; UChar *buf;
int32_t buf_len = 0, i = 0; int32_t buf_len = 0, i = 0;
@ -5021,7 +5023,7 @@ PHP_FUNCTION(strip_tags)
int str_len, allow_len = 0; int str_len, allow_len = 0;
zend_uchar str_type, allow_type; zend_uchar str_type, allow_type;
void *buf; void *buf;
int32_t retval_len; int retval_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T|T", &str, &str_len, &str_type, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T|T", &str, &str_len, &str_type,
&allow, &allow_len, &allow_type) == FAILURE) { &allow, &allow_len, &allow_type) == FAILURE) {
@ -5189,7 +5191,7 @@ PHP_FUNCTION(parse_str)
/* {{{ php_u_tag_find /* {{{ php_u_tag_find
*/ */
int php_u_tag_find(UChar *tag, int32_t len, UChar *set, int32_t set_len) int php_u_tag_find(UChar *tag, int len, UChar *set, int set_len)
{ {
int32_t idx = 0; int32_t idx = 0;
UChar32 ch; UChar32 ch;
@ -5319,7 +5321,7 @@ int php_tag_find(char *tag, int len, char *set) {
*/ */
/* {{{ php_u_strip_tags /* {{{ php_u_strip_tags
*/ */
PHPAPI int32_t php_u_strip_tags(UChar *rbuf, int32_t len, int *stateptr, UChar *allow, int32_t allow_len TSRMLS_DC) PHPAPI int php_u_strip_tags(UChar *rbuf, int len, int *stateptr, UChar *allow, int allow_len TSRMLS_DC)
{ {
UChar *tbuf = NULL, *tp = NULL; UChar *tbuf = NULL, *tp = NULL;
UChar *buf, *rp; UChar *buf, *rp;
@ -5539,7 +5541,7 @@ reg_u_char:
if (stateptr) if (stateptr)
*stateptr = state; *stateptr = state;
return (int32_t)(rp-rbuf); return (int)(rp-rbuf);
} }
/* }}} */ /* }}} */
@ -5769,12 +5771,12 @@ PHP_FUNCTION(str_repeat)
{ {
void *input_str; /* Input string */ void *input_str; /* Input string */
int input_str_len; int input_str_len;
int32_t input_str_chars; int input_str_chars;
zend_uchar input_str_type; zend_uchar input_str_type;
long mult; /* Multiplier */ long mult; /* Multiplier */
void *result; /* Resulting string */ void *result; /* Resulting string */
int32_t result_len; /* Length of the resulting string, in bytes */ int result_len; /* Length of the resulting string, in bytes */
int32_t result_chars; /* Chars/UChars in resulting string */ int result_chars; /* Chars/UChars in resulting string */
if ( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tl", &input_str, if ( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tl", &input_str,
&input_str_chars, &input_str_type, &mult) == FAILURE ) { &input_str_chars, &input_str_type, &mult) == FAILURE ) {
@ -6155,8 +6157,8 @@ PHP_FUNCTION(str_pad)
zend_uchar input_type, padstr_type; zend_uchar input_type, padstr_type;
/* Helper variables */ /* Helper variables */
int32_t input_codepts; /* Number of codepts in Unicode input */ int input_codepts; /* Number of codepts in Unicode input */
int32_t num_pad_chars; /* Number of padding characters (total - input size) */ int num_pad_chars; /* Number of padding characters (total - input size) */
void *result = NULL; /* Resulting string */ void *result = NULL; /* Resulting string */
int32_t result_len = 0; /* Length of the resulting string */ int32_t result_len = 0; /* Length of the resulting string */
int32_t i, j, left_pad=0, right_pad=0; int32_t i, j, left_pad=0, right_pad=0;
@ -6399,7 +6401,7 @@ PHP_FUNCTION(str_word_count)
} }
if (char_list) { if (char_list) {
php_charmask(char_list, char_list_len, ch TSRMLS_CC); php_charmask((unsigned char*)char_list, char_list_len, ch TSRMLS_CC);
} }
p = str; p = str;

View file

@ -450,8 +450,8 @@ PHPAPI char *php_url_encode(char const *s, int len, int *new_length)
unsigned char *to, *start; unsigned char *to, *start;
unsigned char const *from, *end; unsigned char const *from, *end;
from = s; from = (unsigned char*)s;
end = s + len; end = from + len;
start = to = (unsigned char *) safe_emalloc(3, len, 1); start = to = (unsigned char *) safe_emalloc(3, len, 1);
while (from < end) { while (from < end) {

View file

@ -474,7 +474,6 @@ PHP_FUNCTION(stream_bucket_new)
zval *zstream, *zbucket; zval *zstream, *zbucket;
php_stream *stream; php_stream *stream;
zval *buffer; zval *buffer;
char *pbuffer;
php_stream_bucket *bucket; php_stream_bucket *bucket;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zstream, &buffer) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zstream, &buffer) == FAILURE) {
@ -510,7 +509,7 @@ PHP_FUNCTION(stream_bucket_new)
PHP_FUNCTION(stream_get_filters) PHP_FUNCTION(stream_get_filters)
{ {
zstr filter_name; zstr filter_name;
int key_flags, filter_name_len = 0; uint key_flags, filter_name_len = 0;
HashTable *filters_hash; HashTable *filters_hash;
ulong num_key; ulong num_key;

View file

@ -42,7 +42,7 @@
/* {{{ php_var_dump */ /* {{{ php_var_dump */
/* temporary, for debugging */ /* temporary, for debugging */
static void php_var_dump_unicode(UChar *ustr, int32_t length, int verbose, char *quote, int escape TSRMLS_DC) static void php_var_dump_unicode(UChar *ustr, int length, int verbose, char *quote, int escape TSRMLS_DC)
{ {
UChar32 c; UChar32 c;
int32_t i; int32_t i;

View file

@ -907,11 +907,11 @@ yy67:
*p = YYCURSOR; *p = YYCURSOR;
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
if (!strncmp(start + 2, "NAN", 3)) { if (!strncmp((char*)start + 2, "NAN", 3)) {
ZVAL_DOUBLE(*rval, php_get_nan()); ZVAL_DOUBLE(*rval, php_get_nan());
} else if (!strncmp(start + 2, "INF", 3)) { } else if (!strncmp((char*)start + 2, "INF", 3)) {
ZVAL_DOUBLE(*rval, php_get_inf()); ZVAL_DOUBLE(*rval, php_get_inf());
} else if (!strncmp(start + 2, "-INF", 4)) { } else if (!strncmp((char*)start + 2, "-INF", 4)) {
ZVAL_DOUBLE(*rval, -php_get_inf()); ZVAL_DOUBLE(*rval, -php_get_inf());
} }

View file

@ -430,11 +430,11 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
*p = YYCURSOR; *p = YYCURSOR;
INIT_PZVAL(*rval); INIT_PZVAL(*rval);
if (!strncmp(start + 2, "NAN", 3)) { if (!strncmp((char*)start + 2, "NAN", 3)) {
ZVAL_DOUBLE(*rval, php_get_nan()); ZVAL_DOUBLE(*rval, php_get_nan());
} else if (!strncmp(start + 2, "INF", 3)) { } else if (!strncmp((char*)start + 2, "INF", 3)) {
ZVAL_DOUBLE(*rval, php_get_inf()); ZVAL_DOUBLE(*rval, php_get_inf());
} else if (!strncmp(start + 2, "-INF", 4)) { } else if (!strncmp((char*)start + 2, "-INF", 4)) {
ZVAL_DOUBLE(*rval, -php_get_inf()); ZVAL_DOUBLE(*rval, -php_get_inf());
} }

View file

@ -38,7 +38,7 @@ static PHP_FUNCTION(unicode_decode)
UErrorCode status; UErrorCode status;
UConverter *conv = NULL; UConverter *conv = NULL;
UChar *target; UChar *target;
int32_t targetlen; int targetlen;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ts", &input.vptr, &len, &type, &encoding, &enclen)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ts", &input.vptr, &len, &type, &encoding, &enclen)) {
return; return;
@ -87,7 +87,7 @@ static PHP_FUNCTION(unicode_encode)
UErrorCode status; UErrorCode status;
UConverter *conv = NULL; UConverter *conv = NULL;
char *target; char *target;
int32_t targetlen; int targetlen;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "us", &uni, &len, &encoding, &enclen)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "us", &uni, &len, &encoding, &enclen)) {
return; return;

View file

@ -312,7 +312,6 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
char *pathbuf, *ptr, *end; char *pathbuf, *ptr, *end;
char *exec_fname; char *exec_fname;
char trypath[MAXPATHLEN]; char trypath[MAXPATHLEN];
struct stat sb;
FILE *fp; FILE *fp;
int path_length; int path_length;
int filename_length; int filename_length;

View file

@ -1926,7 +1926,7 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC)
char *pass; char *pass;
char *user; char *user;
user = php_base64_decode(auth + 6, strlen(auth) - 6, NULL); user = (char*)php_base64_decode((unsigned char*)auth + 6, strlen(auth) - 6, NULL);
if (user) { if (user) {
pass = strchr(user, ':'); pass = strchr(user, ':');
if (pass) { if (pass) {

View file

@ -211,7 +211,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
{ {
FILE *fp; FILE *fp;
fp = fopen("/tmp/ob_log", "a"); fp = fopen("/tmp/ob_log", "a");
fprintf(fp, "NestLevel: %d ObStatus: %d HandlerName: %s\n", OG(ob_nesting_level), status, OG(active_ob_buffer).handler_name); fprintf(fp, "NestLevel: %d ObStatus: %d HandlerName: %s\n", OG(ob_nesting_level), status, OG(active_ob_buffer).handler_name.s);
fclose(fp); fclose(fp);
} }
#endif #endif
@ -270,7 +270,8 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
} }
to_be_destroyed_buffer = OG(active_ob_buffer).buffer; to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
to_be_destroyed_handler_name = OG(active_ob_buffer).handler_name; /* FIXME: unicode support??? */
to_be_destroyed_handler_name = OG(active_ob_buffer).handler_name.s;
if (OG(active_ob_buffer).internal_output_handler if (OG(active_ob_buffer).internal_output_handler
&& (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer) && (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)
&& (final_buffer != OG(active_ob_buffer).buffer)) { && (final_buffer != OG(active_ob_buffer).buffer)) {
@ -361,17 +362,18 @@ PHPAPI void php_end_implicit_flush(TSRMLS_D)
*/ */
PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC) PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC)
{ {
if (OG(ob_nesting_level)==0 || OG(active_ob_buffer).internal_output_handler || strcmp(OG(active_ob_buffer).handler_name, OB_DEFAULT_HANDLER_NAME)) { /* FIXME: Unicode support??? */
if (OG(ob_nesting_level)==0 || OG(active_ob_buffer).internal_output_handler || strcmp(OG(active_ob_buffer).handler_name.s, OB_DEFAULT_HANDLER_NAME)) {
php_start_ob_buffer(NULL, buffer_size, erase TSRMLS_CC); php_start_ob_buffer(NULL, buffer_size, erase TSRMLS_CC);
} }
OG(active_ob_buffer).internal_output_handler = internal_output_handler; OG(active_ob_buffer).internal_output_handler = internal_output_handler;
OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size); OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size);
OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size; OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size;
if (OG(active_ob_buffer).handler_name) { if (OG(active_ob_buffer).handler_name.s) {
efree(OG(active_ob_buffer).handler_name); efree(OG(active_ob_buffer).handler_name.s);
} }
OG(active_ob_buffer).handler_name = estrdup(handler_name); OG(active_ob_buffer).handler_name.s = estrdup(handler_name);
OG(active_ob_buffer).erase = erase; OG(active_ob_buffer).erase = erase;
} }
/* }}} */ /* }}} */
@ -450,9 +452,9 @@ static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type
OG(active_ob_buffer).internal_output_handler = NULL; OG(active_ob_buffer).internal_output_handler = NULL;
if (type == IS_UNICODE) { if (type == IS_UNICODE) {
/* FIXME: Unicode support??? */ /* FIXME: Unicode support??? */
OG(active_ob_buffer).handler_name = eustrdup((handler_name.u && handler_name.u[0])?handler_name.u:(UChar*)OB_DEFAULT_HANDLER_NAME); OG(active_ob_buffer).handler_name.u = eustrdup((handler_name.u && handler_name.u[0])?handler_name.u:(UChar*)OB_DEFAULT_HANDLER_NAME);
} else { } else {
OG(active_ob_buffer).handler_name = estrdup((handler_name.s && handler_name.s[0])?handler_name.s:OB_DEFAULT_HANDLER_NAME); OG(active_ob_buffer).handler_name.s = estrdup((handler_name.s && handler_name.s[0])?handler_name.s:OB_DEFAULT_HANDLER_NAME);
} }
OG(active_ob_buffer).erase = erase; OG(active_ob_buffer).erase = erase;
OG(php_body_write) = php_b_body_write; OG(php_body_write) = php_b_body_write;
@ -595,7 +597,9 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
*/ */
static int php_ob_list_each(php_ob_buffer *ob_buffer, zval *ob_handler_array) static int php_ob_list_each(php_ob_buffer *ob_buffer, zval *ob_handler_array)
{ {
add_next_index_string(ob_handler_array, ob_buffer->handler_name, 1); TSRMLS_FETCH();
add_next_index_text(ob_handler_array, ob_buffer->handler_name, 1);
return 0; return 0;
} }
/* }}} */ /* }}} */
@ -625,7 +629,8 @@ PHP_FUNCTION(ob_list_handlers)
*/ */
static int php_ob_handler_used_each(php_ob_buffer *ob_buffer, char **handler_name) static int php_ob_handler_used_each(php_ob_buffer *ob_buffer, char **handler_name)
{ {
if (!strcmp(ob_buffer->handler_name, *handler_name)) { /* FIXME: Unicode support??? */
if (!strcmp(ob_buffer->handler_name.s, *handler_name)) {
*handler_name = NULL; *handler_name = NULL;
return 1; return 1;
} }
@ -638,10 +643,11 @@ static int php_ob_handler_used_each(php_ob_buffer *ob_buffer, char **handler_nam
*/ */
PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC) PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC)
{ {
/* FIXME: Unicode support??? */
char *tmp = handler_name; char *tmp = handler_name;
if (OG(ob_nesting_level)) { if (OG(ob_nesting_level)) {
if (!strcmp(OG(active_ob_buffer).handler_name, handler_name)) { if (!strcmp(OG(active_ob_buffer).handler_name.s, handler_name)) {
return 1; return 1;
} }
if (OG(ob_nesting_level)>1) { if (OG(ob_nesting_level)>1) {
@ -995,6 +1001,7 @@ PHP_FUNCTION(ob_get_length)
static int php_ob_buffer_status(php_ob_buffer *ob_buffer, zval *result) static int php_ob_buffer_status(php_ob_buffer *ob_buffer, zval *result)
{ {
zval *elem; zval *elem;
TSRMLS_FETCH();
MAKE_STD_ZVAL(elem); MAKE_STD_ZVAL(elem);
array_init(elem); array_init(elem);
@ -1012,7 +1019,7 @@ static int php_ob_buffer_status(php_ob_buffer *ob_buffer, zval *result)
add_assoc_long(elem, "type", PHP_OUTPUT_HANDLER_USER); add_assoc_long(elem, "type", PHP_OUTPUT_HANDLER_USER);
} }
add_assoc_long(elem, "status", ob_buffer->status); add_assoc_long(elem, "status", ob_buffer->status);
add_assoc_string(elem, "name", ob_buffer->handler_name, 1); add_assoc_text(elem, "name", ob_buffer->handler_name, 1);
add_assoc_bool(elem, "del", ob_buffer->erase); add_assoc_bool(elem, "del", ob_buffer->erase);
add_next_index_zval(result, elem); add_next_index_zval(result, elem);
@ -1048,7 +1055,7 @@ PHP_FUNCTION(ob_get_status)
add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_USER); add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_USER);
} }
add_assoc_long(return_value, "status", OG(active_ob_buffer).status); add_assoc_long(return_value, "status", OG(active_ob_buffer).status);
add_assoc_string(return_value, "name", OG(active_ob_buffer).handler_name, 1); add_assoc_text(return_value, "name", OG(active_ob_buffer).handler_name, 1);
add_assoc_bool(return_value, "del", OG(active_ob_buffer).erase); add_assoc_bool(return_value, "del", OG(active_ob_buffer).erase);
} }
} }

View file

@ -86,7 +86,7 @@ int php_info_logos(const char *logo_string TSRMLS_DC)
sapi_add_header(content_header, len, 1); sapi_add_header(content_header, len, 1);
free(content_header); free(content_header);
PHPWRITE(logo_image->data, logo_image->size); PHPWRITE((char*)logo_image->data, logo_image->size);
return 1; return 1;
} }

View file

@ -75,7 +75,7 @@ typedef struct _php_ob_buffer {
php_output_handler_func_t internal_output_handler; php_output_handler_func_t internal_output_handler;
char *internal_output_handler_buffer; char *internal_output_handler_buffer;
uint internal_output_handler_buffer_size; uint internal_output_handler_buffer_size;
char *handler_name; zstr handler_name;
zend_bool erase; zend_bool erase;
} php_ob_buffer; } php_ob_buffer;

View file

@ -57,7 +57,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
} }
PHPAPI void php_u_register_variable_safe(UChar *var, UChar *strval, int32_t str_len, zval *track_vars_array TSRMLS_DC) PHPAPI void php_u_register_variable_safe(UChar *var, UChar *strval, int str_len, zval *track_vars_array TSRMLS_DC)
{ {
zval new_entry; zval new_entry;
assert(strval != NULL); assert(strval != NULL);
@ -244,7 +244,7 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a
UChar *p = NULL; UChar *p = NULL;
UChar *ip; /* index pointer */ UChar *ip; /* index pointer */
UChar *index; UChar *index;
int32_t var_len, index_len; int var_len, index_len;
zval *gpc_element, **gpc_element_p; zval *gpc_element, **gpc_element_p;
zend_bool is_array; zend_bool is_array;
HashTable *symtable1=NULL; HashTable *symtable1=NULL;
@ -298,7 +298,7 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a
if (is_array) { if (is_array) {
zstr escaped_index = NULL_ZSTR; zstr escaped_index = NULL_ZSTR;
UChar *index_s; UChar *index_s;
int32_t new_idx_len = 0; int new_idx_len = 0;
ip++; ip++;
index_s = ip; index_s = ip;
@ -402,9 +402,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
if (val) { /* have a value */ if (val) { /* have a value */
if (UG(unicode)) { if (UG(unicode)) {
UChar *u_var, *u_val; UChar *u_var, *u_val;
int32_t u_var_len, u_val_len; int u_var_len, u_val_len;
int32_t var_len; int var_len;
int32_t val_len; int val_len;
UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR; UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR;
*val++ = '\0'; *val++ = '\0';
@ -534,7 +534,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
var = php_strtok_r(res, separator, &strtok_buf); var = php_strtok_r(res, separator, &strtok_buf);
while (var) { while (var) {
int32_t var_len; int var_len;
val = strchr(var, '='); val = strchr(var, '=');
if (val) { if (val) {
@ -545,7 +545,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
if (UG(unicode)) { if (UG(unicode)) {
UChar *u_var, *u_val; UChar *u_var, *u_val;
int32_t u_var_len, u_val_len; int u_var_len, u_val_len;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
zend_convert_to_unicode(input_conv, &u_var, &u_var_len, var, var_len, &status); zend_convert_to_unicode(input_conv, &u_var, &u_var_len, var, var_len, &status);

View file

@ -38,7 +38,7 @@ PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array T
/* binary-safe version */ /* binary-safe version */
PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC);
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC);
PHPAPI void php_u_register_variable_safe(UChar *var, UChar *strval, int32_t str_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_u_register_variable_safe(UChar *var, UChar *strval, int str_len, zval *track_vars_array TSRMLS_DC);
PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_array TSRMLS_DC); PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_array TSRMLS_DC);
int php_hash_environment(TSRMLS_D); int php_hash_environment(TSRMLS_D);

View file

@ -298,7 +298,7 @@ static void safe_php_register_variable_ex(char *var, zval *val, zval *track_vars
} }
static void safe_u_php_register_variable(UChar *var, UChar *str_val, int32_t str_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) static void safe_u_php_register_variable(UChar *var, UChar *str_val, int str_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC)
{ {
if (override_protection || !is_u_protected_variable(var TSRMLS_CC)) { if (override_protection || !is_u_protected_variable(var TSRMLS_CC)) {
php_u_register_variable_safe(var, str_val, str_len, track_vars_array TSRMLS_CC); php_u_register_variable_safe(var, str_val, str_len, track_vars_array TSRMLS_CC);
@ -324,7 +324,7 @@ static void register_http_post_files_variable(char *strvar, char *val, zval *htt
} }
static void register_u_http_post_files_variable(UChar *strvar, UChar *val, int32_t val_len, zval *http_post_files, zend_bool override_protection TSRMLS_DC) static void register_u_http_post_files_variable(UChar *strvar, UChar *val, int val_len, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
{ {
int register_globals = PG(register_globals); int register_globals = PG(register_globals);
@ -373,7 +373,7 @@ static inline UChar *php_ap_to_unicode(char *in, int32_t in_len, int32_t *out_le
{ {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *buf; UChar *buf;
int32_t buf_len = 0; int buf_len = 0;
UConverter *input_conv = UG(http_input_encoding_conv); UConverter *input_conv = UG(http_input_encoding_conv);
if (!input_conv) { if (!input_conv) {
@ -752,11 +752,11 @@ static char *php_ap_getword(char **line, char stop)
} }
static UChar *substring_u_conf(UChar *start, int32_t len, UChar quote TSRMLS_DC) static UChar *substring_u_conf(UChar *start, int len, UChar quote TSRMLS_DC)
{ {
UChar *result = eumalloc(len + 2); UChar *result = eumalloc(len + 2);
UChar *resp = result; UChar *resp = result;
int32_t i; int i;
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) {

View file

@ -208,8 +208,7 @@ static void xbuf_format_converter(int unicode, smart_str *xbuf, const char *fmt,
register char *s = NULL; register char *s = NULL;
register UChar *u = NULL; register UChar *u = NULL;
char *q; char *q;
int s_len, s_unicode; int s_len, s_unicode, u_len;
int32_t u_len;
register int min_width = 0; register int min_width = 0;
int precision = 0; int precision = 0;

View file

@ -1160,7 +1160,6 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
char *pathbuf, *ptr, *end; char *pathbuf, *ptr, *end;
char *exec_fname; char *exec_fname;
char trypath[MAXPATHLEN]; char trypath[MAXPATHLEN];
struct stat sb;
php_stream *stream; php_stream *stream;
int path_length; int path_length;
int filename_length; int filename_length;