Fix the build and all of the outstanding VC++ warnings

This commit is contained in:
Zeev Suraski 2002-03-18 08:05:28 +00:00
parent 3de2e94c84
commit 73e79322ba
6 changed files with 40 additions and 31 deletions

View file

@ -1005,14 +1005,14 @@ PHP_MINIT_FUNCTION(basic)
if (PG(allow_url_fopen)) { if (PG(allow_url_fopen)) {
if (FAILURE == php_register_url_stream_wrapper("http", &php_stream_http_wrapper)) if (FAILURE == php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC))
return FAILURE; return FAILURE;
if (FAILURE == php_register_url_stream_wrapper("php", &php_stream_php_wrapper)) if (FAILURE == php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC))
return FAILURE; return FAILURE;
if (FAILURE == php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper)) if (FAILURE == php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper TSRMLS_CC))
return FAILURE; return FAILURE;
# if HAVE_OPENSSL_EXT # if HAVE_OPENSSL_EXT
if (FAILURE == php_register_url_stream_wrapper("https", &php_stream_http_wrapper)) if (FAILURE == php_register_url_stream_wrapper("https", &php_stream_http_wrapper TSRMLS_CC))
return FAILURE; return FAILURE;
# endif # endif
} }
@ -1030,11 +1030,11 @@ PHP_MSHUTDOWN_FUNCTION(basic)
#endif #endif
if (PG(allow_url_fopen)) { if (PG(allow_url_fopen)) {
php_unregister_url_stream_wrapper("http"); php_unregister_url_stream_wrapper("http" TSRMLS_CC);
php_unregister_url_stream_wrapper("ftp"); php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
php_unregister_url_stream_wrapper("php"); php_unregister_url_stream_wrapper("php" TSRMLS_CC);
# if HAVE_OPENSSL_EXT # if HAVE_OPENSSL_EXT
php_unregister_url_stream_wrapper("https"); php_unregister_url_stream_wrapper("https" TSRMLS_CC);
# endif # endif
} }

View file

@ -238,10 +238,14 @@ PHP_FUNCTION(get_meta_tags)
return; return;
} }
php_stream_open_wrapper(filename, "rb", 0, NULL);
md.stream = php_stream_open_wrapper(filename, "rb", md.stream = php_stream_open_wrapper(filename, "rb",
use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (!md.stream) { if (!md.stream) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -385,7 +389,7 @@ PHP_FUNCTION(file_get_contents)
stream = php_stream_open_wrapper(filename, "rb", stream = php_stream_open_wrapper(filename, "rb",
use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -432,7 +436,7 @@ PHP_FUNCTION(file)
stream = php_stream_open_wrapper(filename, "rb", stream = php_stream_open_wrapper(filename, "rb",
use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -583,7 +587,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2), stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2),
use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1400,7 +1404,7 @@ PHP_FUNCTION(readfile)
stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb",
use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (stream) { if (stream) {
size = php_passthru_stream(stream TSRMLS_CC); size = php_passthru_stream(stream TSRMLS_CC);
php_stream_close(stream); php_stream_close(stream);
@ -1694,11 +1698,11 @@ PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
srcstream = php_stream_open_wrapper(src, "rb", srcstream = php_stream_open_wrapper(src, "rb",
ENFORCE_SAFE_MODE | REPORT_ERRORS, ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
deststream = php_stream_open_wrapper(dest, "wb", deststream = php_stream_open_wrapper(dest, "wb",
ENFORCE_SAFE_MODE | REPORT_ERRORS, ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL TSRMLS_CC); NULL);
if (srcstream && deststream) if (srcstream && deststream)
ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS; ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS;

View file

@ -188,7 +188,7 @@ PHP_MINIT_FUNCTION(zlib)
le_zp = zend_register_list_destructors_ex(phpi_destructor_gzclose, NULL, "zlib", module_number); le_zp = zend_register_list_destructors_ex(phpi_destructor_gzclose, NULL, "zlib", module_number);
if(PG(allow_url_fopen)) { if(PG(allow_url_fopen)) {
php_register_url_stream_wrapper("zlib", &php_stream_gzip_wrapper); php_register_url_stream_wrapper("zlib", &php_stream_gzip_wrapper TSRMLS_CC);
} }
REGISTER_LONG_CONSTANT("FORCE_GZIP", CODING_GZIP, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FORCE_GZIP", CODING_GZIP, CONST_CS | CONST_PERSISTENT);

View file

@ -565,6 +565,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
{ {
FILE *retval = NULL; FILE *retval = NULL;
php_stream *stream; php_stream *stream;
TSRMLS_FETCH();
stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS, opened_path); stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS, opened_path);
if (stream) { if (stream) {
@ -951,7 +952,7 @@ int php_module_startup(sapi_module_struct *sf)
/* initialize stream wrappers registry /* initialize stream wrappers registry
* (this uses configuration parameters from php.ini) * (this uses configuration parameters from php.ini)
*/ */
if (php_init_stream_wrappers() == FAILURE) { if (php_init_stream_wrappers(TSRMLS_C) == FAILURE) {
php_printf("PHP: Unable to initialize stream url wrappers.\n"); php_printf("PHP: Unable to initialize stream url wrappers.\n");
return FAILURE; return FAILURE;
} }
@ -1056,7 +1057,7 @@ void php_module_shutdown(TSRMLS_D)
zend_shutdown(TSRMLS_C); zend_shutdown(TSRMLS_C);
php_shutdown_stream_wrappers(); php_shutdown_stream_wrappers(TSRMLS_C);
php_shutdown_info_logos(); php_shutdown_info_logos();
UNREGISTER_INI_ENTRIES(); UNREGISTER_INI_ENTRIES();

View file

@ -227,10 +227,10 @@ PHPAPI int php_stream_cast(php_stream *stream, int castas, void **ret, int show_
# define IGNORE_URL_WIN 0 # define IGNORE_URL_WIN 0
#endif #endif
int php_init_stream_wrappers(void); int php_init_stream_wrappers(TSRMLS_D);
int php_shutdown_stream_wrappers(void); int php_shutdown_stream_wrappers(TSRMLS_D);
PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper); PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC);
PHPAPI int php_unregister_url_stream_wrapper(char *protocol); PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC);
PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC); PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC);
#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper((path), (mode), (options), (opened) STREAMS_CC) #define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper((path), (mode), (options), (opened) STREAMS_CC)

View file

@ -881,30 +881,35 @@ exit_success:
} /* }}} */ } /* }}} */
int php_init_stream_wrappers(void) int php_init_stream_wrappers(TSRMLS_D)
{ {
if (PG(allow_url_fopen)) if (PG(allow_url_fopen)) {
return zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1); return zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1);
}
return SUCCESS; return SUCCESS;
} }
int php_shutdown_stream_wrappers(void) int php_shutdown_stream_wrappers(TSRMLS_D)
{ {
if (PG(allow_url_fopen)) if (PG(allow_url_fopen)) {
zend_hash_destroy(&url_stream_wrappers_hash); zend_hash_destroy(&url_stream_wrappers_hash);
}
return SUCCESS; return SUCCESS;
} }
PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper) PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC)
{ {
if (PG(allow_url_fopen)) if (PG(allow_url_fopen)) {
return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL); return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL);
}
return FAILURE; return FAILURE;
} }
PHPAPI int php_unregister_url_stream_wrapper(char *protocol)
PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
{ {
if (PG(allow_url_fopen)) if (PG(allow_url_fopen)) {
return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol)); return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol));
}
return SUCCESS; return SUCCESS;
} }
@ -953,7 +958,6 @@ static php_stream *php_stream_open_url(char *path, char *mode, int options, char
PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC) PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC)
{ {
php_stream *stream = NULL; php_stream *stream = NULL;
TSRMLS_FETCH();
if (opened_path) if (opened_path)
*opened_path = NULL; *opened_path = NULL;