@@ -48,29 +48,29 @@ static HashTable php_output_handler_reverse_conflicts;
4848/* }}} */
4949
5050/* {{{ forward declarations */
51- static inline int php_output_lock_error (int op );
51+ static inline bool php_output_lock_error (int op );
5252static inline void php_output_op (int op , const char * str , size_t len );
5353
5454static inline php_output_handler * php_output_handler_init (zend_string * name , size_t chunk_size , int flags );
5555static inline php_output_handler_status_t php_output_handler_op (php_output_handler * handler , php_output_context * context );
56- static inline int php_output_handler_append (php_output_handler * handler , const php_output_buffer * buf );
56+ static inline bool php_output_handler_append (php_output_handler * handler , const php_output_buffer * buf );
5757static inline zval * php_output_handler_status (php_output_handler * handler , zval * entry );
5858
5959static inline void php_output_context_init (php_output_context * context , int op );
6060static inline void php_output_context_reset (php_output_context * context );
6161static inline void php_output_context_swap (php_output_context * context );
6262static inline void php_output_context_dtor (php_output_context * context );
6363
64- static int php_output_stack_pop (int flags );
64+ static zend_result php_output_stack_pop (int flags );
6565
6666static int php_output_stack_apply_op (void * h , void * c );
6767static int php_output_stack_apply_clean (void * h , void * c );
6868static int php_output_stack_apply_list (void * h , void * z );
6969static int php_output_stack_apply_status (void * h , void * z );
7070
71- static int php_output_handler_compat_func (void * * handler_context , php_output_context * output_context );
72- static int php_output_handler_default_func (void * * handler_context , php_output_context * output_context );
73- static int php_output_handler_devnull_func (void * * handler_context , php_output_context * output_context );
71+ static zend_result php_output_handler_compat_func (void * * handler_context , php_output_context * output_context );
72+ static zend_result php_output_handler_default_func (void * * handler_context , php_output_context * output_context );
73+ static zend_result php_output_handler_devnull_func (void * * handler_context , php_output_context * output_context );
7474/* }}} */
7575
7676/* {{{ static void php_output_init_globals(zend_output_globals *G)
@@ -250,7 +250,7 @@ PHPAPI size_t php_output_write(const char *str, size_t len)
250250
251251/* {{{ SUCCESS|FAILURE php_output_flush(void)
252252 * Flush the most recent output handlers buffer */
253- PHPAPI int php_output_flush (void )
253+ PHPAPI zend_result php_output_flush (void )
254254{
255255 php_output_context context ;
256256
@@ -281,7 +281,7 @@ PHPAPI void php_output_flush_all(void)
281281
282282/* {{{ SUCCESS|FAILURE php_output_clean(void)
283283 * Cleans the most recent output handlers buffer if the handler is cleanable */
284- PHPAPI int php_output_clean (void )
284+ PHPAPI zend_result php_output_clean (void )
285285{
286286 php_output_context context ;
287287
@@ -309,7 +309,7 @@ PHPAPI void php_output_clean_all(void)
309309
310310/* {{{ SUCCESS|FAILURE php_output_end(void)
311311 * Finalizes the most recent output handler at pops it off the stack if the handler is removable */
312- PHPAPI int php_output_end (void )
312+ PHPAPI zend_result php_output_end (void )
313313{
314314 if (php_output_stack_pop (PHP_OUTPUT_POP_TRY )) {
315315 return SUCCESS ;
@@ -328,7 +328,7 @@ PHPAPI void php_output_end_all(void)
328328
329329/* {{{ SUCCESS|FAILURE php_output_discard(void)
330330 * Discards the most recent output handlers buffer and pops it off the stack if the handler is removable */
331- PHPAPI int php_output_discard (void )
331+ PHPAPI zend_result php_output_discard (void )
332332{
333333 if (php_output_stack_pop (PHP_OUTPUT_POP_DISCARD |PHP_OUTPUT_POP_TRY )) {
334334 return SUCCESS ;
@@ -357,7 +357,7 @@ PHPAPI int php_output_get_level(void)
357357
358358/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z)
359359 * Get the contents of the active output handlers buffer */
360- PHPAPI int php_output_get_contents (zval * p )
360+ PHPAPI zend_result php_output_get_contents (zval * p )
361361{
362362 if (OG (active )) {
363363 ZVAL_STRINGL (p , OG (active )-> buffer .data , OG (active )-> buffer .used );
@@ -370,7 +370,7 @@ PHPAPI int php_output_get_contents(zval *p)
370370
371371/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z)
372372 * Get the length of the active output handlers buffer */
373- PHPAPI int php_output_get_length (zval * p )
373+ PHPAPI zend_result php_output_get_length (zval * p )
374374{
375375 if (OG (active )) {
376376 ZVAL_LONG (p , OG (active )-> buffer .used );
@@ -392,7 +392,7 @@ PHPAPI php_output_handler* php_output_get_active_handler(void)
392392
393393/* {{{ SUCCESS|FAILURE php_output_handler_start_default(void)
394394 * Start a "default output handler" */
395- PHPAPI int php_output_start_default (void )
395+ PHPAPI zend_result php_output_start_default (void )
396396{
397397 php_output_handler * handler ;
398398
@@ -407,7 +407,7 @@ PHPAPI int php_output_start_default(void)
407407
408408/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull(void)
409409 * Start a "null output handler" */
410- PHPAPI int php_output_start_devnull (void )
410+ PHPAPI zend_result php_output_start_devnull (void )
411411{
412412 php_output_handler * handler ;
413413
@@ -422,7 +422,7 @@ PHPAPI int php_output_start_devnull(void)
422422
423423/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags)
424424 * Start a user level output handler */
425- PHPAPI int php_output_start_user (zval * output_handler , size_t chunk_size , int flags )
425+ PHPAPI zend_result php_output_start_user (zval * output_handler , size_t chunk_size , int flags )
426426{
427427 php_output_handler * handler ;
428428
@@ -441,7 +441,7 @@ PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int fl
441441
442442/* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags)
443443 * Start an internal output handler that does not have to maintain a non-global state */
444- PHPAPI int php_output_start_internal (const char * name , size_t name_len , php_output_handler_func_t output_handler , size_t chunk_size , int flags )
444+ PHPAPI zend_result php_output_start_internal (const char * name , size_t name_len , php_output_handler_func_t output_handler , size_t chunk_size , int flags )
445445{
446446 php_output_handler * handler ;
447447
@@ -526,7 +526,7 @@ PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *op
526526
527527/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler)
528528 * Starts the set up output handler and pushes it on top of the stack. Checks for any conflicts regarding the output handler to start */
529- PHPAPI int php_output_handler_start (php_output_handler * handler )
529+ PHPAPI zend_result php_output_handler_start (php_output_handler * handler )
530530{
531531 HashTable * rconflicts ;
532532 php_output_handler_conflict_check_t conflict ;
@@ -553,9 +553,9 @@ PHPAPI int php_output_handler_start(php_output_handler *handler)
553553}
554554/* }}} */
555555
556- /* {{{ int php_output_handler_started(zval *name)
556+ /* {{{ bool php_output_handler_started(zval *name)
557557 * Check whether a certain output handler is in use */
558- PHPAPI int php_output_handler_started (const char * name , size_t name_len )
558+ PHPAPI bool php_output_handler_started (const char * name , size_t name_len )
559559{
560560 php_output_handler * * handlers ;
561561 int i , count = php_output_get_level ();
@@ -565,34 +565,34 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len)
565565
566566 for (i = 0 ; i < count ; ++ i ) {
567567 if (zend_string_equals_cstr (handlers [i ]-> name , name , name_len )) {
568- return 1 ;
568+ return true ;
569569 }
570570 }
571571 }
572572
573- return 0 ;
573+ return false ;
574574}
575575/* }}} */
576576
577- /* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old)
577+ /* {{{ bool php_output_handler_conflict(zval *handler_new, zval *handler_old)
578578 * Check whether a certain handler is in use and issue a warning that the new handler would conflict with the already used one */
579- PHPAPI int php_output_handler_conflict (const char * handler_new , size_t handler_new_len , const char * handler_set , size_t handler_set_len )
579+ PHPAPI bool php_output_handler_conflict (const char * handler_new , size_t handler_new_len , const char * handler_set , size_t handler_set_len )
580580{
581581 if (php_output_handler_started (handler_set , handler_set_len )) {
582582 if (handler_new_len != handler_set_len || memcmp (handler_new , handler_set , handler_set_len )) {
583583 php_error_docref ("ref.outcontrol" , E_WARNING , "Output handler '%s' conflicts with '%s'" , handler_new , handler_set );
584584 } else {
585585 php_error_docref ("ref.outcontrol" , E_WARNING , "Output handler '%s' cannot be used twice" , handler_new );
586586 }
587- return 1 ;
587+ return true ;
588588 }
589- return 0 ;
589+ return false ;
590590}
591591/* }}} */
592592
593593/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func)
594594 * Register a conflict checking function on MINIT */
595- PHPAPI int php_output_handler_conflict_register (const char * name , size_t name_len , php_output_handler_conflict_check_t check_func )
595+ PHPAPI zend_result php_output_handler_conflict_register (const char * name , size_t name_len , php_output_handler_conflict_check_t check_func )
596596{
597597 zend_string * str ;
598598
@@ -609,7 +609,7 @@ PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_le
609609
610610/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func)
611611 * Register a reverse conflict checking function on MINIT */
612- PHPAPI int php_output_handler_reverse_conflict_register (const char * name , size_t name_len , php_output_handler_conflict_check_t check_func )
612+ PHPAPI zend_result php_output_handler_reverse_conflict_register (const char * name , size_t name_len , php_output_handler_conflict_check_t check_func )
613613{
614614 HashTable rev , * rev_ptr = NULL ;
615615
@@ -646,7 +646,7 @@ PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *name
646646
647647/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func)
648648 * Registers an internal output handler as alias for a user handler */
649- PHPAPI int php_output_handler_alias_register (const char * name , size_t name_len , php_output_handler_alias_ctor_t func )
649+ PHPAPI zend_result php_output_handler_alias_register (const char * name , size_t name_len , php_output_handler_alias_ctor_t func )
650650{
651651 zend_string * str ;
652652
@@ -663,7 +663,7 @@ PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len,
663663
664664/* {{{ SUCCESS|FAILURE php_output_handler_hook(php_output_handler_hook_t type, void *arg)
665665 * Output handler hook for output handler functions to check/modify the current handlers abilities */
666- PHPAPI int php_output_handler_hook (php_output_handler_hook_t type , void * arg )
666+ PHPAPI zend_result php_output_handler_hook (php_output_handler_hook_t type , void * arg )
667667{
668668 if (OG (running )) {
669669 switch (type ) {
@@ -751,18 +751,18 @@ PHPAPI int php_output_get_start_lineno(void)
751751}
752752/* }}} */
753753
754- /* {{{ static int php_output_lock_error(int op)
754+ /* {{{ static bool php_output_lock_error(int op)
755755 * Checks whether an unallowed operation is attempted from within the output handler and issues a fatal error */
756- static inline int php_output_lock_error (int op )
756+ static inline bool php_output_lock_error (int op )
757757{
758758 /* if there's no ob active, ob has been stopped */
759759 if (op && OG (active ) && OG (running )) {
760760 /* fatal error */
761761 php_output_deactivate ();
762762 php_error_docref ("ref.outcontrol" , E_ERROR , "Cannot use output buffering in output buffering display handlers" );
763- return 1 ;
763+ return true ;
764764 }
765- return 0 ;
765+ return false ;
766766}
767767/* }}} */
768768
@@ -865,9 +865,9 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz
865865}
866866/* }}} */
867867
868- /* {{{ static int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf)
868+ /* {{{ static bool php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf)
869869 * Appends input to the output handlers buffer and indicates whether the buffer does not have to be processed by the output handler */
870- static inline int php_output_handler_append (php_output_handler * handler , const php_output_buffer * buf )
870+ static inline bool php_output_handler_append (php_output_handler * handler , const php_output_buffer * buf )
871871{
872872 if (buf -> used ) {
873873 OG (flags ) |= PHP_OUTPUT_WRITTEN ;
@@ -886,10 +886,10 @@ static inline int php_output_handler_append(php_output_handler *handler, const p
886886 /* chunked buffering */
887887 if (handler -> size && (handler -> buffer .used >= handler -> size )) {
888888 /* store away errors and/or any intermediate output */
889- return OG (running ) ? 1 : 0 ;
889+ return OG (running ) ? true : false ;
890890 }
891891 }
892- return 1 ;
892+ return true ;
893893}
894894/* }}} */
895895
@@ -1243,7 +1243,7 @@ static int php_output_stack_pop(int flags)
12431243
12441244/* {{{ static SUCCESS|FAILURE php_output_handler_compat_func(void *ctx, php_output_context *)
12451245 * php_output_handler_context_func_t for php_output_handler_func_t output handlers */
1246- static int php_output_handler_compat_func (void * * handler_context , php_output_context * output_context )
1246+ static zend_result php_output_handler_compat_func (void * * handler_context , php_output_context * output_context )
12471247{
12481248 php_output_handler_func_t func = * (php_output_handler_func_t * ) handler_context ;
12491249
@@ -1269,7 +1269,7 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con
12691269
12701270/* {{{ static SUCCESS|FAILURE php_output_handler_default_func(void *ctx, php_output_context *)
12711271 * Default output handler */
1272- static int php_output_handler_default_func (void * * handler_context , php_output_context * output_context )
1272+ static zend_result php_output_handler_default_func (void * * handler_context , php_output_context * output_context )
12731273{
12741274 php_output_context_pass (output_context );
12751275 return SUCCESS ;
@@ -1278,7 +1278,7 @@ static int php_output_handler_default_func(void **handler_context, php_output_co
12781278
12791279/* {{{ static SUCCESS|FAILURE php_output_handler_devnull_func(void *ctx, php_output_context *)
12801280 * Null output handler */
1281- static int php_output_handler_devnull_func (void * * handler_context , php_output_context * output_context )
1281+ static zend_result php_output_handler_devnull_func (void * * handler_context , php_output_context * output_context )
12821282{
12831283 return SUCCESS ;
12841284}
0 commit comments