Skip to content

Simplify parsing of affine matrix arguments #17094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4017,19 +4017,7 @@ PHP_FUNCTION(imageaffine)
if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) {
switch (Z_TYPE_P(zval_affine_elem)) {
case IS_LONG:
affine[i] = Z_LVAL_P(zval_affine_elem);
if (affine[i] < INT_MIN || affine[i] > INT_MAX) {
zend_argument_value_error(2, "element %i must be between %d and %d", i, INT_MIN, INT_MAX);
RETURN_THROWS();
}
break;
case IS_DOUBLE:
affine[i] = Z_DVAL_P(zval_affine_elem);
if (affine[i] < INT_MIN || affine[i] > INT_MAX) {
zend_argument_value_error(2, "element %i must be between %d and %d", i, INT_MIN, INT_MAX);
RETURN_THROWS();
}
break;
case IS_STRING:
affine[i] = zval_get_double(zval_affine_elem);
if (affine[i] < INT_MIN || affine[i] > INT_MAX) {
Expand Down Expand Up @@ -4195,11 +4183,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
case IS_LONG:
m1[i] = Z_LVAL_P(tmp);
break;
case IS_DOUBLE:
m1[i] = Z_DVAL_P(tmp);
break;
case IS_STRING:
m1[i] = zval_get_double(tmp);
break;
Expand All @@ -4212,11 +4196,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
case IS_LONG:
m2[i] = Z_LVAL_P(tmp);
break;
case IS_DOUBLE:
m2[i] = Z_DVAL_P(tmp);
break;
case IS_STRING:
m2[i] = zval_get_double(tmp);
break;
Expand Down
Loading