com php-src: fixes to main/: main/main.c main/rfc1867.c main/snprintf.c main/snprintf.h

From: Date: Wed, 16 Oct 2013 10:05:13 +0000
Subject: com php-src: fixes to main/: main/main.c main/rfc1867.c main/snprintf.c main/snprintf.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73496@lists.php.net to get a copy of this message
Commit: dec724e98dfaad3c684e20ac1c47579f76708b6f Author: Anatol Belski <ab@php.net> Mon, 29 Jul 2013 02:16:39 -0700 Parents: 646b5d306cb699bd82aeb46bf9f8f989ad62098c Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dec724e98dfaad3c684e20ac1c47579f76708b6f Log: fixes to main/ Changed paths: M main/main.c M main/rfc1867.c M main/snprintf.c M main/snprintf.h

diff --git a/main/main.c b/main/main.c index 7291767..290c2c3 100644 --- a/main/main.c +++ b/main/main.c @@ -371,7 +371,8 @@ static PHP_INI_MH(OnUpdateDisplayErrors) */ static PHP_INI_DISP(display_errors_mode) { - int mode, tmp_value_length, cgi_or_cli; + int mode, cgi_or_cli; + zend_str_size_int tmp_value_length; char *tmp_value; TSRMLS_FETCH(); @@ -628,7 +629,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644); if (fd != -1) { char *tmp; - int len; + zend_str_size_int len; char *error_time_str; time(&error_time); @@ -645,7 +646,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) #ifdef PHP_WIN32 php_flock(fd, 2); #endif - php_ignore_value(write(fd, tmp, len)); + php_ignore_value(write(fd, tmp, len)); /* XXX rework on windows, write expects int*/ efree(tmp); efree(error_time_str); close(fd); @@ -702,11 +703,11 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c char *buffer = NULL, *docref_buf = NULL, *target = NULL; char *docref_target = "", *docref_root = ""; char *p; - int buffer_len = 0; + zend_str_size_int buffer_len = 0; const char *space = ""; const char *class_name = ""; const char *function; - int origin_len; + zend_str_size_int origin_len; char *origin; char *message; int is_function = 0; @@ -787,7 +788,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c /* no docref given but function is known (the default) */ if (!docref && is_function) { - int doclen; + zend_str_size_int doclen; while (*function == '_') { function++; } @@ -919,7 +920,7 @@ PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const php_error_docref2(NULL TSRMLS_CC, param1, param2, E_WARNING, "%s", strerror(errno)); } else { char buf[PHP_WIN32_ERROR_MSG_BUFFER_SIZE + 1]; - int buf_len; + zend_str_size_int buf_len; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, buf, PHP_WIN32_ERROR_MSG_BUFFER_SIZE, NULL); buf_len = strlen(buf); @@ -945,7 +946,8 @@ PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) static void php_error_cb(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) { char *buffer; - int buffer_len, display; + zend_str_size_int buffer_len; + int display; TSRMLS_FETCH(); buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); diff --git a/main/rfc1867.c b/main/rfc1867.c index 4adc257..3b99110 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -57,7 +57,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL; PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL; -static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); +static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") @@ -162,7 +162,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */ } /* }}} */ -static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ { if (override_protection || !is_protected_variable(var TSRMLS_CC)) { php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC); @@ -214,13 +214,13 @@ typedef struct { /* read buffer */ char *buffer; char *buf_begin; - int bufsize; - int bytes_in_buffer; + zend_str_size_int bufsize; + zend_str_size_int bytes_in_buffer; /* boundary info */ char *boundary; char *boundary_next; - int boundary_next_len; + zend_str_size_int boundary_next_len; const zend_encoding *input_encoding; const zend_encoding **detect_order; @@ -236,9 +236,9 @@ typedef struct { * Fill up the buffer with client data. * Returns number of bytes added to buffer. */ -static int fill_buffer(multipart_buffer *self TSRMLS_DC) +static zend_str_size_int fill_buffer(multipart_buffer *self TSRMLS_DC) { - int bytes_to_read, total_read = 0, actual_read = 0; + zend_str_size_int bytes_to_read, total_read = 0, actual_read = 0; /* shift the existing data if necessary */ if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { @@ -282,11 +282,11 @@ static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC) } /* create new multipart_buffer structure */ -static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len TSRMLS_DC) +static multipart_buffer *multipart_buffer_new(char *boundary, zend_str_size_int boundary_len TSRMLS_DC) { multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); - int minsize = boundary_len + 6; + zend_str_size_int minsize = boundary_len + 6; if (minsize < FILLUNIT) minsize = FILLUNIT; self->buffer = (char *) ecalloc(1, minsize + 1); @@ -403,7 +403,7 @@ static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header T { char *line; mime_header_entry prev_entry = {0}, entry; - int prev_len, cur_len; + zend_str_size_int prev_len, cur_len; /* didn't find boundary, abort */ if (!find_boundary(self, self->boundary TSRMLS_CC)) { @@ -513,11 +513,11 @@ static char *php_ap_getword(const zend_encoding *encoding, char **line, char sto return res; } -static char *substring_conf(char *start, int len, char quote) +static char *substring_conf(char *start, zend_str_size_int len, char quote) { char *result = emalloc(len + 1); char *resp = result; - int i; + zend_str_size_int i; for (i = 0; i < len && start[i] != quote; ++i) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { @@ -581,9 +581,9 @@ static char *php_ap_basename(const zend_encoding *encoding, char *path TSRMLS_DC * If partial is true, partial matches are allowed at the end of the buffer. * Returns NULL if not found, or a pointer to the start of the first match. */ -static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial) +static void *php_ap_memstr(char *haystack, zend_str_size_int haystacklen, char *needle, zend_str_size_int needlen, int partial) { - int len = haystacklen; + zend_str_size_int len = haystacklen; char *ptr = haystack; /* iterate through first character matches */ @@ -605,9 +605,9 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne } /* read until a boundary condition */ -static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC) +static zend_str_size_int multipart_buffer_read(multipart_buffer *self, char *buf, zend_str_size_int bytes, int *end TSRMLS_DC) { - int len, max; + zend_str_size_int len, max; char *bound; /* fill buffer if needed */ @@ -651,10 +651,10 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, i XXX: this is horrible memory-usage-wise, but we only expect to do this on small pieces of form data. */ -static char *multipart_buffer_read_body(multipart_buffer *self, unsigned int *len TSRMLS_DC) +static char *multipart_buffer_read_body(multipart_buffer *self, zend_str_size_uint *len TSRMLS_DC) { char buf[FILLUNIT], *out=NULL; - int total_bytes=0, read_bytes=0; + zend_str_size_int total_bytes=0, read_bytes=0; while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) { out = erealloc(out, total_bytes + read_bytes + 1); @@ -716,7 +716,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Get the boundary */ boundary = strstr(content_type_dup, "boundary"); if (!boundary) { - int content_type_len = strlen(content_type_dup); + zend_str_size_int content_type_len = strlen(content_type_dup); char *content_type_lcase = estrndup(content_type_dup, content_type_len); php_strtolower(content_type_lcase, content_type_len); @@ -848,9 +848,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Normal form variable, safe to read all data into memory */ if (!filename && param) { - unsigned int value_len; + zend_str_size_uint value_len; char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC); - unsigned int new_val_len; /* Dummy variable */ + zend_str_size_uint new_val_len; /* Dummy variable */ if (!value) { value = estrdup(""); diff --git a/main/snprintf.c b/main/snprintf.c index 23f4935..26f66ca 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c */ /* char * ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len) + register bool_int * is_negative, char *buf_end, register zend_str_size_int *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, */ /* PHPAPI char * php_conv_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len) + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len) { register char *s = buf; register char *p, *p_orig; @@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, if (format != 'F') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - int t_len; + zend_str_size_int t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register int *len) /* {{{ */ +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register zend_str_size_int *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -584,10 +584,11 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char *sp; char *bep; int cc = 0; - int i; + zend_str_size_int i; char *s = NULL; - int s_len, free_zcopy; + zend_str_size_int s_len; + int free_zcopy; zval *zvp, zcopy; int min_width = 0; diff --git a/main/snprintf.h b/main/snprintf.h index f4ed4d2..88dbdf8 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -87,7 +87,7 @@ PHPAPI int ap_php_asprintf(char **buf, const char *format, ...); PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf); PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len); + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len); END_EXTERN_C() @@ -153,10 +153,10 @@ typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len); + register bool_int * is_negative, char *buf_end, register zend_str_size_int *len); extern char * ap_php_conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register int *len); + char format, char *buf_end, register zend_str_size_int *len); /* The maximum precision that's allowed for float conversion. Does not include * decimal separator, exponent, sign, terminator. Currently does not affect
« previous php.cvs (#73496) next »