@@ -48,29 +48,29 @@ static HashTable php_output_handler_reverse_conflicts;
48
48
/* }}} */
49
49
50
50
/* {{{ forward declarations */
51
- static inline int php_output_lock_error (int op );
51
+ static inline bool php_output_lock_error (int op );
52
52
static inline void php_output_op (int op , const char * str , size_t len );
53
53
54
54
static inline php_output_handler * php_output_handler_init (zend_string * name , size_t chunk_size , int flags );
55
55
static 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 );
57
57
static inline zval * php_output_handler_status (php_output_handler * handler , zval * entry );
58
58
59
59
static inline void php_output_context_init (php_output_context * context , int op );
60
60
static inline void php_output_context_reset (php_output_context * context );
61
61
static inline void php_output_context_swap (php_output_context * context );
62
62
static inline void php_output_context_dtor (php_output_context * context );
63
63
64
- static int php_output_stack_pop (int flags );
64
+ static zend_result php_output_stack_pop (int flags );
65
65
66
66
static int php_output_stack_apply_op (void * h , void * c );
67
67
static int php_output_stack_apply_clean (void * h , void * c );
68
68
static int php_output_stack_apply_list (void * h , void * z );
69
69
static int php_output_stack_apply_status (void * h , void * z );
70
70
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 );
74
74
/* }}} */
75
75
76
76
/* {{{ 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)
250
250
251
251
/* {{{ SUCCESS|FAILURE php_output_flush(void)
252
252
* Flush the most recent output handlers buffer */
253
- PHPAPI int php_output_flush (void )
253
+ PHPAPI zend_result php_output_flush (void )
254
254
{
255
255
php_output_context context ;
256
256
@@ -281,7 +281,7 @@ PHPAPI void php_output_flush_all(void)
281
281
282
282
/* {{{ SUCCESS|FAILURE php_output_clean(void)
283
283
* 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 )
285
285
{
286
286
php_output_context context ;
287
287
@@ -309,7 +309,7 @@ PHPAPI void php_output_clean_all(void)
309
309
310
310
/* {{{ SUCCESS|FAILURE php_output_end(void)
311
311
* 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 )
313
313
{
314
314
if (php_output_stack_pop (PHP_OUTPUT_POP_TRY )) {
315
315
return SUCCESS ;
@@ -328,7 +328,7 @@ PHPAPI void php_output_end_all(void)
328
328
329
329
/* {{{ SUCCESS|FAILURE php_output_discard(void)
330
330
* 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 )
332
332
{
333
333
if (php_output_stack_pop (PHP_OUTPUT_POP_DISCARD |PHP_OUTPUT_POP_TRY )) {
334
334
return SUCCESS ;
@@ -357,7 +357,7 @@ PHPAPI int php_output_get_level(void)
357
357
358
358
/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z)
359
359
* 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 )
361
361
{
362
362
if (OG (active )) {
363
363
ZVAL_STRINGL (p , OG (active )-> buffer .data , OG (active )-> buffer .used );
@@ -370,7 +370,7 @@ PHPAPI int php_output_get_contents(zval *p)
370
370
371
371
/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z)
372
372
* 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 )
374
374
{
375
375
if (OG (active )) {
376
376
ZVAL_LONG (p , OG (active )-> buffer .used );
@@ -392,7 +392,7 @@ PHPAPI php_output_handler* php_output_get_active_handler(void)
392
392
393
393
/* {{{ SUCCESS|FAILURE php_output_handler_start_default(void)
394
394
* Start a "default output handler" */
395
- PHPAPI int php_output_start_default (void )
395
+ PHPAPI zend_result php_output_start_default (void )
396
396
{
397
397
php_output_handler * handler ;
398
398
@@ -407,7 +407,7 @@ PHPAPI int php_output_start_default(void)
407
407
408
408
/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull(void)
409
409
* Start a "null output handler" */
410
- PHPAPI int php_output_start_devnull (void )
410
+ PHPAPI zend_result php_output_start_devnull (void )
411
411
{
412
412
php_output_handler * handler ;
413
413
@@ -422,7 +422,7 @@ PHPAPI int php_output_start_devnull(void)
422
422
423
423
/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags)
424
424
* 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 )
426
426
{
427
427
php_output_handler * handler ;
428
428
@@ -441,7 +441,7 @@ PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int fl
441
441
442
442
/* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags)
443
443
* 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 )
445
445
{
446
446
php_output_handler * handler ;
447
447
@@ -526,7 +526,7 @@ PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *op
526
526
527
527
/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler)
528
528
* 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 )
530
530
{
531
531
HashTable * rconflicts ;
532
532
php_output_handler_conflict_check_t conflict ;
@@ -553,9 +553,9 @@ PHPAPI int php_output_handler_start(php_output_handler *handler)
553
553
}
554
554
/* }}} */
555
555
556
- /* {{{ int php_output_handler_started(zval *name)
556
+ /* {{{ bool php_output_handler_started(zval *name)
557
557
* 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 )
559
559
{
560
560
php_output_handler * * handlers ;
561
561
int i , count = php_output_get_level ();
@@ -565,34 +565,34 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len)
565
565
566
566
for (i = 0 ; i < count ; ++ i ) {
567
567
if (zend_string_equals_cstr (handlers [i ]-> name , name , name_len )) {
568
- return 1 ;
568
+ return true ;
569
569
}
570
570
}
571
571
}
572
572
573
- return 0 ;
573
+ return false ;
574
574
}
575
575
/* }}} */
576
576
577
- /* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old)
577
+ /* {{{ bool php_output_handler_conflict(zval *handler_new, zval *handler_old)
578
578
* 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 )
580
580
{
581
581
if (php_output_handler_started (handler_set , handler_set_len )) {
582
582
if (handler_new_len != handler_set_len || memcmp (handler_new , handler_set , handler_set_len )) {
583
583
php_error_docref ("ref.outcontrol" , E_WARNING , "Output handler '%s' conflicts with '%s'" , handler_new , handler_set );
584
584
} else {
585
585
php_error_docref ("ref.outcontrol" , E_WARNING , "Output handler '%s' cannot be used twice" , handler_new );
586
586
}
587
- return 1 ;
587
+ return true ;
588
588
}
589
- return 0 ;
589
+ return false ;
590
590
}
591
591
/* }}} */
592
592
593
593
/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func)
594
594
* 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 )
596
596
{
597
597
zend_string * str ;
598
598
@@ -609,7 +609,7 @@ PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_le
609
609
610
610
/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func)
611
611
* 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 )
613
613
{
614
614
HashTable rev , * rev_ptr = NULL ;
615
615
@@ -646,7 +646,7 @@ PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *name
646
646
647
647
/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func)
648
648
* 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 )
650
650
{
651
651
zend_string * str ;
652
652
@@ -663,7 +663,7 @@ PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len,
663
663
664
664
/* {{{ SUCCESS|FAILURE php_output_handler_hook(php_output_handler_hook_t type, void *arg)
665
665
* 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 )
667
667
{
668
668
if (OG (running )) {
669
669
switch (type ) {
@@ -751,18 +751,18 @@ PHPAPI int php_output_get_start_lineno(void)
751
751
}
752
752
/* }}} */
753
753
754
- /* {{{ static int php_output_lock_error(int op)
754
+ /* {{{ static bool php_output_lock_error(int op)
755
755
* 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 )
757
757
{
758
758
/* if there's no ob active, ob has been stopped */
759
759
if (op && OG (active ) && OG (running )) {
760
760
/* fatal error */
761
761
php_output_deactivate ();
762
762
php_error_docref ("ref.outcontrol" , E_ERROR , "Cannot use output buffering in output buffering display handlers" );
763
- return 1 ;
763
+ return true ;
764
764
}
765
- return 0 ;
765
+ return false ;
766
766
}
767
767
/* }}} */
768
768
@@ -865,9 +865,9 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz
865
865
}
866
866
/* }}} */
867
867
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)
869
869
* 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 )
871
871
{
872
872
if (buf -> used ) {
873
873
OG (flags ) |= PHP_OUTPUT_WRITTEN ;
@@ -886,10 +886,10 @@ static inline int php_output_handler_append(php_output_handler *handler, const p
886
886
/* chunked buffering */
887
887
if (handler -> size && (handler -> buffer .used >= handler -> size )) {
888
888
/* store away errors and/or any intermediate output */
889
- return OG (running ) ? 1 : 0 ;
889
+ return OG (running ) ? true : false ;
890
890
}
891
891
}
892
- return 1 ;
892
+ return true ;
893
893
}
894
894
/* }}} */
895
895
@@ -1243,7 +1243,7 @@ static int php_output_stack_pop(int flags)
1243
1243
1244
1244
/* {{{ static SUCCESS|FAILURE php_output_handler_compat_func(void *ctx, php_output_context *)
1245
1245
* 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 )
1247
1247
{
1248
1248
php_output_handler_func_t func = * (php_output_handler_func_t * ) handler_context ;
1249
1249
@@ -1269,7 +1269,7 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con
1269
1269
1270
1270
/* {{{ static SUCCESS|FAILURE php_output_handler_default_func(void *ctx, php_output_context *)
1271
1271
* 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 )
1273
1273
{
1274
1274
php_output_context_pass (output_context );
1275
1275
return SUCCESS ;
@@ -1278,7 +1278,7 @@ static int php_output_handler_default_func(void **handler_context, php_output_co
1278
1278
1279
1279
/* {{{ static SUCCESS|FAILURE php_output_handler_devnull_func(void *ctx, php_output_context *)
1280
1280
* 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 )
1282
1282
{
1283
1283
return SUCCESS ;
1284
1284
}
0 commit comments