@@ -621,15 +621,15 @@ static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib
621
621
/* }}} */
622
622
623
623
/* {{{ date_format - (gm)date helper */
624
- static zend_string * date_format (const char * format , size_t format_len , timelib_time * t , int localtime )
624
+ static zend_string * date_format (const char * format , size_t format_len , timelib_time * t , bool localtime )
625
625
{
626
626
smart_str string = {0 };
627
627
size_t i ;
628
628
int length = 0 ;
629
629
char buffer [97 ];
630
630
timelib_time_offset * offset = NULL ;
631
631
timelib_sll isoweek , isoyear ;
632
- int rfc_colon ;
632
+ bool rfc_colon ;
633
633
int weekYearSet = 0 ;
634
634
635
635
if (!format_len ) {
@@ -788,7 +788,7 @@ static zend_string *date_format(const char *format, size_t format_len, timelib_t
788
788
return string .s ;
789
789
}
790
790
791
- static void php_date (INTERNAL_FUNCTION_PARAMETERS , int localtime )
791
+ static void php_date (INTERNAL_FUNCTION_PARAMETERS , bool localtime )
792
792
{
793
793
zend_string * format ;
794
794
zend_long ts ;
@@ -808,7 +808,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
808
808
}
809
809
/* }}} */
810
810
811
- PHPAPI zend_string * php_format_date (const char * format , size_t format_len , time_t ts , int localtime ) /* {{{ */
811
+ PHPAPI zend_string * php_format_date (const char * format , size_t format_len , time_t ts , bool localtime ) /* {{{ */
812
812
{
813
813
timelib_time * t ;
814
814
timelib_tzinfo * tzi ;
@@ -834,7 +834,7 @@ PHPAPI zend_string *php_format_date(const char *format, size_t format_len, time_
834
834
/* }}} */
835
835
836
836
/* {{{ php_idate */
837
- PHPAPI int php_idate (char format , time_t ts , int localtime )
837
+ PHPAPI int php_idate (char format , time_t ts , bool localtime )
838
838
{
839
839
timelib_time * t ;
840
840
timelib_tzinfo * tzi ;
@@ -1069,7 +1069,7 @@ PHP_FUNCTION(strtotime)
1069
1069
/* }}} */
1070
1070
1071
1071
/* {{{ php_mktime - (gm)mktime helper */
1072
- PHPAPI void php_mktime (INTERNAL_FUNCTION_PARAMETERS , int gmt )
1072
+ PHPAPI void php_mktime (INTERNAL_FUNCTION_PARAMETERS , bool gmt )
1073
1073
{
1074
1074
zend_long hou , min , sec , mon , day , yea ;
1075
1075
bool min_is_null = 1 , sec_is_null = 1 , mon_is_null = 1 , day_is_null = 1 , yea_is_null = 1 ;
@@ -1182,7 +1182,7 @@ PHP_FUNCTION(checkdate)
1182
1182
/* }}} */
1183
1183
1184
1184
/* {{{ php_strftime - (gm)strftime helper */
1185
- PHPAPI void php_strftime (INTERNAL_FUNCTION_PARAMETERS , int gmt )
1185
+ PHPAPI void php_strftime (INTERNAL_FUNCTION_PARAMETERS , bool gmt )
1186
1186
{
1187
1187
zend_string * format ;
1188
1188
zend_long timestamp ;
@@ -2191,7 +2191,7 @@ static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *us
2191
2191
#endif
2192
2192
}
2193
2193
2194
- PHPAPI int php_date_initialize (php_date_obj * dateobj , const char * time_str , size_t time_str_len , const char * format , zval * timezone_object , int flags ) /* {{{ */
2194
+ PHPAPI bool php_date_initialize (php_date_obj * dateobj , const char * time_str , size_t time_str_len , const char * format , zval * timezone_object , int flags ) /* {{{ */
2195
2195
{
2196
2196
timelib_time * now ;
2197
2197
timelib_tzinfo * tzi = NULL ;
@@ -2526,13 +2526,13 @@ static bool php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myh
2526
2526
zend_string * tmp = zend_string_concat3 (
2527
2527
Z_STRVAL_P (z_date ), Z_STRLEN_P (z_date ), " " , 1 ,
2528
2528
Z_STRVAL_P (z_timezone ), Z_STRLEN_P (z_timezone ));
2529
- int ret = php_date_initialize (* dateobj , ZSTR_VAL (tmp ), ZSTR_LEN (tmp ), NULL , NULL , 0 );
2529
+ bool ret = php_date_initialize (* dateobj , ZSTR_VAL (tmp ), ZSTR_LEN (tmp ), NULL , NULL , 0 );
2530
2530
zend_string_release (tmp );
2531
- return 1 == ret ;
2531
+ return ret ;
2532
2532
}
2533
2533
2534
2534
case TIMELIB_ZONETYPE_ID : {
2535
- int ret ;
2535
+ bool ret ;
2536
2536
php_timezone_obj * tzobj ;
2537
2537
2538
2538
tzi = php_date_parse_tzfile (Z_STRVAL_P (z_timezone ), DATE_TIMEZONEDB );
@@ -2548,7 +2548,7 @@ static bool php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myh
2548
2548
2549
2549
ret = php_date_initialize (* dateobj , Z_STRVAL_P (z_date ), Z_STRLEN_P (z_date ), NULL , & tmp_obj , 0 );
2550
2550
zval_ptr_dtor (& tmp_obj );
2551
- return 1 == ret ;
2551
+ return ret ;
2552
2552
}
2553
2553
}
2554
2554
return false;
@@ -2793,7 +2793,7 @@ PHP_FUNCTION(date_format)
2793
2793
}
2794
2794
/* }}} */
2795
2795
2796
- static int php_date_modify (zval * object , char * modify , size_t modify_len ) /* {{{ */
2796
+ static bool php_date_modify (zval * object , char * modify , size_t modify_len ) /* {{{ */
2797
2797
{
2798
2798
php_date_obj * dateobj ;
2799
2799
timelib_time * tmp_time ;
@@ -3389,7 +3389,7 @@ PHP_FUNCTION(date_diff)
3389
3389
}
3390
3390
/* }}} */
3391
3391
3392
- static int timezone_initialize (php_timezone_obj * tzobj , const char * tz , size_t tz_len ) /* {{{ */
3392
+ static zend_result timezone_initialize (php_timezone_obj * tzobj , const char * tz , size_t tz_len ) /* {{{ */
3393
3393
{
3394
3394
timelib_time * dummy_t = ecalloc (1 , sizeof (timelib_time ));
3395
3395
int dst , not_found ;
@@ -3425,7 +3425,7 @@ PHP_FUNCTION(timezone_open)
3425
3425
ZEND_PARSE_PARAMETERS_END ();
3426
3426
3427
3427
tzobj = Z_PHPTIMEZONE_P (php_date_instantiate (date_ce_timezone , return_value ));
3428
- if (SUCCESS ! = timezone_initialize (tzobj , ZSTR_VAL (tz ), ZSTR_LEN (tz ))) {
3428
+ if (FAILURE = = timezone_initialize (tzobj , ZSTR_VAL (tz ), ZSTR_LEN (tz ))) {
3429
3429
zval_ptr_dtor (return_value );
3430
3430
RETURN_FALSE ;
3431
3431
}
@@ -3450,26 +3450,27 @@ PHP_METHOD(DateTimeZone, __construct)
3450
3450
}
3451
3451
/* }}} */
3452
3452
3453
- static int php_date_timezone_initialize_from_hash (zval * * return_value , php_timezone_obj * * tzobj , HashTable * myht ) /* {{{ */
3453
+ static zend_result php_date_timezone_initialize_from_hash (zval * * return_value , php_timezone_obj * * tzobj , HashTable * myht ) /* {{{ */
3454
3454
{
3455
3455
zval * z_timezone_type ;
3456
3456
3457
- if ((z_timezone_type = zend_hash_str_find (myht , "timezone_type" , sizeof ("timezone_type" ) - 1 )) != NULL ) {
3458
- zval * z_timezone ;
3457
+ if ((z_timezone_type = zend_hash_str_find (myht , "timezone_type" , sizeof ("timezone_type" ) - 1 )) == NULL ) {
3458
+ return FAILURE ;
3459
+ }
3459
3460
3460
- if ((z_timezone = zend_hash_str_find (myht , "timezone" , sizeof ("timezone" ) - 1 )) != NULL ) {
3461
- if (Z_TYPE_P (z_timezone_type ) != IS_LONG ) {
3462
- return FAILURE ;
3463
- }
3464
- if (Z_TYPE_P (z_timezone ) != IS_STRING ) {
3465
- return FAILURE ;
3466
- }
3467
- if (SUCCESS == timezone_initialize (* tzobj , Z_STRVAL_P (z_timezone ), Z_STRLEN_P (z_timezone ))) {
3468
- return SUCCESS ;
3469
- }
3470
- }
3461
+ zval * z_timezone ;
3462
+
3463
+ if ((z_timezone = zend_hash_str_find (myht , "timezone" , sizeof ("timezone" ) - 1 )) == NULL ) {
3464
+ return FAILURE ;
3465
+ }
3466
+
3467
+ if (Z_TYPE_P (z_timezone_type ) != IS_LONG ) {
3468
+ return FAILURE ;
3471
3469
}
3472
- return FAILURE ;
3470
+ if (Z_TYPE_P (z_timezone ) != IS_STRING ) {
3471
+ return FAILURE ;
3472
+ }
3473
+ return timezone_initialize (* tzobj , Z_STRVAL_P (z_timezone ), Z_STRLEN_P (z_timezone ));
3473
3474
} /* }}} */
3474
3475
3475
3476
/* {{{ */
@@ -3487,7 +3488,7 @@ PHP_METHOD(DateTimeZone, __set_state)
3487
3488
3488
3489
php_date_instantiate (date_ce_timezone , return_value );
3489
3490
tzobj = Z_PHPTIMEZONE_P (return_value );
3490
- if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) != SUCCESS ) {
3491
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) == FAILURE ) {
3491
3492
zend_throw_error (NULL , "Timezone initialization failed" );
3492
3493
zval_ptr_dtor (return_value );
3493
3494
}
@@ -3507,7 +3508,7 @@ PHP_METHOD(DateTimeZone, __wakeup)
3507
3508
3508
3509
myht = Z_OBJPROP_P (object );
3509
3510
3510
- if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) != SUCCESS ) {
3511
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) == FAILURE ) {
3511
3512
zend_throw_error (NULL , "Timezone initialization failed" );
3512
3513
}
3513
3514
}
@@ -3590,7 +3591,8 @@ PHP_FUNCTION(timezone_transitions_get)
3590
3591
{
3591
3592
zval * object , element ;
3592
3593
php_timezone_obj * tzobj ;
3593
- unsigned int begin = 0 , found ;
3594
+ int begin = 0 ;
3595
+ bool found ;
3594
3596
zend_long timestamp_begin = ZEND_LONG_MIN , timestamp_end = INT32_MAX ;
3595
3597
3596
3598
if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "O|ll" , & object , date_ce_timezone , & timestamp_begin , & timestamp_end ) == FAILURE ) {
@@ -3899,7 +3901,6 @@ PHP_METHOD(DateInterval, __construct)
3899
3901
}
3900
3902
/* }}} */
3901
3903
3902
-
3903
3904
static int php_date_interval_initialize_from_hash (zval * * return_value , php_interval_obj * * intobj , HashTable * myht ) /* {{{ */
3904
3905
{
3905
3906
(* intobj )-> diff = timelib_rel_time_ctor ();
@@ -4511,7 +4512,7 @@ PHP_FUNCTION(date_default_timezone_get)
4511
4512
/* {{{ php_do_date_sunrise_sunset
4512
4513
* Common for date_sunrise() and date_sunset() functions
4513
4514
*/
4514
- static void php_do_date_sunrise_sunset (INTERNAL_FUNCTION_PARAMETERS , int calc_sunset )
4515
+ static void php_do_date_sunrise_sunset (INTERNAL_FUNCTION_PARAMETERS , bool calc_sunset )
4515
4516
{
4516
4517
double latitude , longitude , zenith , gmt_offset , altitude ;
4517
4518
bool latitude_is_null = 1 , longitude_is_null = 1 , zenith_is_null = 1 , gmt_offset_is_null = 1 ;
@@ -4788,7 +4789,7 @@ static HashTable *date_object_get_properties_period(zend_object *object) /* {{{
4788
4789
return props ;
4789
4790
} /* }}} */
4790
4791
4791
- static int php_date_period_initialize_from_hash (php_period_obj * period_obj , HashTable * myht ) /* {{{ */
4792
+ static bool php_date_period_initialize_from_hash (php_period_obj * period_obj , HashTable * myht ) /* {{{ */
4792
4793
{
4793
4794
zval * ht_entry ;
4794
4795
@@ -4911,7 +4912,7 @@ PHP_METHOD(DatePeriod, __wakeup)
4911
4912
/* {{{ date_period_is_magic_property
4912
4913
* Common for date_period_read_property() and date_period_write_property() functions
4913
4914
*/
4914
- static int date_period_is_magic_property (zend_string * name )
4915
+ static bool date_period_is_magic_property (zend_string * name )
4915
4916
{
4916
4917
if (zend_string_equals_literal (name , "recurrences" )
4917
4918
|| zend_string_equals_literal (name , "include_start_date" )
0 commit comments