Skip to content

Commit

Permalink
Resolve some MSVC C4244 level 2 warnings
Browse files Browse the repository at this point in the history
These got already approval by the respective code owners in GH-17076.
  • Loading branch information
cmb69 committed Dec 10, 2024
1 parent a7785e8 commit 6e759e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions ext/ffi/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7491,10 +7491,10 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
case ZEND_FFI_TYPE_FLOAT:
if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
val->kind = ZEND_FFI_VAL_FLOAT;
val->d = val->u64;
val->d = (zend_ffi_double) val->u64;
} else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
val->kind = ZEND_FFI_VAL_FLOAT;
val->d = val->i64;
val->d = (zend_ffi_double) val->i64;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_FLOAT;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
Expand All @@ -7507,10 +7507,10 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
case ZEND_FFI_TYPE_DOUBLE:
if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
val->kind = ZEND_FFI_VAL_DOUBLE;
val->d = val->u64;
val->d = (zend_ffi_double) val->u64;
} else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
val->kind = ZEND_FFI_VAL_DOUBLE;
val->d = val->i64;
val->d = (zend_ffi_double) val->i64;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_DOUBLE;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
Expand Down Expand Up @@ -7546,7 +7546,7 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
val->kind = ZEND_FFI_VAL_UINT32;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_UINT32;
val->u64 = val->d;
val->u64 = (uint64_t) val->d;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
val->kind = ZEND_FFI_VAL_UINT32;
val->u64 = val->ch;
Expand All @@ -7561,7 +7561,7 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
val->kind = ZEND_FFI_VAL_INT32;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_INT32;
val->i64 = val->d;
val->i64 = (uint64_t) val->d;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
val->kind = ZEND_FFI_VAL_INT32;
val->i64 = val->ch;
Expand All @@ -7574,7 +7574,7 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
val->kind = ZEND_FFI_VAL_UINT64;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_UINT64;
val->u64 = val->d;
val->u64 = (uint64_t) val->d;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
val->kind = ZEND_FFI_VAL_UINT64;
val->u64 = val->ch;
Expand All @@ -7591,7 +7591,7 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
val->ch = val->i64;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_CHAR;
val->ch = val->d;
val->ch = (char) val->d;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
} else {
val->kind = ZEND_FFI_VAL_ERROR;
Expand All @@ -7602,7 +7602,7 @@ void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */
val->kind = ZEND_FFI_VAL_UINT32;
} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
val->kind = ZEND_FFI_VAL_UINT32;
val->u64 = val->d;
val->u64 = (uint64_t) val->d;
} else if (val->kind == ZEND_FFI_VAL_CHAR) {
val->kind = ZEND_FFI_VAL_UINT32;
val->u64 = val->ch;
Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/mbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3348,7 +3348,7 @@ try_next_encoding:;
}

for (size_t i = 0; i < length; i++) {
array[i].demerits *= array[i].multiplier;
array[i].demerits = (uint64_t) (array[i].demerits * array[i].multiplier);
}

return length;
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data)
whiteSpace_collapse(data->children->content);
switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) {
case IS_LONG:
ZVAL_DOUBLE(ret, lval);
ZVAL_DOUBLE(ret, (double) lval);
break;
case IS_DOUBLE:
ZVAL_DOUBLE(ret, dval);
Expand Down

0 comments on commit 6e759e0

Please sign in to comment.