mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Move constants into read-only data segment
This commit is contained in:
@@ -203,7 +203,7 @@ ZEND_API void zend_register_string_constant(const char *name, size_t name_len, c
|
||||
static zend_constant *zend_get_special_constant(const char *name, size_t name_len)
|
||||
{
|
||||
zend_constant *c;
|
||||
static char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
|
||||
if (!EG(current_execute_data)) {
|
||||
return NULL;
|
||||
|
||||
@@ -211,7 +211,7 @@ static int php_bz2iop_flush(php_stream *stream)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_stream_bz2io_ops = {
|
||||
const php_stream_ops php_stream_bz2io_ops = {
|
||||
php_bz2iop_write, php_bz2iop_read,
|
||||
php_bz2iop_close, php_bz2iop_flush,
|
||||
"BZip2",
|
||||
@@ -317,7 +317,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops bzip2_stream_wops = {
|
||||
static const php_stream_wrapper_ops bzip2_stream_wops = {
|
||||
_php_stream_bz2open,
|
||||
NULL, /* close */
|
||||
NULL, /* fstat */
|
||||
|
||||
@@ -193,7 +193,7 @@ static void php_bz2_decompress_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops php_bz2_decompress_ops = {
|
||||
static const php_stream_filter_ops php_bz2_decompress_ops = {
|
||||
php_bz2_decompress_filter,
|
||||
php_bz2_decompress_dtor,
|
||||
"bzip2.decompress"
|
||||
@@ -297,7 +297,7 @@ static void php_bz2_compress_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops php_bz2_compress_ops = {
|
||||
static const php_stream_filter_ops php_bz2_compress_ops = {
|
||||
php_bz2_compress_filter,
|
||||
php_bz2_compress_dtor,
|
||||
"bzip2.compress"
|
||||
@@ -309,7 +309,7 @@ static php_stream_filter_ops php_bz2_compress_ops = {
|
||||
|
||||
static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
|
||||
{
|
||||
php_stream_filter_ops *fops = NULL;
|
||||
const php_stream_filter_ops *fops = NULL;
|
||||
php_bz2_filter_data *data;
|
||||
int status = BZ_OK;
|
||||
|
||||
@@ -399,7 +399,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
return php_stream_filter_alloc(fops, data, persistent);
|
||||
}
|
||||
|
||||
php_stream_filter_factory php_bz2_filter_factory = {
|
||||
const php_stream_filter_factory php_bz2_filter_factory = {
|
||||
php_bz2_filter_create
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@@ -56,8 +56,8 @@ PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *
|
||||
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream) _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC)
|
||||
#define php_stream_bz2open(wrapper, path, mode, options, opened_path) _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC)
|
||||
|
||||
extern php_stream_filter_factory php_bz2_filter_factory;
|
||||
extern php_stream_ops php_stream_bz2io_ops;
|
||||
extern const php_stream_filter_factory php_bz2_filter_factory;
|
||||
extern const php_stream_ops php_stream_bz2io_ops;
|
||||
#define PHP_STREAM_IS_BZIP2 &php_stream_bz2io_ops
|
||||
|
||||
/* 400kb */
|
||||
|
||||
@@ -185,17 +185,17 @@ typedef void (*cal_from_jd_func_t) (zend_long jd, int *year, int *month, int *da
|
||||
typedef char *(*cal_as_string_func_t) (int year, int month, int day);
|
||||
|
||||
struct cal_entry_t {
|
||||
char *name;
|
||||
char *symbol;
|
||||
const char *name;
|
||||
const char *symbol;
|
||||
cal_to_jd_func_t to_jd;
|
||||
cal_from_jd_func_t from_jd;
|
||||
int num_months;
|
||||
int max_days_in_month;
|
||||
char **month_name_short;
|
||||
char **month_name_long;
|
||||
const char * const * month_name_short;
|
||||
const char * const * month_name_long;
|
||||
};
|
||||
|
||||
static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
|
||||
static const struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
|
||||
{"Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31,
|
||||
MonthNameShort, MonthNameLong},
|
||||
{"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31,
|
||||
@@ -266,7 +266,7 @@ static void _php_cal_info(int cal, zval *ret)
|
||||
{
|
||||
zval months, smonths;
|
||||
int i;
|
||||
struct cal_entry_t *calendar;
|
||||
const struct cal_entry_t *calendar;
|
||||
|
||||
calendar = &cal_conversion_table[cal];
|
||||
array_init(ret);
|
||||
@@ -327,7 +327,7 @@ PHP_FUNCTION(cal_info)
|
||||
PHP_FUNCTION(cal_days_in_month)
|
||||
{
|
||||
zend_long cal, month, year;
|
||||
struct cal_entry_t *calendar;
|
||||
const struct cal_entry_t *calendar;
|
||||
zend_long sdn_start, sdn_next;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) {
|
||||
@@ -396,7 +396,7 @@ PHP_FUNCTION(cal_from_jd)
|
||||
zend_long jd, cal;
|
||||
int month, day, year, dow;
|
||||
char date[16];
|
||||
struct cal_entry_t *calendar;
|
||||
const struct cal_entry_t *calendar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -695,7 +695,7 @@ PHP_FUNCTION(jddayofweek)
|
||||
{
|
||||
zend_long julday, mode = CAL_DOW_DAYNO;
|
||||
int day;
|
||||
char *daynamel, *daynames;
|
||||
const char *daynamel, *daynames;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -725,7 +725,7 @@ PHP_FUNCTION(jddayofweek)
|
||||
PHP_FUNCTION(jdmonthname)
|
||||
{
|
||||
zend_long julday, mode;
|
||||
char *monthname = NULL;
|
||||
const char *monthname = NULL;
|
||||
int month, day, year;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) {
|
||||
|
||||
@@ -44,7 +44,7 @@ int DayOfWeek(
|
||||
}
|
||||
}
|
||||
|
||||
char *DayNameShort[7] =
|
||||
const char * const DayNameShort[7] =
|
||||
{
|
||||
"Sun",
|
||||
"Mon",
|
||||
@@ -55,7 +55,7 @@ char *DayNameShort[7] =
|
||||
"Sat"
|
||||
};
|
||||
|
||||
char *DayNameLong[7] =
|
||||
const char * const DayNameLong[7] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
|
||||
@@ -131,7 +131,7 @@ zend_long FrenchToSdn(
|
||||
+ FRENCH_SDN_OFFSET);
|
||||
}
|
||||
|
||||
char *FrenchMonthName[14] =
|
||||
const char * const FrenchMonthName[14] =
|
||||
{
|
||||
"",
|
||||
"Vendemiaire",
|
||||
|
||||
@@ -235,7 +235,7 @@ zend_long GregorianToSdn(
|
||||
- GREGOR_SDN_OFFSET);
|
||||
}
|
||||
|
||||
char *MonthNameShort[13] =
|
||||
const char * const MonthNameShort[13] =
|
||||
{
|
||||
"",
|
||||
"Jan",
|
||||
@@ -252,7 +252,7 @@ char *MonthNameShort[13] =
|
||||
"Dec"
|
||||
};
|
||||
|
||||
char *MonthNameLong[13] =
|
||||
const char * const MonthNameLong[13] =
|
||||
{
|
||||
"",
|
||||
"January",
|
||||
|
||||
@@ -287,19 +287,19 @@
|
||||
#define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204)
|
||||
#define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589)
|
||||
|
||||
int monthsPerYear[19] =
|
||||
const int monthsPerYear[19] =
|
||||
{
|
||||
12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13
|
||||
};
|
||||
|
||||
static int yearOffset[19] =
|
||||
static const int yearOffset[19] =
|
||||
{
|
||||
0, 12, 24, 37, 49, 61, 74, 86, 99, 111, 123,
|
||||
136, 148, 160, 173, 185, 197, 210, 222
|
||||
};
|
||||
|
||||
/* names for leap (13-month) year */
|
||||
char *JewishMonthNameLeap[14] =
|
||||
const char * const JewishMonthNameLeap[14] =
|
||||
{
|
||||
"",
|
||||
"Tishri",
|
||||
@@ -318,7 +318,7 @@ char *JewishMonthNameLeap[14] =
|
||||
};
|
||||
|
||||
/* names for regular year */
|
||||
char *JewishMonthName[14] =
|
||||
const char * const JewishMonthName[14] =
|
||||
{
|
||||
"",
|
||||
"Tishri",
|
||||
@@ -337,7 +337,7 @@ char *JewishMonthName[14] =
|
||||
};
|
||||
|
||||
/* names for leap (13-month) year */
|
||||
char *JewishMonthHebNameLeap[14] =
|
||||
const char * const JewishMonthHebNameLeap[14] =
|
||||
{
|
||||
"",
|
||||
"úùøé",
|
||||
@@ -356,7 +356,7 @@ char *JewishMonthHebNameLeap[14] =
|
||||
};
|
||||
|
||||
/* names for regular year */
|
||||
char *JewishMonthHebName[14] =
|
||||
const char * const JewishMonthHebName[14] =
|
||||
{
|
||||
"",
|
||||
"úùøé",
|
||||
|
||||
@@ -70,8 +70,8 @@
|
||||
/* Gregorian calendar conversions. */
|
||||
void SdnToGregorian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
|
||||
zend_long GregorianToSdn(int year, int month, int day);
|
||||
extern char *MonthNameShort[13];
|
||||
extern char *MonthNameLong[13];
|
||||
extern const char * const MonthNameShort[13];
|
||||
extern const char * const MonthNameLong[13];
|
||||
|
||||
/* Julian calendar conversions. */
|
||||
void SdnToJulian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
|
||||
@@ -80,23 +80,23 @@ zend_long JulianToSdn(int year, int month, int day);
|
||||
/* Jewish calendar conversions. */
|
||||
void SdnToJewish(zend_long sdn, int *pYear, int *pMonth, int *pDay);
|
||||
zend_long JewishToSdn(int year, int month, int day);
|
||||
extern char *JewishMonthName[14];
|
||||
extern char *JewishMonthNameLeap[14];
|
||||
extern char *JewishMonthHebName[14];
|
||||
extern char *JewishMonthHebNameLeap[14];
|
||||
extern int monthsPerYear[19];
|
||||
extern const char * const JewishMonthName[14];
|
||||
extern const char * const JewishMonthNameLeap[14];
|
||||
extern const char * const JewishMonthHebName[14];
|
||||
extern const char * const JewishMonthHebNameLeap[14];
|
||||
extern const int monthsPerYear[19];
|
||||
|
||||
/* French republic calendar conversions. */
|
||||
void SdnToFrench(zend_long sdn, int *pYear, int *pMonth, int *pDay);
|
||||
zend_long FrenchToSdn(int inputYear, int inputMonth, int inputDay);
|
||||
extern char *FrenchMonthName[14];
|
||||
extern const char * const FrenchMonthName[14];
|
||||
|
||||
/* Islamic calendar conversions. */
|
||||
/* Not implemented yet. */
|
||||
|
||||
/* Day of week conversion. 0=Sunday, 6=Saturday */
|
||||
int DayOfWeek(zend_long sdn);
|
||||
extern char *DayNameShort[7];
|
||||
extern char *DayNameLong[7];
|
||||
extern const char * const DayNameShort[7];
|
||||
extern const char * const DayNameLong[7];
|
||||
|
||||
#endif /* SDNCAL_H */
|
||||
|
||||
@@ -1041,21 +1041,21 @@ PHPAPI timelib_tzinfo *get_timezone_info(void)
|
||||
/* {{{ date() and gmdate() data */
|
||||
#include "zend_smart_str.h"
|
||||
|
||||
static char *mon_full_names[] = {
|
||||
static const char * const mon_full_names[] = {
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
"September", "October", "November", "December"
|
||||
};
|
||||
|
||||
static char *mon_short_names[] = {
|
||||
static const char * const mon_short_names[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
static char *day_full_names[] = {
|
||||
static const char * const day_full_names[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
static char *day_short_names[] = {
|
||||
static const char * const day_short_names[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
@@ -1075,7 +1075,7 @@ static char *english_suffix(timelib_sll number)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ day of week helpers */
|
||||
char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
static const char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
{
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
@@ -1084,7 +1084,7 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
|
||||
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
{
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
|
||||
@@ -221,7 +221,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static globals */
|
||||
static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
|
||||
static const char _generic_superset_name[] = ICONV_UCS4_ENCODING;
|
||||
#define GENERIC_SUPERSET_NAME _generic_superset_name
|
||||
#define GENERIC_SUPERSET_NBYTES 4
|
||||
/* }}} */
|
||||
@@ -2828,7 +2828,7 @@ static void php_iconv_stream_filter_cleanup(php_stream_filter *filter)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_filter_ops php_iconv_stream_filter_ops = {
|
||||
static const php_stream_filter_ops php_iconv_stream_filter_ops = {
|
||||
php_iconv_stream_filter_do_filter,
|
||||
php_iconv_stream_filter_cleanup,
|
||||
"convert.iconv.*"
|
||||
@@ -2880,7 +2880,7 @@ static php_stream_filter *php_iconv_stream_filter_factory_create(const char *nam
|
||||
/* {{{ php_iconv_stream_register_factory */
|
||||
static php_iconv_err_t php_iconv_stream_filter_register_factory(void)
|
||||
{
|
||||
static php_stream_filter_factory filter_factory = {
|
||||
static const php_stream_filter_factory filter_factory = {
|
||||
php_iconv_stream_filter_factory_create
|
||||
};
|
||||
|
||||
|
||||
@@ -588,7 +588,7 @@ zend_module_entry mbstring_module_entry = {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static sapi_post_entry php_post_entries[] */
|
||||
static sapi_post_entry php_post_entries[] = {
|
||||
static const sapi_post_entry php_post_entries[] = {
|
||||
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
|
||||
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
@@ -678,7 +678,7 @@ static mbfl_allocators _php_mb_allocators = {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static sapi_post_entry mbstr_post_entries[] */
|
||||
static sapi_post_entry mbstr_post_entries[] = {
|
||||
static const sapi_post_entry mbstr_post_entries[] = {
|
||||
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mb_post_handler },
|
||||
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
|
||||
@@ -713,7 +713,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
|
||||
if (persistent_script->compiler_halt_offset != 0 &&
|
||||
persistent_script->script.filename) {
|
||||
zend_string *name;
|
||||
char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
|
||||
name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, ZSTR_VAL(persistent_script->script.filename), ZSTR_LEN(persistent_script->script.filename), 0);
|
||||
if (!zend_hash_exists(EG(zend_constants), name)) {
|
||||
|
||||
@@ -106,7 +106,7 @@ static struct timeval php_openssl_subtract_timeval(struct timeval a, struct time
|
||||
static int php_openssl_compare_timeval(struct timeval a, struct timeval b);
|
||||
static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count);
|
||||
|
||||
php_stream_ops php_openssl_socket_ops;
|
||||
const php_stream_ops php_openssl_socket_ops;
|
||||
|
||||
/* Certificate contexts used for server-side SNI selection */
|
||||
typedef struct _php_openssl_sni_cert_t {
|
||||
@@ -2539,7 +2539,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_openssl_socket_ops = {
|
||||
const php_stream_ops php_openssl_socket_ops = {
|
||||
php_openssl_sockop_write, php_openssl_sockop_read,
|
||||
php_openssl_sockop_close, php_openssl_sockop_flush,
|
||||
"tcp_socket/ssl",
|
||||
|
||||
@@ -719,7 +719,7 @@ static int oci_blob_seek(php_stream *stream, zend_off_t offset, int whence, zend
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_ops oci_blob_stream_ops = {
|
||||
static const php_stream_ops oci_blob_stream_ops = {
|
||||
oci_blob_write,
|
||||
oci_blob_read,
|
||||
oci_blob_close,
|
||||
|
||||
@@ -176,7 +176,7 @@ static int pgsql_lob_seek(php_stream *stream, zend_off_t offset, int whence,
|
||||
return pos >= 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
php_stream_ops pdo_pgsql_lob_stream_ops = {
|
||||
const php_stream_ops pdo_pgsql_lob_stream_ops = {
|
||||
pgsql_lob_write,
|
||||
pgsql_lob_read,
|
||||
pgsql_lob_close,
|
||||
|
||||
@@ -109,7 +109,7 @@ enum pdo_pgsql_specific_constants {
|
||||
};
|
||||
|
||||
php_stream *pdo_pgsql_create_lob_stream(zval *pdh, int lfd, Oid oid);
|
||||
extern php_stream_ops pdo_pgsql_lob_stream_ops;
|
||||
extern const php_stream_ops pdo_pgsql_lob_stream_ops;
|
||||
|
||||
#endif /* PHP_PDO_PGSQL_INT_H */
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ typedef struct _php_pgsql_notice {
|
||||
size_t len;
|
||||
} php_pgsql_notice;
|
||||
|
||||
static php_stream_ops php_stream_pgsql_fd_ops = {
|
||||
static const php_stream_ops php_stream_pgsql_fd_ops = {
|
||||
php_pgsql_fd_write,
|
||||
php_pgsql_fd_read,
|
||||
php_pgsql_fd_close,
|
||||
|
||||
@@ -25,7 +25,7 @@ BEGIN_EXTERN_C()
|
||||
void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_dir);
|
||||
END_EXTERN_C()
|
||||
|
||||
php_stream_ops phar_dir_ops = {
|
||||
const php_stream_ops phar_dir_ops = {
|
||||
phar_dir_write, /* write */
|
||||
phar_dir_read, /* read */
|
||||
phar_dir_close, /* close */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "stream.h"
|
||||
#include "dirstream.h"
|
||||
|
||||
php_stream_ops phar_ops = {
|
||||
const php_stream_ops phar_ops = {
|
||||
phar_stream_write, /* write */
|
||||
phar_stream_read, /* read */
|
||||
phar_stream_close, /* close */
|
||||
@@ -34,7 +34,7 @@ php_stream_ops phar_ops = {
|
||||
NULL, /* set option */
|
||||
};
|
||||
|
||||
php_stream_wrapper_ops phar_stream_wops = {
|
||||
const php_stream_wrapper_ops phar_stream_wops = {
|
||||
phar_wrapper_open_url,
|
||||
NULL, /* phar_wrapper_close */
|
||||
NULL, /* phar_wrapper_stat, */
|
||||
|
||||
@@ -100,7 +100,7 @@ typedef struct {
|
||||
int fd;
|
||||
} ps_files;
|
||||
|
||||
ps_module ps_mod_files = {
|
||||
const ps_module ps_mod_files = {
|
||||
/* New save handlers MUST use PS_MOD_UPDATE_TIMESTAMP macro */
|
||||
PS_MOD_UPDATE_TIMESTAMP(files)
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef MOD_FILES_H
|
||||
#define MOD_FILES_H
|
||||
|
||||
extern ps_module ps_mod_files;
|
||||
extern const ps_module ps_mod_files;
|
||||
#define ps_files_ptr &ps_mod_files
|
||||
|
||||
PS_FUNCS_UPDATE_TIMESTAMP(files);
|
||||
|
||||
@@ -219,7 +219,7 @@ static int ps_mm_key_exists(ps_mm *data, const char *key)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ps_module ps_mod_mm = {
|
||||
const ps_module ps_mod_mm = {
|
||||
PS_MOD_SID(mm)
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
PHP_MINIT_FUNCTION(ps_mm);
|
||||
PHP_MSHUTDOWN_FUNCTION(ps_mm);
|
||||
|
||||
extern ps_module ps_mod_mm;
|
||||
extern const ps_module ps_mod_mm;
|
||||
#define ps_mm_ptr &ps_mod_mm
|
||||
|
||||
PS_FUNCS(mm);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "php_session.h"
|
||||
#include "mod_user.h"
|
||||
|
||||
ps_module ps_mod_user = {
|
||||
const ps_module ps_mod_user = {
|
||||
PS_MOD_UPDATE_TIMESTAMP(user)
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef MOD_USER_H
|
||||
#define MOD_USER_H
|
||||
|
||||
extern ps_module ps_mod_user;
|
||||
extern const ps_module ps_mod_user;
|
||||
#define ps_user_ptr &ps_mod_user
|
||||
|
||||
PS_FUNCS_UPDATE_TIMESTAMP(user);
|
||||
|
||||
@@ -157,8 +157,8 @@ typedef struct _php_ps_globals {
|
||||
char *cookie_domain;
|
||||
zend_bool cookie_secure;
|
||||
zend_bool cookie_httponly;
|
||||
ps_module *mod;
|
||||
ps_module *default_mod;
|
||||
const ps_module *mod;
|
||||
const ps_module *default_mod;
|
||||
void *mod_data;
|
||||
php_session_status session_status;
|
||||
zend_long gc_probability;
|
||||
@@ -260,7 +260,7 @@ PHPAPI void php_add_session_var(zend_string *name);
|
||||
PHPAPI zval *php_set_session_var(zend_string *name, zval *state_val, php_unserialize_data_t *var_hash);
|
||||
PHPAPI zval *php_get_session_var(zend_string *name);
|
||||
|
||||
PHPAPI int php_session_register_module(ps_module *);
|
||||
PHPAPI int php_session_register_module(const ps_module *);
|
||||
|
||||
PHPAPI int php_session_register_serializer(const char *name,
|
||||
zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
|
||||
@@ -270,7 +270,7 @@ PHPAPI void php_session_set_id(char *id);
|
||||
PHPAPI int php_session_start(void);
|
||||
PHPAPI int php_session_flush(int write);
|
||||
|
||||
PHPAPI ps_module *_php_find_ps_module(char *name);
|
||||
PHPAPI const ps_module *_php_find_ps_module(char *name);
|
||||
PHPAPI const ps_serializer *_php_find_ps_serializer(char *name);
|
||||
|
||||
PHPAPI int php_session_valid_key(const char *key);
|
||||
|
||||
@@ -533,7 +533,7 @@ static void php_session_normalize_vars() /* {{{ */
|
||||
|
||||
static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
|
||||
{
|
||||
ps_module *tmp;
|
||||
const ps_module *tmp;
|
||||
|
||||
SESSION_CHECK_ACTIVE_STATE;
|
||||
SESSION_CHECK_OUTPUT_STATE;
|
||||
@@ -1059,12 +1059,12 @@ PHPAPI int php_session_register_serializer(const char *name, zend_string *(*enco
|
||||
#define MAX_MODULES 32
|
||||
#define PREDEFINED_MODULES 2
|
||||
|
||||
static ps_module *ps_modules[MAX_MODULES + 1] = {
|
||||
static const ps_module *ps_modules[MAX_MODULES + 1] = {
|
||||
ps_files_ptr,
|
||||
ps_user_ptr
|
||||
};
|
||||
|
||||
PHPAPI int php_session_register_module(ps_module *ptr) /* {{{ */
|
||||
PHPAPI int php_session_register_module(const ps_module *ptr) /* {{{ */
|
||||
{
|
||||
int ret = FAILURE;
|
||||
int i;
|
||||
@@ -1208,7 +1208,7 @@ CACHE_LIMITER_FUNC(nocache) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_session_cache_limiter_t php_session_cache_limiters[] = {
|
||||
static const php_session_cache_limiter_t php_session_cache_limiters[] = {
|
||||
CACHE_LIMITER_ENTRY(public)
|
||||
CACHE_LIMITER_ENTRY(private)
|
||||
CACHE_LIMITER_ENTRY(private_no_expire)
|
||||
@@ -1218,7 +1218,7 @@ static php_session_cache_limiter_t php_session_cache_limiters[] = {
|
||||
|
||||
static int php_session_cache_limiter(void) /* {{{ */
|
||||
{
|
||||
php_session_cache_limiter_t *lim;
|
||||
const php_session_cache_limiter_t *lim;
|
||||
|
||||
if (PS(cache_limiter)[0] == '\0') return 0;
|
||||
if (PS(session_status) != php_session_active) return -1;
|
||||
@@ -1374,10 +1374,10 @@ static int php_session_send_cookie(void) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI ps_module *_php_find_ps_module(char *name) /* {{{ */
|
||||
PHPAPI const ps_module *_php_find_ps_module(char *name) /* {{{ */
|
||||
{
|
||||
ps_module *ret = NULL;
|
||||
ps_module **mod;
|
||||
const ps_module *ret = NULL;
|
||||
const ps_module **mod;
|
||||
int i;
|
||||
|
||||
for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
|
||||
@@ -2913,7 +2913,7 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */
|
||||
|
||||
static PHP_MINFO_FUNCTION(session) /* {{{ */
|
||||
{
|
||||
ps_module **mod;
|
||||
const ps_module **mod;
|
||||
ps_serializer *ser;
|
||||
smart_str save_handlers = {0};
|
||||
smart_str ser_handlers = {0};
|
||||
|
||||
@@ -1205,7 +1205,7 @@ static int php_sqlite3_stream_stat(php_stream *stream, php_stream_statbuf *ssb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static php_stream_ops php_stream_sqlite3_ops = {
|
||||
static const php_stream_ops php_stream_sqlite3_ops = {
|
||||
php_sqlite3_stream_write,
|
||||
php_sqlite3_stream_read,
|
||||
php_sqlite3_stream_close,
|
||||
|
||||
@@ -31,21 +31,21 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
char *mon_full_names[] = {
|
||||
static const char * const mon_full_names[] = {
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
"September", "October", "November", "December"
|
||||
};
|
||||
|
||||
char *mon_short_names[] = {
|
||||
static const char * const mon_short_names[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
char *day_full_names[] = {
|
||||
static const char * const day_full_names[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
char *day_short_names[] = {
|
||||
static const char * const day_short_names[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "zend_smart_str.h"
|
||||
|
||||
/* {{{ rot13 stream filter implementation */
|
||||
static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
|
||||
static const char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static const char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
|
||||
|
||||
static php_stream_filter_status_t strfilter_rot13_filter(
|
||||
php_stream *stream,
|
||||
@@ -61,7 +61,7 @@ static php_stream_filter_status_t strfilter_rot13_filter(
|
||||
return PSFS_PASS_ON;
|
||||
}
|
||||
|
||||
static php_stream_filter_ops strfilter_rot13_ops = {
|
||||
static const php_stream_filter_ops strfilter_rot13_ops = {
|
||||
strfilter_rot13_filter,
|
||||
NULL,
|
||||
"string.rot13"
|
||||
@@ -72,14 +72,14 @@ static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *f
|
||||
return php_stream_filter_alloc(&strfilter_rot13_ops, NULL, persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_factory strfilter_rot13_factory = {
|
||||
static const php_stream_filter_factory strfilter_rot13_factory = {
|
||||
strfilter_rot13_create
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ string.toupper / string.tolower stream filter implementation */
|
||||
static char lowercase[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
static char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static const char lowercase[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
static const char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
static php_stream_filter_status_t strfilter_toupper_filter(
|
||||
php_stream *stream,
|
||||
@@ -137,13 +137,13 @@ static php_stream_filter_status_t strfilter_tolower_filter(
|
||||
return PSFS_PASS_ON;
|
||||
}
|
||||
|
||||
static php_stream_filter_ops strfilter_toupper_ops = {
|
||||
static const php_stream_filter_ops strfilter_toupper_ops = {
|
||||
strfilter_toupper_filter,
|
||||
NULL,
|
||||
"string.toupper"
|
||||
};
|
||||
|
||||
static php_stream_filter_ops strfilter_tolower_ops = {
|
||||
static const php_stream_filter_ops strfilter_tolower_ops = {
|
||||
strfilter_tolower_filter,
|
||||
NULL,
|
||||
"string.tolower"
|
||||
@@ -159,11 +159,11 @@ static php_stream_filter *strfilter_tolower_create(const char *filtername, zval
|
||||
return php_stream_filter_alloc(&strfilter_tolower_ops, NULL, persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_factory strfilter_toupper_factory = {
|
||||
static const php_stream_filter_factory strfilter_toupper_factory = {
|
||||
strfilter_toupper_create
|
||||
};
|
||||
|
||||
static php_stream_filter_factory strfilter_tolower_factory = {
|
||||
static const php_stream_filter_factory strfilter_tolower_factory = {
|
||||
strfilter_tolower_create
|
||||
};
|
||||
/* }}} */
|
||||
@@ -236,7 +236,7 @@ static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter)
|
||||
pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_ops strfilter_strip_tags_ops = {
|
||||
static const php_stream_filter_ops strfilter_strip_tags_ops = {
|
||||
strfilter_strip_tags_filter,
|
||||
strfilter_strip_tags_dtor,
|
||||
"string.strip_tags"
|
||||
@@ -278,7 +278,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv
|
||||
return php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_factory strfilter_strip_tags_factory = {
|
||||
static const php_stream_filter_factory strfilter_strip_tags_factory = {
|
||||
strfilter_strip_tags_create
|
||||
};
|
||||
|
||||
@@ -1688,7 +1688,7 @@ static void strfilter_convert_dtor(php_stream_filter *thisfilter)
|
||||
pefree(Z_PTR(thisfilter->abstract), ((php_convert_filter *)Z_PTR(thisfilter->abstract))->persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_ops strfilter_convert_ops = {
|
||||
static const php_stream_filter_ops strfilter_convert_ops = {
|
||||
strfilter_convert_filter,
|
||||
strfilter_convert_dtor,
|
||||
"convert.*"
|
||||
@@ -1739,7 +1739,7 @@ out:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static php_stream_filter_factory strfilter_convert_factory = {
|
||||
static const php_stream_filter_factory strfilter_convert_factory = {
|
||||
strfilter_convert_create
|
||||
};
|
||||
/* }}} */
|
||||
@@ -1791,7 +1791,7 @@ static void consumed_filter_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops consumed_filter_ops = {
|
||||
static const php_stream_filter_ops consumed_filter_ops = {
|
||||
consumed_filter_filter,
|
||||
consumed_filter_dtor,
|
||||
"consumed"
|
||||
@@ -1799,7 +1799,7 @@ static php_stream_filter_ops consumed_filter_ops = {
|
||||
|
||||
static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
|
||||
{
|
||||
php_stream_filter_ops *fops = NULL;
|
||||
const php_stream_filter_ops *fops = NULL;
|
||||
php_consumed_filter_data *data;
|
||||
|
||||
if (strcasecmp(filtername, "consumed")) {
|
||||
@@ -1816,7 +1816,7 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f
|
||||
return php_stream_filter_alloc(fops, data, persistent);
|
||||
}
|
||||
|
||||
php_stream_filter_factory consumed_filter_factory = {
|
||||
const const php_stream_filter_factory consumed_filter_factory = {
|
||||
consumed_filter_create
|
||||
};
|
||||
|
||||
@@ -1995,7 +1995,7 @@ static void php_chunked_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops chunked_filter_ops = {
|
||||
static const php_stream_filter_ops chunked_filter_ops = {
|
||||
php_chunked_filter,
|
||||
php_chunked_dtor,
|
||||
"dechunk"
|
||||
@@ -2003,7 +2003,7 @@ static php_stream_filter_ops chunked_filter_ops = {
|
||||
|
||||
static php_stream_filter *chunked_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
|
||||
{
|
||||
php_stream_filter_ops *fops = NULL;
|
||||
const php_stream_filter_ops *fops = NULL;
|
||||
php_chunked_filter_data *data;
|
||||
|
||||
if (strcasecmp(filtername, "dechunk")) {
|
||||
@@ -2020,14 +2020,14 @@ static php_stream_filter *chunked_filter_create(const char *filtername, zval *fi
|
||||
return php_stream_filter_alloc(fops, data, persistent);
|
||||
}
|
||||
|
||||
static php_stream_filter_factory chunked_filter_factory = {
|
||||
static const php_stream_filter_factory chunked_filter_factory = {
|
||||
chunked_filter_create
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static const struct {
|
||||
php_stream_filter_ops *ops;
|
||||
php_stream_filter_factory *factory;
|
||||
const php_stream_filter_ops *ops;
|
||||
const php_stream_filter_factory *factory;
|
||||
} standard_filters[] = {
|
||||
{ &strfilter_rot13_ops, &strfilter_rot13_factory },
|
||||
{ &strfilter_toupper_ops, &strfilter_toupper_factory },
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
# define PRINTF_DEBUG(arg)
|
||||
#endif
|
||||
|
||||
static char hexchars[] = "0123456789abcdef";
|
||||
static char HEXCHARS[] = "0123456789ABCDEF";
|
||||
static const char hexchars[] = "0123456789abcdef";
|
||||
static const char HEXCHARS[] = "0123456789ABCDEF";
|
||||
|
||||
/* php_spintf_appendchar() {{{ */
|
||||
inline static void
|
||||
@@ -309,7 +309,7 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
|
||||
inline static void
|
||||
php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number,
|
||||
size_t width, char padding, size_t alignment, int n,
|
||||
char *chartable, int expprec)
|
||||
const char *chartable, int expprec)
|
||||
{
|
||||
char numbuf[NUM_BUF_SIZE];
|
||||
register zend_ulong num;
|
||||
|
||||
@@ -669,7 +669,7 @@ static int php_ftp_dirstream_close(php_stream *stream, int close_handle)
|
||||
|
||||
/* ftp dirstreams only need to support read and close operations,
|
||||
They can't be rewound because the underlying ftp stream can't be rewound. */
|
||||
static php_stream_ops php_ftp_dirstream_ops = {
|
||||
static const php_stream_ops php_ftp_dirstream_ops = {
|
||||
NULL, /* write */
|
||||
php_ftp_dirstream_read, /* read */
|
||||
php_ftp_dirstream_close, /* close */
|
||||
@@ -1170,7 +1170,7 @@ rmdir_errexit:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops ftp_stream_wops = {
|
||||
static const php_stream_wrapper_ops ftp_stream_wops = {
|
||||
php_stream_url_wrap_ftp,
|
||||
php_stream_ftp_stream_close, /* stream_close */
|
||||
php_stream_ftp_stream_stat,
|
||||
|
||||
@@ -1003,7 +1003,7 @@ static int php_stream_http_stream_stat(php_stream_wrapper *wrapper, php_stream *
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops http_stream_wops = {
|
||||
static const php_stream_wrapper_ops http_stream_wops = {
|
||||
php_stream_url_wrap_http,
|
||||
NULL, /* stream_close */
|
||||
php_stream_http_stream_stat,
|
||||
|
||||
@@ -78,7 +78,7 @@ PHP_FUNCTION(metaphone)
|
||||
/* Metachar.h ... little bits about characters for metaphone */
|
||||
/*-- Character encoding array & accessing macros --*/
|
||||
/* Stolen directly out of the book... */
|
||||
char _codes[26] =
|
||||
static const char _codes[26] =
|
||||
{
|
||||
1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2, 2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0
|
||||
/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
|
||||
|
||||
@@ -52,7 +52,7 @@ static int php_stream_output_close(php_stream *stream, int close_handle) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_stream_output_ops = {
|
||||
const php_stream_ops php_stream_output_ops = {
|
||||
php_stream_output_write,
|
||||
php_stream_output_read,
|
||||
php_stream_output_close,
|
||||
@@ -137,7 +137,7 @@ static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int when
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_stream_input_ops = {
|
||||
const php_stream_ops php_stream_input_ops = {
|
||||
php_stream_input_write,
|
||||
php_stream_input_read,
|
||||
php_stream_input_close,
|
||||
@@ -423,7 +423,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops php_stdio_wops = {
|
||||
static const php_stream_wrapper_ops php_stdio_wops = {
|
||||
php_stream_url_wrap_php,
|
||||
NULL, /* close */
|
||||
NULL, /* fstat */
|
||||
|
||||
@@ -124,7 +124,7 @@ PHPAPI char *php_strtoupper(char *s, size_t len);
|
||||
PHPAPI char *php_strtolower(char *s, size_t len);
|
||||
PHPAPI zend_string *php_string_toupper(zend_string *s);
|
||||
PHPAPI zend_string *php_string_tolower(zend_string *s);
|
||||
PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen);
|
||||
PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen);
|
||||
PHPAPI zend_string *php_addslashes(zend_string *str, int should_free);
|
||||
PHPAPI zend_string *php_addcslashes(zend_string *str, int freeit, char *what, size_t what_len);
|
||||
PHPAPI void php_stripslashes(zend_string *str);
|
||||
|
||||
@@ -2889,7 +2889,7 @@ PHP_FUNCTION(ucwords)
|
||||
|
||||
/* {{{ php_strtr
|
||||
*/
|
||||
PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen)
|
||||
PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -2924,7 +2924,7 @@ PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size
|
||||
|
||||
/* {{{ php_strtr_ex
|
||||
*/
|
||||
static zend_string *php_strtr_ex(zend_string *str, char *str_from, char *str_to, size_t trlen)
|
||||
static zend_string *php_strtr_ex(zend_string *str, const char *str_from, const char *str_to, size_t trlen)
|
||||
{
|
||||
zend_string *new_str = NULL;
|
||||
size_t i;
|
||||
@@ -5443,8 +5443,8 @@ PHP_FUNCTION(sscanf)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
|
||||
static const char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static const char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
|
||||
|
||||
/* {{{ proto string str_rot13(string str)
|
||||
Perform the rot13 transform on a string */
|
||||
|
||||
@@ -254,7 +254,7 @@ php_stream_filter_status_t userfilter_filter(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static php_stream_filter_ops userfilter_ops = {
|
||||
static const php_stream_filter_ops userfilter_ops = {
|
||||
userfilter_filter,
|
||||
userfilter_dtor,
|
||||
"user-filter"
|
||||
@@ -380,7 +380,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
|
||||
return filter;
|
||||
}
|
||||
|
||||
static php_stream_filter_factory user_filter_factory = {
|
||||
static const php_stream_filter_factory user_filter_factory = {
|
||||
user_filter_factory_create
|
||||
};
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ zend_module_entry xml_module_entry = {
|
||||
/* All the encoding functions are set to NULL right now, since all
|
||||
* the encoding is currently done internally by expat/xmltok.
|
||||
*/
|
||||
xml_encoding xml_encodings[] = {
|
||||
const xml_encoding xml_encodings[] = {
|
||||
{ (XML_Char *)"ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
|
||||
{ (XML_Char *)"US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
|
||||
{ (XML_Char *)"UTF-8", NULL, NULL },
|
||||
@@ -537,9 +537,9 @@ inline static char xml_decode_us_ascii(unsigned short c)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ xml_get_encoding() */
|
||||
static xml_encoding *xml_get_encoding(const XML_Char *name)
|
||||
static const xml_encoding *xml_get_encoding(const XML_Char *name)
|
||||
{
|
||||
xml_encoding *enc = &xml_encodings[0];
|
||||
const xml_encoding *enc = &xml_encodings[0];
|
||||
|
||||
while (enc && enc->name) {
|
||||
if (strcasecmp((char *)name, (char *)enc->name) == 0) {
|
||||
@@ -558,7 +558,7 @@ PHP_XML_API zend_string *xml_utf8_encode(const char *s, size_t len, const XML_Ch
|
||||
zend_string *str;
|
||||
unsigned int c;
|
||||
unsigned short (*encoder)(unsigned char) = NULL;
|
||||
xml_encoding *enc = xml_get_encoding(encoding);
|
||||
const xml_encoding *enc = xml_get_encoding(encoding);
|
||||
|
||||
if (enc) {
|
||||
encoder = enc->encoding_function;
|
||||
@@ -608,7 +608,7 @@ PHP_XML_API zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XM
|
||||
size_t pos = 0;
|
||||
unsigned int c;
|
||||
char (*decoder)(unsigned short) = NULL;
|
||||
xml_encoding *enc = xml_get_encoding(encoding);
|
||||
const xml_encoding *enc = xml_get_encoding(encoding);
|
||||
zend_string *str;
|
||||
|
||||
if (enc) {
|
||||
@@ -1602,7 +1602,7 @@ PHP_FUNCTION(xml_parser_set_option)
|
||||
parser->skipwhite = zval_get_long(val);
|
||||
break;
|
||||
case PHP_XML_OPTION_TARGET_ENCODING: {
|
||||
xml_encoding *enc;
|
||||
const xml_encoding *enc;
|
||||
convert_to_string_ex(val);
|
||||
enc = xml_get_encoding((XML_Char*)Z_STRVAL_P(val));
|
||||
if (enc == NULL) {
|
||||
|
||||
@@ -199,7 +199,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_stream_zipio_ops = {
|
||||
const php_stream_ops php_stream_zipio_ops = {
|
||||
php_zip_ops_write, php_zip_ops_read,
|
||||
php_zip_ops_close, php_zip_ops_flush,
|
||||
"zip",
|
||||
@@ -348,7 +348,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops zip_stream_wops = {
|
||||
static const php_stream_wrapper_ops zip_stream_wops = {
|
||||
php_stream_zip_opener,
|
||||
NULL, /* close */
|
||||
NULL, /* fstat */
|
||||
|
||||
@@ -67,9 +67,9 @@ ZEND_END_MODULE_GLOBALS(zlib);
|
||||
#define ZLIBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(zlib, v)
|
||||
|
||||
php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
|
||||
extern php_stream_ops php_stream_gzio_ops;
|
||||
extern const php_stream_ops php_stream_gzio_ops;
|
||||
extern php_stream_wrapper php_stream_gzip_wrapper;
|
||||
extern php_stream_filter_factory php_zlib_filter_factory;
|
||||
extern const php_stream_filter_factory php_zlib_filter_factory;
|
||||
extern zend_module_entry php_zlib_module_entry;
|
||||
#define zlib_module_ptr &php_zlib_module_entry
|
||||
#define phpext_zlib_ptr zlib_module_ptr
|
||||
|
||||
@@ -167,7 +167,7 @@ static void php_zlib_inflate_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops php_zlib_inflate_ops = {
|
||||
static const php_stream_filter_ops php_zlib_inflate_ops = {
|
||||
php_zlib_inflate_filter,
|
||||
php_zlib_inflate_dtor,
|
||||
"zlib.inflate"
|
||||
@@ -276,7 +276,7 @@ static void php_zlib_deflate_dtor(php_stream_filter *thisfilter)
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops php_zlib_deflate_ops = {
|
||||
static const php_stream_filter_ops php_zlib_deflate_ops = {
|
||||
php_zlib_deflate_filter,
|
||||
php_zlib_deflate_dtor,
|
||||
"zlib.deflate"
|
||||
@@ -288,7 +288,7 @@ static php_stream_filter_ops php_zlib_deflate_ops = {
|
||||
|
||||
static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
|
||||
{
|
||||
php_stream_filter_ops *fops = NULL;
|
||||
const php_stream_filter_ops *fops = NULL;
|
||||
php_zlib_filter_data *data;
|
||||
int status;
|
||||
|
||||
@@ -421,7 +421,7 @@ factory_setlevel:
|
||||
return php_stream_filter_alloc(fops, data, persistent);
|
||||
}
|
||||
|
||||
php_stream_filter_factory php_zlib_filter_factory = {
|
||||
const php_stream_filter_factory php_zlib_filter_factory = {
|
||||
php_zlib_filter_create
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@@ -100,7 +100,7 @@ static int php_gziop_flush(php_stream *stream)
|
||||
return gzflush(self->gz_file, Z_SYNC_FLUSH);
|
||||
}
|
||||
|
||||
php_stream_ops php_stream_gzio_ops = {
|
||||
const php_stream_ops php_stream_gzio_ops = {
|
||||
php_gziop_write, php_gziop_read,
|
||||
php_gziop_close, php_gziop_flush,
|
||||
"ZLIB",
|
||||
@@ -167,7 +167,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, con
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static php_stream_wrapper_ops gzip_stream_wops = {
|
||||
static const php_stream_wrapper_ops gzip_stream_wops = {
|
||||
php_stream_gzopen,
|
||||
NULL, /* close */
|
||||
NULL, /* stat */
|
||||
|
||||
@@ -932,9 +932,9 @@ SAPI_API int sapi_send_headers(void)
|
||||
}
|
||||
|
||||
|
||||
SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
|
||||
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
|
||||
{
|
||||
sapi_post_entry *p=post_entries;
|
||||
const sapi_post_entry *p=post_entries;
|
||||
|
||||
while (p->content_type) {
|
||||
if (sapi_register_post_entry(p) == FAILURE) {
|
||||
@@ -946,7 +946,7 @@ SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
|
||||
}
|
||||
|
||||
|
||||
SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
|
||||
SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry)
|
||||
{
|
||||
int ret;
|
||||
zend_string *key;
|
||||
@@ -961,7 +961,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
|
||||
return ret;
|
||||
}
|
||||
|
||||
SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
|
||||
SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry)
|
||||
{
|
||||
if (SG(sapi_started) && EG(current_execute_data)) {
|
||||
return;
|
||||
|
||||
@@ -190,9 +190,9 @@ SAPI_API int sapi_send_headers(void);
|
||||
SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
|
||||
SAPI_API void sapi_handle_post(void *arg);
|
||||
SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen);
|
||||
SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
|
||||
SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
|
||||
SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
|
||||
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entry);
|
||||
SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry);
|
||||
SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry);
|
||||
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void));
|
||||
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
|
||||
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* {{{ php_post_entries[]
|
||||
*/
|
||||
static sapi_post_entry php_post_entries[] = {
|
||||
static const sapi_post_entry php_post_entries[] = {
|
||||
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
|
||||
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
|
||||
@@ -56,9 +56,9 @@ PHPAPI const char *_php_stream_mode_to_str(int mode);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
extern PHPAPI php_stream_ops php_stream_memory_ops;
|
||||
extern PHPAPI php_stream_ops php_stream_temp_ops;
|
||||
extern PHPAPI php_stream_ops php_stream_rfc2397_ops;
|
||||
extern PHPAPI const php_stream_ops php_stream_memory_ops;
|
||||
extern PHPAPI const php_stream_ops php_stream_temp_ops;
|
||||
extern PHPAPI const php_stream_ops php_stream_rfc2397_ops;
|
||||
extern PHPAPI php_stream_wrapper php_stream_rfc2397_wrapper;
|
||||
|
||||
#define PHP_STREAM_IS_MEMORY &php_stream_memory_ops
|
||||
|
||||
@@ -299,8 +299,8 @@ struct _php_netstream_data_t {
|
||||
size_t ownsize;
|
||||
};
|
||||
typedef struct _php_netstream_data_t php_netstream_data_t;
|
||||
PHPAPI extern php_stream_ops php_stream_socket_ops;
|
||||
extern php_stream_ops php_stream_generic_socket_ops;
|
||||
PHPAPI extern const php_stream_ops php_stream_socket_ops;
|
||||
extern const php_stream_ops php_stream_generic_socket_ops;
|
||||
#define PHP_STREAM_IS_SOCKET (&php_stream_socket_ops)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
@@ -161,7 +161,7 @@ typedef struct _php_stream_wrapper_ops {
|
||||
} php_stream_wrapper_ops;
|
||||
|
||||
struct _php_stream_wrapper {
|
||||
php_stream_wrapper_ops *wops; /* operations the wrapper can perform */
|
||||
const php_stream_wrapper_ops *wops; /* operations the wrapper can perform */
|
||||
void *abstract; /* context for the wrapper */
|
||||
int is_url; /* so that PG(allow_url_fopen) can be respected */
|
||||
};
|
||||
@@ -188,7 +188,7 @@ struct _php_stream_wrapper {
|
||||
#define PHP_STREAM_FLAG_WAS_WRITTEN 0x80000000
|
||||
|
||||
struct _php_stream {
|
||||
php_stream_ops *ops;
|
||||
const php_stream_ops *ops;
|
||||
void *abstract; /* convenience pointer for abstraction */
|
||||
|
||||
php_stream_filter_chain readfilters, writefilters;
|
||||
@@ -246,7 +246,7 @@ struct _php_stream {
|
||||
|
||||
/* allocate a new stream for a particular ops */
|
||||
BEGIN_EXTERN_C()
|
||||
PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
|
||||
PHPAPI php_stream *_php_stream_alloc(const php_stream_ops *ops, void *abstract,
|
||||
const char *persistent_id, const char *mode STREAMS_DC);
|
||||
END_EXTERN_C()
|
||||
#define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC)
|
||||
@@ -593,7 +593,7 @@ PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void);
|
||||
PHPAPI HashTable *_php_get_stream_filters_hash(void);
|
||||
#define php_get_stream_filters_hash() _php_get_stream_filters_hash()
|
||||
PHPAPI HashTable *php_get_stream_filters_hash_global(void);
|
||||
extern php_stream_wrapper_ops *php_stream_user_wrapper_ops;
|
||||
extern const php_stream_wrapper_ops *php_stream_user_wrapper_ops;
|
||||
END_EXTERN_C()
|
||||
#endif
|
||||
|
||||
|
||||
@@ -487,9 +487,9 @@ PHPAPI char * ap_php_conv_p2(register u_wide_int num, register int nbits, char f
|
||||
{
|
||||
register int mask = (1 << nbits) - 1;
|
||||
register char *p = buf_end;
|
||||
static char low_digits[] = "0123456789abcdef";
|
||||
static char upper_digits[] = "0123456789ABCDEF";
|
||||
register char *digits = (format == 'X') ? upper_digits : low_digits;
|
||||
static const char low_digits[] = "0123456789abcdef";
|
||||
static const char upper_digits[] = "0123456789ABCDEF";
|
||||
register const char *digits = (format == 'X') ? upper_digits : low_digits;
|
||||
|
||||
do {
|
||||
*--p = digits[num & mask];
|
||||
|
||||
@@ -44,11 +44,11 @@ PHPAPI HashTable *_php_get_stream_filters_hash(void)
|
||||
}
|
||||
|
||||
/* API for registering GLOBAL filters */
|
||||
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory)
|
||||
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, const php_stream_filter_factory *factory)
|
||||
{
|
||||
int ret;
|
||||
zend_string *str = zend_string_init_interned(filterpattern, strlen(filterpattern), 1);
|
||||
ret = zend_hash_add_ptr(&stream_filters_hash, str, factory) ? SUCCESS : FAILURE;
|
||||
ret = zend_hash_add_ptr(&stream_filters_hash, str, (void*)factory) ? SUCCESS : FAILURE;
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern)
|
||||
}
|
||||
|
||||
/* API for registering VOLATILE wrappers */
|
||||
PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, php_stream_filter_factory *factory)
|
||||
PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, const php_stream_filter_factory *factory)
|
||||
{
|
||||
if (!FG(stream_filters)) {
|
||||
ALLOC_HASHTABLE(FG(stream_filters));
|
||||
@@ -67,7 +67,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpatter
|
||||
zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL);
|
||||
}
|
||||
|
||||
return zend_hash_add_ptr(FG(stream_filters), filterpattern, factory) ? SUCCESS : FAILURE;
|
||||
return zend_hash_add_ptr(FG(stream_filters), filterpattern, (void*)factory) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
/* Buckets */
|
||||
@@ -224,7 +224,7 @@ PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket)
|
||||
PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
|
||||
{
|
||||
HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash);
|
||||
php_stream_filter_factory *factory = NULL;
|
||||
const php_stream_filter_factory *factory = NULL;
|
||||
php_stream_filter *filter = NULL;
|
||||
size_t n;
|
||||
char *period;
|
||||
@@ -264,7 +264,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
|
||||
return filter;
|
||||
}
|
||||
|
||||
PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC)
|
||||
PHPAPI php_stream_filter *_php_stream_filter_alloc(const php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC)
|
||||
{
|
||||
php_stream_filter *filter;
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ static int php_glob_stream_rewind(php_stream *stream, zend_off_t offset, int whe
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_glob_stream_ops = {
|
||||
const php_stream_ops php_glob_stream_ops = {
|
||||
NULL, php_glob_stream_read,
|
||||
php_glob_stream_close, NULL,
|
||||
"glob",
|
||||
@@ -261,7 +261,7 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const cha
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static php_stream_wrapper_ops php_glob_stream_wrapper_ops = {
|
||||
static const php_stream_wrapper_ops php_glob_stream_wrapper_ops = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -264,7 +264,7 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI php_stream_ops php_stream_memory_ops = {
|
||||
PHPAPI const php_stream_ops php_stream_memory_ops = {
|
||||
php_stream_memory_write, php_stream_memory_read,
|
||||
php_stream_memory_close, php_stream_memory_flush,
|
||||
"MEMORY",
|
||||
@@ -560,7 +560,7 @@ static int php_stream_temp_set_option(php_stream *stream, int option, int value,
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI php_stream_ops php_stream_temp_ops = {
|
||||
PHPAPI const php_stream_ops php_stream_temp_ops = {
|
||||
php_stream_temp_write, php_stream_temp_read,
|
||||
php_stream_temp_close, php_stream_temp_flush,
|
||||
"TEMP",
|
||||
@@ -622,7 +622,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI php_stream_ops php_stream_rfc2397_ops = {
|
||||
PHPAPI const php_stream_ops php_stream_rfc2397_ops = {
|
||||
php_stream_temp_write, php_stream_temp_read,
|
||||
php_stream_temp_close, php_stream_temp_flush,
|
||||
"RFC2397",
|
||||
@@ -772,7 +772,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
|
||||
return stream;
|
||||
}
|
||||
|
||||
PHPAPI php_stream_wrapper_ops php_stream_rfc2397_wops = {
|
||||
PHPAPI const php_stream_wrapper_ops php_stream_rfc2397_wops = {
|
||||
php_stream_url_wrap_rfc2397,
|
||||
NULL, /* close */
|
||||
NULL, /* fstat */
|
||||
|
||||
@@ -106,7 +106,7 @@ typedef struct _php_stream_filter_chain {
|
||||
} php_stream_filter_chain;
|
||||
|
||||
struct _php_stream_filter {
|
||||
php_stream_filter_ops *fops;
|
||||
const php_stream_filter_ops *fops;
|
||||
zval abstract; /* for use by filter implementation */
|
||||
php_stream_filter *next;
|
||||
php_stream_filter *prev;
|
||||
@@ -131,7 +131,7 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea
|
||||
PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish);
|
||||
PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor);
|
||||
PHPAPI void php_stream_filter_free(php_stream_filter *filter);
|
||||
PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC);
|
||||
PHPAPI php_stream_filter *_php_stream_filter_alloc(const php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC);
|
||||
END_EXTERN_C()
|
||||
#define php_stream_filter_alloc(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_CC)
|
||||
#define php_stream_filter_alloc_rel(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_REL_CC)
|
||||
@@ -146,9 +146,9 @@ typedef struct _php_stream_filter_factory {
|
||||
} php_stream_filter_factory;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory);
|
||||
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, const php_stream_filter_factory *factory);
|
||||
PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern);
|
||||
PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, php_stream_filter_factory *factory);
|
||||
PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, const php_stream_filter_factory *factory);
|
||||
PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent);
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
PHPAPI extern php_stream_wrapper php_glob_stream_wrapper;
|
||||
PHPAPI extern php_stream_ops php_glob_stream_ops;
|
||||
PHPAPI extern php_stream_wrapper php_glob_stream_wrapper;
|
||||
PHPAPI extern const php_stream_ops php_glob_stream_ops;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
|
||||
/* for user-space streams */
|
||||
PHPAPI extern php_stream_ops php_stream_userspace_ops;
|
||||
PHPAPI extern php_stream_ops php_stream_userspace_dir_ops;
|
||||
PHPAPI extern const php_stream_ops php_stream_userspace_ops;
|
||||
PHPAPI extern const php_stream_ops php_stream_userspace_dir_ops;
|
||||
#define PHP_STREAM_IS_USERSPACE &php_stream_userspace_ops
|
||||
#define PHP_STREAM_IS_USERSPACE_DIR &php_stream_userspace_dir_ops
|
||||
|
||||
|
||||
@@ -881,6 +881,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
|
||||
}
|
||||
}
|
||||
|
||||
/* This should be "const", but phpdbg overwrite it */
|
||||
PHPAPI php_stream_ops php_stream_stdio_ops = {
|
||||
php_stdiop_write, php_stdiop_read,
|
||||
php_stdiop_close, php_stdiop_flush,
|
||||
@@ -923,7 +924,7 @@ static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offse
|
||||
return 0;
|
||||
}
|
||||
|
||||
static php_stream_ops php_plain_files_dirstream_ops = {
|
||||
static const php_stream_ops php_plain_files_dirstream_ops = {
|
||||
NULL, php_plain_files_dirstream_read,
|
||||
php_plain_files_dirstream_close, NULL,
|
||||
"dir",
|
||||
@@ -1409,7 +1410,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
|
||||
}
|
||||
|
||||
|
||||
static php_stream_wrapper_ops php_plain_files_wrapper_ops = {
|
||||
static const php_stream_wrapper_ops php_plain_files_wrapper_ops = {
|
||||
php_plain_files_stream_opener,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -267,7 +267,7 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option
|
||||
/* }}} */
|
||||
|
||||
/* allocate a new stream for a particular ops */
|
||||
PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC) /* {{{ */
|
||||
PHPAPI php_stream *_php_stream_alloc(const php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *ret;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
|
||||
static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode,
|
||||
int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
|
||||
|
||||
static php_stream_wrapper_ops user_stream_wops = {
|
||||
static const php_stream_wrapper_ops user_stream_wops = {
|
||||
user_wrapper_opener,
|
||||
NULL, /* close - the streams themselves know how */
|
||||
NULL, /* stat - the streams themselves know how */
|
||||
@@ -1542,7 +1542,7 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
php_stream_ops php_stream_userspace_ops = {
|
||||
const php_stream_ops php_stream_userspace_ops = {
|
||||
php_userstreamop_write, php_userstreamop_read,
|
||||
php_userstreamop_close, php_userstreamop_flush,
|
||||
"user-space",
|
||||
@@ -1552,7 +1552,7 @@ php_stream_ops php_stream_userspace_ops = {
|
||||
php_userstreamop_set_option,
|
||||
};
|
||||
|
||||
php_stream_ops php_stream_userspace_dir_ops = {
|
||||
const php_stream_ops php_stream_userspace_dir_ops = {
|
||||
NULL, /* write */
|
||||
php_userstreamop_readdir,
|
||||
php_userstreamop_closedir,
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
# define XP_SOCK_BUF_SIZE(sz) (sz)
|
||||
#endif
|
||||
|
||||
php_stream_ops php_stream_generic_socket_ops;
|
||||
PHPAPI php_stream_ops php_stream_socket_ops;
|
||||
php_stream_ops php_stream_udp_socket_ops;
|
||||
const php_stream_ops php_stream_generic_socket_ops;
|
||||
PHPAPI const php_stream_ops php_stream_socket_ops;
|
||||
const php_stream_ops php_stream_udp_socket_ops;
|
||||
#ifdef AF_UNIX
|
||||
php_stream_ops php_stream_unix_socket_ops;
|
||||
php_stream_ops php_stream_unixdg_socket_ops;
|
||||
const php_stream_ops php_stream_unix_socket_ops;
|
||||
const php_stream_ops php_stream_unixdg_socket_ops;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ static int php_sockop_cast(php_stream *stream, int castas, void **ret)
|
||||
* A "useful" side-effect is that the user's scripts can then
|
||||
* make similar decisions using stream_get_meta_data.
|
||||
* */
|
||||
php_stream_ops php_stream_generic_socket_ops = {
|
||||
const php_stream_ops php_stream_generic_socket_ops = {
|
||||
php_sockop_write, php_sockop_read,
|
||||
php_sockop_close, php_sockop_flush,
|
||||
"generic_socket",
|
||||
@@ -495,7 +495,7 @@ php_stream_ops php_stream_generic_socket_ops = {
|
||||
};
|
||||
|
||||
|
||||
php_stream_ops php_stream_socket_ops = {
|
||||
const php_stream_ops php_stream_socket_ops = {
|
||||
php_sockop_write, php_sockop_read,
|
||||
php_sockop_close, php_sockop_flush,
|
||||
"tcp_socket",
|
||||
@@ -505,7 +505,7 @@ php_stream_ops php_stream_socket_ops = {
|
||||
php_tcp_sockop_set_option,
|
||||
};
|
||||
|
||||
php_stream_ops php_stream_udp_socket_ops = {
|
||||
const php_stream_ops php_stream_udp_socket_ops = {
|
||||
php_sockop_write, php_sockop_read,
|
||||
php_sockop_close, php_sockop_flush,
|
||||
"udp_socket",
|
||||
@@ -516,7 +516,7 @@ php_stream_ops php_stream_udp_socket_ops = {
|
||||
};
|
||||
|
||||
#ifdef AF_UNIX
|
||||
php_stream_ops php_stream_unix_socket_ops = {
|
||||
const php_stream_ops php_stream_unix_socket_ops = {
|
||||
php_sockop_write, php_sockop_read,
|
||||
php_sockop_close, php_sockop_flush,
|
||||
"unix_socket",
|
||||
@@ -525,7 +525,7 @@ php_stream_ops php_stream_unix_socket_ops = {
|
||||
php_sockop_stat,
|
||||
php_tcp_sockop_set_option,
|
||||
};
|
||||
php_stream_ops php_stream_unixdg_socket_ops = {
|
||||
const php_stream_ops php_stream_unixdg_socket_ops = {
|
||||
php_sockop_write, php_sockop_read,
|
||||
php_sockop_close, php_sockop_flush,
|
||||
"udg_socket",
|
||||
@@ -883,7 +883,7 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p
|
||||
{
|
||||
php_stream *stream = NULL;
|
||||
php_netstream_data_t *sock;
|
||||
php_stream_ops *ops;
|
||||
const php_stream_ops *ops;
|
||||
|
||||
/* which type of socket ? */
|
||||
if (strncmp(proto, "tcp", protolen) == 0) {
|
||||
|
||||
@@ -1356,7 +1356,7 @@ php_stream *phpdbg_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *
|
||||
return stream;
|
||||
}
|
||||
|
||||
return PHPDBG_G(orig_url_wrap_php)(wrapper, path, mode, options, opened_path, context STREAMS_CC);
|
||||
return PHPDBG_G(orig_url_wrap_php)->stream_opener(wrapper, path, mode, options, opened_path, context STREAMS_CC);
|
||||
} /* }}} */
|
||||
|
||||
int main(int argc, char **argv) /* {{{ */
|
||||
@@ -1399,6 +1399,7 @@ int main(int argc, char **argv) /* {{{ */
|
||||
void* (*_malloc)(size_t);
|
||||
void (*_free)(void*);
|
||||
void* (*_realloc)(void*, size_t);
|
||||
php_stream_wrapper_ops wops;
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
@@ -1868,8 +1869,10 @@ phpdbg_main:
|
||||
|
||||
{
|
||||
php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
|
||||
PHPDBG_G(orig_url_wrap_php) = wrapper->wops->stream_opener;
|
||||
wrapper->wops->stream_opener = phpdbg_stream_url_wrap_php;
|
||||
PHPDBG_G(orig_url_wrap_php) = wrapper->wops;
|
||||
memcpy(&wops, wrapper->wops, sizeof(wops));
|
||||
wops.stream_opener = phpdbg_stream_url_wrap_php;
|
||||
wrapper->wops = &wops;
|
||||
}
|
||||
|
||||
/* Make stdin, stdout and stderr accessible from PHP scripts */
|
||||
@@ -2149,7 +2152,7 @@ phpdbg_out:
|
||||
|
||||
{
|
||||
php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
|
||||
wrapper->wops->stream_opener = PHPDBG_G(orig_url_wrap_php);
|
||||
wrapper->wops = PHPDBG_G(orig_url_wrap_php);
|
||||
}
|
||||
|
||||
zend_hash_destroy(&PHPDBG_G(file_sources));
|
||||
|
||||
@@ -308,7 +308,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
||||
zend_bool last_was_newline; /* check if we don't need to output a newline upon next phpdbg_error or phpdbg_notice */
|
||||
|
||||
FILE *stdin_file; /* FILE pointer to stdin source file */
|
||||
php_stream *(*orig_url_wrap_php)(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
|
||||
const php_stream_wrapper_ops *orig_url_wrap_php;
|
||||
|
||||
char input_buffer[PHPDBG_MAX_CMD]; /* stdin input buffer */
|
||||
int input_buflen; /* length of stdin input buffer */
|
||||
|
||||
Reference in New Issue
Block a user