@@ -389,20 +389,16 @@ PHP_LIBXML_API php_stream_context *php_libxml_get_stream_context(void)
389
389
static void * php_libxml_streams_IO_open_wrapper (const char * filename , const char * mode , const int read_only )
390
390
{
391
391
php_stream_statbuf ssbuf ;
392
- php_stream_context * context = NULL ;
393
- php_stream_wrapper * wrapper = NULL ;
394
392
char * resolved_path ;
395
393
const char * path_to_open = NULL ;
396
- void * ret_val = NULL ;
397
- int isescaped = 0 ;
398
- xmlURI * uri ;
394
+ bool isescaped = false;
399
395
400
396
if (strstr (filename , "%00" )) {
401
397
php_error_docref (NULL , E_WARNING , "URI must not contain percent-encoded NUL bytes" );
402
398
return NULL ;
403
399
}
404
400
405
- uri = xmlParseURI (filename );
401
+ xmlURI * uri = xmlParseURI (filename );
406
402
if (uri && (uri -> scheme == NULL ||
407
403
(xmlStrncmp (BAD_CAST uri -> scheme , BAD_CAST "file" , 4 ) == 0 ))) {
408
404
resolved_path = xmlURIUnescapeString (filename , 0 , NULL );
@@ -440,7 +436,7 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
440
436
that the streams layer puts out at times, but for libxml we
441
437
may try to open files that don't exist, but it is not a failure
442
438
in xml processing (eg. DTD files) */
443
- wrapper = php_stream_locate_url_wrapper (resolved_path , & path_to_open , 0 );
439
+ php_stream_wrapper * wrapper = php_stream_locate_url_wrapper (resolved_path , & path_to_open , 0 );
444
440
if (wrapper && read_only && wrapper -> wops -> url_stat ) {
445
441
if (wrapper -> wops -> url_stat (wrapper , path_to_open , PHP_STREAM_URL_STAT_QUIET , & ssbuf , NULL ) == -1 ) {
446
442
if (isescaped ) {
@@ -450,12 +446,12 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
450
446
}
451
447
}
452
448
453
- context = php_libxml_get_stream_context ();
449
+ php_stream_context * context = php_libxml_get_stream_context ();
454
450
455
- ret_val = php_stream_open_wrapper_ex (path_to_open , ( char * ) mode , REPORT_ERRORS , NULL , context );
451
+ php_stream * ret_val = php_stream_open_wrapper_ex (path_to_open , mode , REPORT_ERRORS , NULL , context );
456
452
if (ret_val ) {
457
453
/* Prevent from closing this by fclose() */
458
- (( php_stream * ) ret_val ) -> flags |= PHP_STREAM_FLAG_NO_FCLOSE ;
454
+ ret_val -> flags |= PHP_STREAM_FLAG_NO_FCLOSE ;
459
455
}
460
456
if (isescaped ) {
461
457
xmlFree (resolved_path );
0 commit comments