From d775ba88049936a4b954fd0c15cb7c9efdec7e86 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 May 2024 15:41:43 +0100 Subject: [PATCH 1/5] ext/bcmath: Fix [-Wenum-int-mismatch] compiler warning --- ext/bcmath/libbcmath/src/bcmath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h index e6273c18a11..2d247bd860b 100644 --- a/ext/bcmath/libbcmath/src/bcmath.h +++ b/ext/bcmath/libbcmath/src/bcmath.h @@ -128,7 +128,7 @@ int bc_modulo(bc_num num1, bc_num num2, bc_num *resul, int scale); int bc_divmod(bc_num num1, bc_num num2, bc_num *quo, bc_num *rem, int scale); -int bc_raisemod(bc_num base, bc_num expo, bc_num mo, bc_num *result, int scale); +zend_result bc_raisemod(bc_num base, bc_num expo, bc_num mo, bc_num *result, int scale); void bc_raise(bc_num num1, bc_num num2, bc_num *resul, int scale); From 554541c4dbcf74a7f8170ef537ca5e7f347e2da0 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 May 2024 15:42:12 +0100 Subject: [PATCH 2/5] ext/ffi: Fix [-Wenum-int-mismatch] compiler warning --- ext/ffi/ffi_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/ffi/ffi_parser.c b/ext/ffi/ffi_parser.c index eca10c27d19..b956f885ee0 100644 --- a/ext/ffi/ffi_parser.c +++ b/ext/ffi/ffi_parser.c @@ -3552,7 +3552,7 @@ static void parse(void) { } } -int zend_ffi_parse_decl(const char *str, size_t len) { +zend_result zend_ffi_parse_decl(const char *str, size_t len) { if (SETJMP(FFI_G(bailout))==0) { FFI_G(allow_vla) = 0; FFI_G(attribute_parsing) = 0; @@ -3565,7 +3565,7 @@ int zend_ffi_parse_decl(const char *str, size_t len) { } } -int zend_ffi_parse_type(const char *str, size_t len, zend_ffi_dcl *dcl) { +zend_result zend_ffi_parse_type(const char *str, size_t len, zend_ffi_dcl *dcl) { int sym; if (SETJMP(FFI_G(bailout))==0) { From 3c45152798b1fca856c1318d68401f683a336384 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 May 2024 15:43:03 +0100 Subject: [PATCH 3/5] ext/gd: Fix [-Wcalloc-transposed-args] compiler warning --- ext/gd/libgd/gd_topal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c index a92a7acb17a..2a9fb3d608d 100644 --- a/ext/gd/libgd/gd_topal.c +++ b/ext/gd/libgd/gd_topal.c @@ -1498,7 +1498,7 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors colorsWanted = maxColors; } if (!cimP) { - nim->pixels = gdCalloc (sizeof (unsigned char *), oim->sy); + nim->pixels = gdCalloc (oim->sy, sizeof (unsigned char *)); if (!nim->pixels) { /* No can do */ @@ -1506,7 +1506,7 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors } for (i = 0; (i < nim->sy); i++) { - nim->pixels[i] = gdCalloc (sizeof (unsigned char *), oim->sx); + nim->pixels[i] = gdCalloc (oim->sx, sizeof (unsigned char *)); if (!nim->pixels[i]) { goto outOfMemory; @@ -1514,7 +1514,7 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors } } - cquantize = (my_cquantize_ptr) gdCalloc (sizeof (my_cquantizer), 1); + cquantize = (my_cquantize_ptr) gdCalloc (1, sizeof (my_cquantizer)); if (!cquantize) { /* No can do */ From d4accd8b1253351c9775fc2ce33d471c759eaead Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 May 2024 15:43:17 +0100 Subject: [PATCH 4/5] ext/pdo_mysql: Fix [-Wcalloc-transposed-args] compiler warning --- ext/pdo_mysql/mysql_statement.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 765e05e1358..c4f86b0e7d3 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -581,7 +581,7 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori } if (!S->current_row) { - S->current_row = ecalloc(sizeof(zval), stmt->column_count); + S->current_row = ecalloc(stmt->column_count, sizeof(zval)); } for (unsigned i = 0; i < stmt->column_count; i++) { zval_ptr_dtor_nogc(&S->current_row[i]); From 0accfd1fe1de164ca2c87c14a9d1322aafe37c4e Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 May 2024 15:43:33 +0100 Subject: [PATCH 5/5] ext/readline: Fix [-Wcalloc-transposed-args] compiler warning Closes GH-14280 --- ext/readline/readline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index db2776fb27a..1bd5e2fd605 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -456,7 +456,7 @@ char **php_readline_completion_cb(const char *text, int start, int end) matches = rl_completion_matches(text,_readline_command_generator); } else { /* libedit will read matches[2] */ - matches = calloc(sizeof(char *), 3); + matches = calloc(3, sizeof(char *)); if (!matches) { return NULL; }