version 1.1.1.4, 2013/10/14 08:02:43
|
version 1.1.1.5, 2014/06/15 20:04:01
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2013 The PHP Group | | | Copyright (c) 1997-2014 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 736 PHPAPI size_t _php_stream_read(php_stream *stream, cha
|
Line 736 PHPAPI size_t _php_stream_read(php_stream *stream, cha
|
|
|
if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) { |
if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) { |
toread = stream->ops->read(stream, buf, size TSRMLS_CC); |
toread = stream->ops->read(stream, buf, size TSRMLS_CC); |
|
if (toread == (size_t) -1) { |
|
/* e.g. underlying read(2) returned -1 */ |
|
break; |
|
} |
} else { |
} else { |
php_stream_fill_read_buffer(stream, size TSRMLS_CC); |
php_stream_fill_read_buffer(stream, size TSRMLS_CC); |
|
|
Line 1401 PHPAPI size_t _php_stream_passthru(php_stream * stream
|
Line 1405 PHPAPI size_t _php_stream_passthru(php_stream * stream
|
p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); |
p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); |
|
|
if (p) { |
if (p) { |
PHPWRITE(p, mapped); | do { |
| /* output functions return int, so pass in int max */ |
| if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) { |
| bcount += b; |
| } |
| } while (b > 0 && mapped > bcount); |
|
|
php_stream_mmap_unmap_ex(stream, mapped); |
php_stream_mmap_unmap_ex(stream, mapped); |
|
|
return mapped; | return bcount; |
} |
} |
} |
} |
|
|
Line 1920 PHPAPI int _php_stream_stat_path(char *path, int flags
|
Line 1929 PHPAPI int _php_stream_stat_path(char *path, int flags
|
char *path_to_open = path; |
char *path_to_open = path; |
int ret; |
int ret; |
|
|
/* Try to hit the cache first */ | if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { |
if (flags & PHP_STREAM_URL_STAT_LINK) { | /* Try to hit the cache first */ |
if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { | if (flags & PHP_STREAM_URL_STAT_LINK) { |
memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); | if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { |
return 0; | memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); |
| return 0; |
| } |
| } else { |
| if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { |
| memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); |
| return 0; |
| } |
} |
} |
} else { |
|
if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { |
|
memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); |
|
return 0; |
|
} |
|
} |
} |
|
|
wrapper = php_stream_locate_url_wrapper(path, &path_to_open, 0 TSRMLS_CC); |
wrapper = php_stream_locate_url_wrapper(path, &path_to_open, 0 TSRMLS_CC); |
if (wrapper && wrapper->wops->url_stat) { |
if (wrapper && wrapper->wops->url_stat) { |
ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); |
ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); |
if (ret == 0) { |
if (ret == 0) { |
/* Drop into cache */ | if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { |
if (flags & PHP_STREAM_URL_STAT_LINK) { | /* Drop into cache */ |
if (BG(CurrentLStatFile)) { | if (flags & PHP_STREAM_URL_STAT_LINK) { |
efree(BG(CurrentLStatFile)); | if (BG(CurrentLStatFile)) { |
| efree(BG(CurrentLStatFile)); |
| } |
| BG(CurrentLStatFile) = estrdup(path); |
| memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); |
| } else { |
| if (BG(CurrentStatFile)) { |
| efree(BG(CurrentStatFile)); |
| } |
| BG(CurrentStatFile) = estrdup(path); |
| memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); |
} |
} |
BG(CurrentLStatFile) = estrdup(path); |
|
memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); |
|
} else { |
|
if (BG(CurrentStatFile)) { |
|
efree(BG(CurrentStatFile)); |
|
} |
|
BG(CurrentStatFile) = estrdup(path); |
|
memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); |
|
} |
} |
} |
} |
return ret; |
return ret; |