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;
}
/* }}} */
-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",
/* }}} */
-static php_stream_wrapper_ops bzip2_stream_wops = {
+static const php_stream_wrapper_ops bzip2_stream_wops = {
_php_stream_bz2open,
NULL, /* close */
NULL, /* fstat */
}
}
-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"
}
}
-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"
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;
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
};
/* }}} */
#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 */
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,
{
zval months, smonths;
int i;
- struct cal_entry_t *calendar;
+ const struct cal_entry_t *calendar;
calendar = &cal_conversion_table[cal];
array_init(ret);
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) {
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;
{
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;
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) {
}
}
-char *DayNameShort[7] =
+const char * const DayNameShort[7] =
{
"Sun",
"Mon",
"Sat"
};
-char *DayNameLong[7] =
+const char * const DayNameLong[7] =
{
"Sunday",
"Monday",
+ FRENCH_SDN_OFFSET);
}
-char *FrenchMonthName[14] =
+const char * const FrenchMonthName[14] =
{
"",
"Vendemiaire",
- GREGOR_SDN_OFFSET);
}
-char *MonthNameShort[13] =
+const char * const MonthNameShort[13] =
{
"",
"Jan",
"Dec"
};
-char *MonthNameLong[13] =
+const char * const MonthNameLong[13] =
{
"",
"January",
#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",
};
/* names for regular year */
-char *JewishMonthName[14] =
+const char * const JewishMonthName[14] =
{
"",
"Tishri",
};
/* names for leap (13-month) year */
-char *JewishMonthHebNameLeap[14] =
+const char * const JewishMonthHebNameLeap[14] =
{
"",
"úùøé",
};
/* names for regular year */
-char *JewishMonthHebName[14] =
+const char * const JewishMonthHebName[14] =
{
"",
"úùøé",
/* 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);
/* 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 */
/* {{{ 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"
};
/* }}} */
/* {{{ 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) {
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) {
/* }}} */
/* {{{ 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
/* }}} */
}
/* }}} */
-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.*"
/* {{{ 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
};
/* }}} */
/* {{{ 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 }
/* }}} */
/* {{{ 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 }
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)) {
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 {
}
/* }}} */
-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",
}
}
-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,
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,
};
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 */
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,
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 */
#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 */
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, */
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)
};
#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);
return FAILURE;
}
-ps_module ps_mod_mm = {
+const ps_module ps_mod_mm = {
PS_MOD_SID(mm)
};
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);
#include "php_session.h"
#include "mod_user.h"
-ps_module ps_mod_user = {
+const ps_module ps_mod_user = {
PS_MOD_UPDATE_TIMESTAMP(user)
};
#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);
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;
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),
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);
static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
{
- ps_module *tmp;
+ const ps_module *tmp;
SESSION_CHECK_ACTIVE_STATE;
SESSION_CHECK_OUTPUT_STATE;
#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;
}
/* }}} */
-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)
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;
}
/* }}} */
-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++) {
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};
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,
#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"
};
#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,
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"
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,
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"
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
};
/* }}} */
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"
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
};
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.*"
return retval;
}
-static php_stream_filter_factory strfilter_convert_factory = {
+static const php_stream_filter_factory strfilter_convert_factory = {
strfilter_convert_create
};
/* }}} */
}
}
-static php_stream_filter_ops consumed_filter_ops = {
+static const php_stream_filter_ops consumed_filter_ops = {
consumed_filter_filter,
consumed_filter_dtor,
"consumed"
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")) {
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
};
}
}
-static php_stream_filter_ops chunked_filter_ops = {
+static const php_stream_filter_ops chunked_filter_ops = {
php_chunked_filter,
php_chunked_dtor,
"dechunk"
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")) {
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 },
# 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
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;
/* 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 */
}
/* }}} */
-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,
}
/* }}} */
-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,
/* 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 */
}
/* }}} */
-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,
}
/* }}} */
-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,
}
/* }}} */
-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 */
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);
/* {{{ 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;
/* {{{ 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;
}
/* }}} */
-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 */
return ret;
}
-static php_stream_filter_ops userfilter_ops = {
+static const php_stream_filter_ops userfilter_ops = {
userfilter_filter,
userfilter_dtor,
"user-filter"
return filter;
}
-static php_stream_filter_factory user_filter_factory = {
+static const php_stream_filter_factory user_filter_factory = {
user_filter_factory_create
};
/* 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 },
/* }}} */
/* {{{ 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) {
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;
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) {
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) {
}
/* }}} */
-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",
}
/* }}} */
-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 */
#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
}
}
-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"
}
}
-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"
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;
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
};
/* }}} */
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",
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 */
}
-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) {
}
-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;
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;
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));
/* {{{ 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 }
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
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()
} 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 */
};
#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;
/* 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)
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
{
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];
}
/* 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;
}
}
/* 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));
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 */
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;
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;
}
/* }}} */
-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",
}
/* }}} */
-static php_stream_wrapper_ops php_glob_stream_wrapper_ops = {
+static const php_stream_wrapper_ops php_glob_stream_wrapper_ops = {
NULL,
NULL,
NULL,
}
/* }}} */
-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",
}
/* }}} */
-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",
}
/* }}} */
-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",
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 */
} 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;
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)
} 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()
/* $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()
/* 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
}
}
+/* 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,
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",
}
-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,
/* }}} */
/* 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;
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 */
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",
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,
# 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
* 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",
};
-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",
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",
};
#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",
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",
{
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) {
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) /* {{{ */
void* (*_malloc)(size_t);
void (*_free)(void*);
void* (*_realloc)(void*, size_t);
+ php_stream_wrapper_ops wops;
#ifndef _WIN32
{
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 */
{
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));
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 */