nlopess Sat Jul 22 12:49:36 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/filter filter.c logical_filters.c sanitizing_filters.c
Log:
use const keyword where possible
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.52.2.5&r2=1.52.2.6&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.52.2.5
php-src/ext/filter/filter.c:1.52.2.6
--- php-src/ext/filter/filter.c:1.52.2.5 Sat Jul 22 09:39:24 2006
+++ php-src/ext/filter/filter.c Sat Jul 22 12:49:36 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.52.2.5 2006/07/22 09:39:24 pajoye Exp $ */
+/* $Id: filter.c,v 1.52.2.6 2006/07/22 12:49:36 nlopess Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -31,7 +31,7 @@
#include "filter_private.h"
typedef struct filter_list_entry {
- char *name;
+ const char *name;
int id;
void (*function)(PHP_INPUT_FILTER_PARAM_DECL);
} filter_list_entry;
@@ -274,7 +274,7 @@
{
php_info_print_table_start();
php_info_print_table_row( 2, "Input Validation and Filtering",
"enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.5 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.6 $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.1.2.2
php-src/ext/filter/logical_filters.c:1.1.2.3
--- php-src/ext/filter/logical_filters.c:1.1.2.2 Thu Jul 20 12:58:12 2006
+++ php-src/ext/filter/logical_filters.c Sat Jul 22 12:49:36 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: logical_filters.c,v 1.1.2.2 2006/07/20 12:58:12 pajoye Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.3 2006/07/22 12:49:36 nlopess Exp $ */
#include "php_filter.h"
#include "filter_private.h"
@@ -515,7 +515,7 @@
void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
/* From
http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4 */
- const char *regexp =
"/^((\\\"[^\\\"\\f\\n\\r\\t\\v\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\\-])+\\.)+[A-Za-z\\-]+))$/";
+ const char regexp[] =
"/^((\\\"[^\\\"\\f\\n\\r\\t\\v\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\\-])+\\.)+[A-Za-z\\-]+))$/";
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/sanitizing_filters.c?r1=1.11.2.2&r2=1.11.2.3&diff_format=u
Index: php-src/ext/filter/sanitizing_filters.c
diff -u php-src/ext/filter/sanitizing_filters.c:1.11.2.2
php-src/ext/filter/sanitizing_filters.c:1.11.2.3
--- php-src/ext/filter/sanitizing_filters.c:1.11.2.2 Sat Jul 22 09:39:24 2006
+++ php-src/ext/filter/sanitizing_filters.c Sat Jul 22 12:49:36 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sanitizing_filters.c,v 1.11.2.2 2006/07/22 09:39:24 pajoye Exp $ */
+/* $Id: sanitizing_filters.c,v 1.11.2.3 2006/07/22 12:49:36 nlopess Exp $ */
#include "php_filter.h"
#include "filter_private.h"
@@ -27,7 +27,7 @@
/* }}} */
/* {{{ HELPER FUNCTIONS */
-static void php_filter_encode_html(zval *value, char* chars, int encode_nul)
+static void php_filter_encode_html(zval *value, const char* chars, int
encode_nul)
{
register int x, y;
smart_str str = {0};
@@ -79,7 +79,7 @@
Z_STRLEN_P(value) = str.len;
}
-static unsigned char hexchars[] = "0123456789ABCDEF";
+static const unsigned char hexchars[] = "0123456789ABCDEF";
#define LOWALPHA "abcdefghijklmnopqrstuvwxyz"
#define HIALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -87,7 +87,7 @@
#define DEFAULT_URL_ENCODE LOWALPHA HIALPHA DIGIT "-._"
-static void php_filter_encode_url(zval *value, char* chars, int high, int low,
int encode_nul)
+static void php_filter_encode_url(zval *value, const char* chars, int high,
int low, int encode_nul)
{
register int x, y;
unsigned char *str;
@@ -145,11 +145,11 @@
memset(map, 0, sizeof(filter_map));
}
-static void filter_map_update(filter_map *map, int flag, unsigned char
*allowed_list)
+static void filter_map_update(filter_map *map, int flag, const unsigned char
*allowed_list)
{
int l, i;
- l = strlen((char*)allowed_list);
+ l = strlen((const char*)allowed_list);
for (i = 0; i < l; ++i) {
(*map)[allowed_list[i]] = flag;
}
@@ -255,7 +255,7 @@
void php_filter_email(PHP_INPUT_FILTER_PARAM_DECL)
{
/* Check section 6 of rfc 822 http://www.faqs.org/rfcs/rfc822.html */
- unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT
"!#$%&'*+-/=?^_`{|[EMAIL PROTECTED]";
+ const unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT
"!#$%&'*+-/=?^_`{|[EMAIL PROTECTED]";
filter_map map;
filter_map_init(&map);
@@ -269,7 +269,7 @@
{
/* Strip all chars not part of section 5 of
* http://www.faqs.org/rfcs/rfc1738.html */
- unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT SAFE EXTRA
NATIONAL PUNCTUATION RESERVED;
+ const unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT SAFE EXTRA
NATIONAL PUNCTUATION RESERVED;
filter_map map;
filter_map_init(&map);
@@ -282,7 +282,7 @@
void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL)
{
/* strip everything [^0-9+-] */
- unsigned char allowed_list[] = "+-" DIGIT;
+ const unsigned char allowed_list[] = "+-" DIGIT;
filter_map map;
filter_map_init(&map);
@@ -295,7 +295,7 @@
void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL)
{
/* strip everything [^0-9+-] */
- unsigned char allowed_list[] = "+-" DIGIT;
+ const unsigned char allowed_list[] = "+-" DIGIT;
filter_map map;
filter_map_init(&map);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php