@@ -148,7 +148,7 @@ static zend_llist *php_get_wrapper_errors_list(php_stream_wrapper *wrapper)
148
148
}
149
149
150
150
/* {{{ wrapper error reporting */
151
- void php_stream_display_wrapper_errors (php_stream_wrapper * wrapper , const char * path , const char * caption )
151
+ static void php_stream_display_wrapper_errors (php_stream_wrapper * wrapper , const char * path , const char * caption )
152
152
{
153
153
char * tmp ;
154
154
char * msg ;
@@ -218,7 +218,7 @@ void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *
218
218
}
219
219
}
220
220
221
- void php_stream_tidy_wrapper_error_log (php_stream_wrapper * wrapper )
221
+ static void php_stream_tidy_wrapper_error_log (php_stream_wrapper * wrapper )
222
222
{
223
223
if (wrapper && FG (wrapper_errors )) {
224
224
zend_hash_str_del (FG (wrapper_errors ), (const char * )& wrapper , sizeof (wrapper ));
@@ -535,7 +535,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
535
535
536
536
/* {{{ generic stream operations */
537
537
538
- PHPAPI int _php_stream_fill_read_buffer (php_stream * stream , size_t size )
538
+ PHPAPI zend_result _php_stream_fill_read_buffer (php_stream * stream , size_t size )
539
539
{
540
540
/* allocate/fill the buffer */
541
541
@@ -776,7 +776,7 @@ PHPAPI zend_string *php_stream_read_to_str(php_stream *stream, size_t len)
776
776
return str ;
777
777
}
778
778
779
- PHPAPI int _php_stream_eof (php_stream * stream )
779
+ PHPAPI bool _php_stream_eof (php_stream * stream )
780
780
{
781
781
/* if there is data in the buffer, it's not EOF */
782
782
if (stream -> writepos - stream -> readpos > 0 ) {
@@ -813,7 +813,7 @@ PHPAPI int _php_stream_getc(php_stream *stream)
813
813
return EOF ;
814
814
}
815
815
816
- PHPAPI int _php_stream_puts (php_stream * stream , const char * buf )
816
+ PHPAPI bool _php_stream_puts (php_stream * stream , const char * buf )
817
817
{
818
818
size_t len ;
819
819
char newline [2 ] = "\n" ; /* is this OK for Win? */
@@ -1034,7 +1034,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con
1034
1034
const char * found_delim = NULL ;
1035
1035
size_t buffered_len ,
1036
1036
tent_ret_len ; /* tentative returned length */
1037
- int has_delim = delim_len > 0 ;
1037
+ bool has_delim = delim_len > 0 ;
1038
1038
1039
1039
if (maxlen == 0 ) {
1040
1040
return NULL ;
@@ -1537,7 +1537,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int
1537
1537
}
1538
1538
1539
1539
/* Returns SUCCESS/FAILURE and sets *len to the number of bytes moved */
1540
- PHPAPI int _php_stream_copy_to_stream_ex (php_stream * src , php_stream * dest , size_t maxlen , size_t * len STREAMS_DC )
1540
+ PHPAPI zend_result _php_stream_copy_to_stream_ex (php_stream * src , php_stream * dest , size_t maxlen , size_t * len STREAMS_DC )
1541
1541
{
1542
1542
char buf [CHUNK_SIZE ];
1543
1543
size_t haveread = 0 ;
@@ -1649,7 +1649,7 @@ ZEND_ATTRIBUTE_DEPRECATED
1649
1649
PHPAPI size_t _php_stream_copy_to_stream (php_stream * src , php_stream * dest , size_t maxlen STREAMS_DC )
1650
1650
{
1651
1651
size_t len ;
1652
- int ret = _php_stream_copy_to_stream_ex (src , dest , maxlen , & len STREAMS_REL_CC );
1652
+ zend_result ret = _php_stream_copy_to_stream_ex (src , dest , maxlen , & len STREAMS_REL_CC );
1653
1653
if (ret == SUCCESS && len == 0 && maxlen != 0 ) {
1654
1654
return 1 ;
1655
1655
}
@@ -1717,18 +1717,17 @@ int php_init_stream_wrappers(int module_number)
1717
1717
) ? SUCCESS : FAILURE ;
1718
1718
}
1719
1719
1720
- int php_shutdown_stream_wrappers (int module_number )
1720
+ void php_shutdown_stream_wrappers (int module_number )
1721
1721
{
1722
1722
zend_hash_destroy (& url_stream_wrappers_hash );
1723
1723
zend_hash_destroy (php_get_stream_filters_hash_global ());
1724
1724
zend_hash_destroy (php_stream_xport_get_hash ());
1725
- return SUCCESS ;
1726
1725
}
1727
1726
1728
1727
/* Validate protocol scheme names during registration
1729
1728
* Must conform to /^[a-zA-Z0-9+.-]+$/
1730
1729
*/
1731
- static inline int php_stream_wrapper_scheme_validate (const char * protocol , unsigned int protocol_len )
1730
+ static inline zend_result php_stream_wrapper_scheme_validate (const char * protocol , unsigned int protocol_len )
1732
1731
{
1733
1732
unsigned int i ;
1734
1733
@@ -1745,10 +1744,10 @@ static inline int php_stream_wrapper_scheme_validate(const char *protocol, unsig
1745
1744
}
1746
1745
1747
1746
/* API for registering GLOBAL wrappers */
1748
- PHPAPI int php_register_url_stream_wrapper (const char * protocol , const php_stream_wrapper * wrapper )
1747
+ PHPAPI zend_result php_register_url_stream_wrapper (const char * protocol , const php_stream_wrapper * wrapper )
1749
1748
{
1750
- unsigned int protocol_len = ( unsigned int ) strlen (protocol );
1751
- int ret ;
1749
+ size_t protocol_len = strlen (protocol );
1750
+ zend_result ret ;
1752
1751
zend_string * str ;
1753
1752
1754
1753
if (php_stream_wrapper_scheme_validate (protocol , protocol_len ) == FAILURE ) {
@@ -1761,7 +1760,7 @@ PHPAPI int php_register_url_stream_wrapper(const char *protocol, const php_strea
1761
1760
return ret ;
1762
1761
}
1763
1762
1764
- PHPAPI int php_unregister_url_stream_wrapper (const char * protocol )
1763
+ PHPAPI zend_result php_unregister_url_stream_wrapper (const char * protocol )
1765
1764
{
1766
1765
return zend_hash_str_del (& url_stream_wrappers_hash , protocol , strlen (protocol ));
1767
1766
}
@@ -1774,7 +1773,7 @@ static void clone_wrapper_hash(void)
1774
1773
}
1775
1774
1776
1775
/* API for registering VOLATILE wrappers */
1777
- PHPAPI int php_register_url_stream_wrapper_volatile (zend_string * protocol , php_stream_wrapper * wrapper )
1776
+ PHPAPI zend_result php_register_url_stream_wrapper_volatile (zend_string * protocol , php_stream_wrapper * wrapper )
1778
1777
{
1779
1778
if (php_stream_wrapper_scheme_validate (ZSTR_VAL (protocol ), ZSTR_LEN (protocol )) == FAILURE ) {
1780
1779
return FAILURE ;
@@ -1787,7 +1786,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(zend_string *protocol, php_s
1787
1786
return zend_hash_add_ptr (FG (stream_wrappers ), protocol , wrapper ) ? SUCCESS : FAILURE ;
1788
1787
}
1789
1788
1790
- PHPAPI int php_unregister_url_stream_wrapper_volatile (zend_string * protocol )
1789
+ PHPAPI zend_result php_unregister_url_stream_wrapper_volatile (zend_string * protocol )
1791
1790
{
1792
1791
if (!FG (stream_wrappers )) {
1793
1792
clone_wrapper_hash ();
@@ -2250,7 +2249,7 @@ PHPAPI zval *php_stream_context_get_option(php_stream_context *context,
2250
2249
return zend_hash_str_find (Z_ARRVAL_P (wrapperhash ), optionname , strlen (optionname ));
2251
2250
}
2252
2251
2253
- PHPAPI int php_stream_context_set_option (php_stream_context * context ,
2252
+ PHPAPI void php_stream_context_set_option (php_stream_context * context ,
2254
2253
const char * wrappername , const char * optionname , zval * optionvalue )
2255
2254
{
2256
2255
zval * wrapperhash ;
@@ -2266,7 +2265,6 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
2266
2265
Z_TRY_ADDREF_P (optionvalue );
2267
2266
SEPARATE_ARRAY (wrapperhash );
2268
2267
zend_hash_str_update (Z_ARRVAL_P (wrapperhash ), optionname , strlen (optionname ), optionvalue );
2269
- return SUCCESS ;
2270
2268
}
2271
2269
/* }}} */
2272
2270
@@ -2295,12 +2293,12 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in
2295
2293
unsigned int nfiles = 0 ;
2296
2294
2297
2295
if (!namelist ) {
2298
- return FAILURE ;
2296
+ return -1 ;
2299
2297
}
2300
2298
2301
2299
stream = php_stream_opendir (dirname , REPORT_ERRORS , context );
2302
2300
if (!stream ) {
2303
- return FAILURE ;
2301
+ return -1 ;
2304
2302
}
2305
2303
2306
2304
while (php_stream_readdir (stream , & sdp )) {
@@ -2312,7 +2310,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in
2312
2310
/* overflow */
2313
2311
php_stream_closedir (stream );
2314
2312
efree (vector );
2315
- return FAILURE ;
2313
+ return -1 ;
2316
2314
}
2317
2315
vector_size *= 2 ;
2318
2316
}
@@ -2326,7 +2324,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in
2326
2324
/* overflow */
2327
2325
php_stream_closedir (stream );
2328
2326
efree (vector );
2329
- return FAILURE ;
2327
+ return -1 ;
2330
2328
}
2331
2329
}
2332
2330
php_stream_closedir (stream );
0 commit comments