jani Tue, 29 Dec 2009 18:59:58 +
Revision: http://svn.php.net/viewvc?view=revisionrevision=292771
Log:
- WS + CS + folding tags
Changed paths:
U php/php-src/branches/PHP_5_3/main/rfc1867.c
Modified: php/php-src/branches/PHP_5_3/main/rfc1867.c
===
--- php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 18:54:08 UTC (rev 292770)
+++ php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 18:59:58 UTC (rev 292771)
@@ -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|
+--+
*/
@@ -23,7 +23,7 @@
* This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/).
*
- */
+ */
#include stdio.h
#include php.h
@@ -44,7 +44,7 @@
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); \
+ 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); \
@@ -56,7 +56,7 @@
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)
+void php_mb_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)) {
@@ -64,17 +64,18 @@
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){
+ 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)
+void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc TSRMLS_DC) /* {{{ */
{
/* allow only even increments */
if (inc 1) {
@@ -84,15 +85,15 @@
*pval_list = (char **)erealloc(*pval_list, (*num_vars_max+2)*sizeof(char *));
*plen_list = (int *)erealloc(*plen_list, (*num_vars_max+2)*sizeof(int));
}
+/* }}} */
-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)
+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) /* {{{ */
{
- char **val_list=*pval_list;
- int *len_list=*plen_list;
+ 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);
+ if (*num_vars = *num_vars_max) {
+ php_mb_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;
@@ -105,6 +106,7 @@
len_list[*num_vars] = strlen(value);
(*num_vars)++;
}
+/* }}} */
#else
@@ -137,7 +139,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);
@@ -148,26 +150,27 @@
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 void normalize_protected_variable(char *varname TSRMLS_DC)
+static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */
{
- char *s=varname, *index=NULL, *indexend=NULL, *p;
-
+ char *s = varname, *index = NULL, *indexend = NULL, *p;
+
/* overjump leading space */
while (*s == ' ') {
s++;
}
-
+
/* and remove it */
if (s != varname) {
memmove(varname, s, strlen(s)+1);
}
- for (p=varname; *p *p != '['; p++) {
+ for (p = varname; *p *p