[PHP-CVS] svn: /php/php-src/trunk/main/ rfc1867.c

2011-03-12 Thread Pierrick Charron
pierrick Sun, 13 Mar 2011 05:25:45 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309165

Log:
Remove unused variable

Changed paths:
U   php/php-src/trunk/main/rfc1867.c

Modified: php/php-src/trunk/main/rfc1867.c
===
--- php/php-src/trunk/main/rfc1867.c2011-03-13 04:45:12 UTC (rev 309164)
+++ php/php-src/trunk/main/rfc1867.c2011-03-13 05:25:45 UTC (rev 309165)
@@ -676,7 +676,6 @@
int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
zval *http_post_files = NULL;
HashTable *uploaded_files = NULL;
-   int str_len = 0;
multipart_buffer *mbuff;
zval *array_ptr = (zval *) arg;
int fd = -1;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/trunk/main/ rfc1867.c

2010-12-02 Thread Dmitry Stogov
dmitry   Thu, 02 Dec 2010 09:40:53 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305900

Log:
WS and cosmethic changes

Changed paths:
U   php/php-src/trunk/main/rfc1867.c

Modified: php/php-src/trunk/main/rfc1867.c
===
--- php/php-src/trunk/main/rfc1867.c	2010-12-02 03:26:37 UTC (rev 305899)
+++ php/php-src/trunk/main/rfc1867.c	2010-12-02 09:40:53 UTC (rev 305900)
@@ -43,39 +43,25 @@

 static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC);

-#define SAFE_RETURN { \
-	php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \
-	if (lbuf) efree(lbuf); \
-	if (abuf) efree(abuf); \
-	if (array_index) efree(array_index); \
-	zend_hash_destroy(PG(rfc1867_protected_variables)); \
-	zend_llist_destroy(header); \
-	if (mbuff-boundary_next) efree(mbuff-boundary_next); \
-	if (mbuff-boundary) efree(mbuff-boundary); \
-	if (mbuff-buffer) efree(mbuff-buffer); \
-	if (mbuff) efree(mbuff); \
-	return; }
-
-void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr  TSRMLS_DC) /* {{{ */
+static void php_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr  TSRMLS_DC) /* {{{ */
 {
 	int i;
-	if (php_mb_encoding_translation(TSRMLS_C)) {
-		if (num_vars  0 
-			php_mb_gpc_encoding_detector(val_list, len_list, num_vars, NULL TSRMLS_CC) == SUCCESS) {
-			php_mb_gpc_encoding_converter(val_list, len_list, num_vars, NULL, NULL TSRMLS_CC);
-		}
-		for (i = 0; inum_vars; i += 2) {
-			safe_php_register_variable(val_list[i], val_list[i+1], len_list[i+1], array_ptr, 0 TSRMLS_CC);
-			efree(val_list[i]);
-			efree(val_list[i+1]);
-		}
-		efree(val_list);
-		efree(len_list);
+
+	if (num_vars  0 
+		php_mb_gpc_encoding_detector(val_list, len_list, num_vars, NULL TSRMLS_CC) == SUCCESS) {
+		php_mb_gpc_encoding_converter(val_list, len_list, num_vars, NULL, NULL TSRMLS_CC);
 	}
+	for (i = 0; inum_vars; i += 2) {
+		safe_php_register_variable(val_list[i], val_list[i+1], len_list[i+1], array_ptr, 0 TSRMLS_CC);
+		efree(val_list[i]);
+		efree(val_list[i+1]);
+	}
+	efree(val_list);
+	efree(len_list);
 }
-/* }}} */
+/* }}} */

-void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc  TSRMLS_DC) /* {{{ */
+static void php_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc  TSRMLS_DC) /* {{{ */
 {
 	/* allow only even increments */
 	if (inc  1) {
@@ -87,13 +73,13 @@
 }
 /* }}} */

-void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) /* {{{ */
+static void php_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) /* {{{ */
 {
 	char **val_list = *pval_list;
 	int *len_list = *plen_list;

 	if (*num_vars = *num_vars_max) {
-		php_mb_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, 16 TSRMLS_CC);
+		php_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, 16 TSRMLS_CC);
 		/* in case realloc relocated the buffer */
 		val_list = *pval_list;
 		len_list = *plen_list;
@@ -106,21 +92,8 @@
 	len_list[*num_vars] = strlen(value);
 	(*num_vars)++;
 }
-/* }}} */
+/* }}} */

-#else
-
-#define SAFE_RETURN { \
-	if (lbuf) efree(lbuf); \
-	if (abuf) efree(abuf); \
-	if (array_index) efree(array_index); \
-	zend_hash_destroy(PG(rfc1867_protected_variables)); \
-	zend_llist_destroy(header); \
-	if (mbuff-boundary_next) efree(mbuff-boundary_next); \
-	if (mbuff-boundary) efree(mbuff-boundary); \
-	if (mbuff-buffer) efree(mbuff-buffer); \
-	if (mbuff) efree(mbuff); \
-	return; }
 #endif

 /* The longest property name we use in an uploaded file array */
@@ -139,7 +112,7 @@
 #define UPLOAD_ERROR_F7  /* Failed to write file to disk */
 #define UPLOAD_ERROR_X8  /* File upload stopped by extension */

-void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */
+void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */
 {
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_OK, UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_INI_SIZE,   UPLOAD_ERROR_A,  CONST_CS | CONST_PERSISTENT);
@@ -208,16 +181,16 @@
 	}
 	*s = '\0';
 }
-/* }}} */
+/* }}} */

-static void add_protected_variable(char *varname TSRMLS_DC) /* {{{ */
+static void add_protected_variable(char *varname TSRMLS_DC) /* {{{ */
 {
 	int dummy = 1;

 	normalize_protected_variable(varname TSRMLS_CC);
 	zend_hash_add(PG(rfc1867_protected_variables), varname, strlen(varname)+1, dummy, sizeof(int), NULL);
 }
-/* }}} */
+/* }}} */

 static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */
 {
@@ -226,33 +199,33 @@
 }
 /* }}} */

-static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool 

[PHP-CVS] svn: /php/php-src/trunk/main/ rfc1867.c

2009-12-29 Thread Jani Taskinen
jani Tue, 29 Dec 2009 19:23:41 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=292776

Log:
- CS + WS + folding tags

Changed paths:
U   php/php-src/trunk/main/rfc1867.c

Modified: php/php-src/trunk/main/rfc1867.c
===
--- php/php-src/trunk/main/rfc1867.c	2009-12-29 19:14:39 UTC (rev 292775)
+++ php/php-src/trunk/main/rfc1867.c	2009-12-29 19:23:41 UTC (rev 292776)
@@ -13,7 +13,7 @@
| lice...@php.net so we can mail you a copy immediately.   |
+--+
| Authors: Rasmus Lerdorf ras...@php.net |
-   |  Jani Taskinen sni...@php.net  |
+   |  Jani Taskinen j...@php.net|
+--+
  */

@@ -65,7 +65,7 @@
 #define UPLOAD_ERROR_F7  /* Failed to write file to disk */
 #define UPLOAD_ERROR_X8  /* File upload stopped by extension */

-void php_rfc1867_register_constants(TSRMLS_D)
+void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */
 {
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_OK, UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_INI_SIZE,   UPLOAD_ERROR_A,  CONST_CS | CONST_PERSISTENT);
@@ -76,24 +76,24 @@
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_CANT_WRITE, UPLOAD_ERROR_F,  CONST_CS | CONST_PERSISTENT);
 	REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_EXTENSION,  UPLOAD_ERROR_X,  CONST_CS | CONST_PERSISTENT);
 }
+/* }}} */

-static int unlink_filename(char **filename TSRMLS_DC)
+static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */
 {
 	VCWD_UNLINK(*filename);
 	return 0;
 }
+/* }}} */

-void destroy_uploaded_files_hash(TSRMLS_D)
+void destroy_uploaded_files_hash(TSRMLS_D) /* {{{ */
 {
 	zend_hash_apply(SG(rfc1867_uploaded_files), (apply_func_t) unlink_filename TSRMLS_CC);
 	zend_hash_destroy(SG(rfc1867_uploaded_files));
 	FREE_HASHTABLE(SG(rfc1867_uploaded_files));
 }
+/* }}} */

-/*
- *  Following code is based on apache_multipart_buffer.c from libapreq-0.33 package.
- *
- */
+/* {{{ Following code is based on apache_multipart_buffer.c from libapreq-0.33 package. */

 #define FILLUNIT (1024 * 5)

@@ -118,9 +118,9 @@
 } mime_header_entry;

 /*
-  fill up the buffer with client data.
-  returns number of bytes added to buffer.
-*/
+ * Fill up the buffer with client data.
+ * Returns number of bytes added to buffer.
+ */
 static int fill_buffer(multipart_buffer *self TSRMLS_DC)
 {
 	int bytes_to_read, total_read = 0, actual_read = 0;
@@ -195,15 +195,15 @@
 }

 /*
-  gets the next CRLF terminated line from the input buffer.
-  if it doesn't find a CRLF, and the buffer isn't completely full, returns
-  NULL; otherwise, returns the beginning of the null-terminated line,
-  minus the CRLF.
-
-  note that we really just look for LF terminated lines. this works
-  around a bug in internet explorer for the macintosh which sends mime
-  boundaries that are only LF terminated when you use an image submit
-  button in a multipart/form-data form.
+ * Gets the next CRLF terminated line from the input buffer.
+ * If it doesn't find a CRLF, and the buffer isn't completely full, returns
+ * NULL; otherwise, returns the beginning of the null-terminated line,
+ * minus the CRLF.
+ *
+ * Note that we really just look for LF terminated lines. This works
+ * around a bug in internet explorer for the macintosh which sends mime
+ * boundaries that are only LF terminated when you use an image submit
+ * button in a multipart/form-data form.
  */
 static char *next_line(multipart_buffer *self)
 {
@@ -239,7 +239,7 @@
 	return line;
 }

-/* returns the next CRLF terminated line from the client */
+/* Returns the next CRLF terminated line from the client */
 static char *get_line(multipart_buffer *self TSRMLS_DC)
 {
 	char* ptr = next_line(self);
@@ -362,7 +362,6 @@
 	char *res;

 	while (*pos  *pos != stop) {
-
 		if ((quote = *pos) == '' || quote == '\'') {
 			++pos;
 			while (*pos  *pos != quote) {
@@ -376,7 +375,6 @@
 ++pos;
 			}
 		} else ++pos;
-
 	}
 	if (*pos == '\0') {
 		res = estrdup(*line);
@@ -467,10 +465,10 @@
 }

 /*
-  search for a string in a fixed-length byte string.
-  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.
-*/
+ * Search for a string in a fixed-length byte string.
+ * 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)
 {
 	int len = haystacklen;
@@ -559,13 +557,15 @@

 	return out;
 }
+/* }}} */

-static void register_raw_var_ex(char *var, zval *value, HashTable *array)