From ddc2eab0546dd4dd3f5a28074f3f5b0cf2e450e2 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Sat, 30 Sep 2023 10:29:07 -0600 Subject: [PATCH 1/2] fix mbstring.c -Wsingle-bit-bitfield-constant-conversion These were both local variables, so there isn't much value in using bitfields in the first place. --- ext/mbstring/mbstring.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 3e59806b86750..7d2471416ed38 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -4202,10 +4202,8 @@ PHP_FUNCTION(mb_send_mail) size_t i; char *to_r = NULL; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); - struct { - int cnt_type:1; - int cnt_trans_enc:1; - } suppressed_hdrs = { 0, 0 }; + bool uses_content_type = false; + bool uses_content_transfer_encoding = false; char *p; enum mbfl_no_encoding; @@ -4288,7 +4286,7 @@ PHP_FUNCTION(mb_send_mail) } } } - suppressed_hdrs.cnt_type = 1; + uses_content_type = true; } if ((s = zend_hash_str_find(&ht_headers, "content-transfer-encoding", sizeof("content-transfer-encoding") - 1))) { @@ -4308,7 +4306,7 @@ PHP_FUNCTION(mb_send_mail) body_enc = &mbfl_encoding_8bit; break; } - suppressed_hdrs.cnt_trans_enc = 1; + uses_content_transfer_encoding = true; } /* To: */ @@ -4393,7 +4391,7 @@ PHP_FUNCTION(mb_send_mail) empty = false; } - if (!suppressed_hdrs.cnt_type) { + if (!uses_content_type) { if (!empty) { smart_str_appendl(&str, line_sep, line_sep_len); } @@ -4407,7 +4405,7 @@ PHP_FUNCTION(mb_send_mail) empty = false; } - if (!suppressed_hdrs.cnt_trans_enc) { + if (!uses_content_transfer_encoding) { if (!empty) { smart_str_appendl(&str, line_sep, line_sep_len); } From e69be7ca61254612f57a1113d09abe6031800587 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Mon, 2 Oct 2023 14:59:08 -0600 Subject: [PATCH 2/2] refactor: uses_ to suppress_ --- ext/mbstring/mbstring.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7d2471416ed38..7bf6ef02ee2ef 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -4202,8 +4202,8 @@ PHP_FUNCTION(mb_send_mail) size_t i; char *to_r = NULL; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); - bool uses_content_type = false; - bool uses_content_transfer_encoding = false; + bool suppress_content_type = false; + bool suppress_content_transfer_encoding = false; char *p; enum mbfl_no_encoding; @@ -4286,7 +4286,7 @@ PHP_FUNCTION(mb_send_mail) } } } - uses_content_type = true; + suppress_content_type = true; } if ((s = zend_hash_str_find(&ht_headers, "content-transfer-encoding", sizeof("content-transfer-encoding") - 1))) { @@ -4306,7 +4306,7 @@ PHP_FUNCTION(mb_send_mail) body_enc = &mbfl_encoding_8bit; break; } - uses_content_transfer_encoding = true; + suppress_content_transfer_encoding = true; } /* To: */ @@ -4391,7 +4391,7 @@ PHP_FUNCTION(mb_send_mail) empty = false; } - if (!uses_content_type) { + if (!suppress_content_type) { if (!empty) { smart_str_appendl(&str, line_sep, line_sep_len); } @@ -4405,7 +4405,7 @@ PHP_FUNCTION(mb_send_mail) empty = false; } - if (!uses_content_transfer_encoding) { + if (!suppress_content_transfer_encoding) { if (!empty) { smart_str_appendl(&str, line_sep, line_sep_len); }