mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Address more Clang warnings (GH-17506)
We prefer clean solutions (such as declaring the proper type in the
first place, or introducing a portable format specifier) where easily
possible, but resort to casts otherwise.
We also port f1480ab14b
.
This commit is contained in:
parent
75bd1a9dc0
commit
aa76127d01
11 changed files with 20 additions and 20 deletions
|
@ -353,7 +353,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
|
|||
ITypeComp_Release(bindptr.lptcomp);
|
||||
break;
|
||||
|
||||
case DESCKIND_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (TI) {
|
||||
|
|
|
@ -900,6 +900,9 @@ static zend_always_inline zend_string *zend_ffi_mangled_func_name(zend_string *n
|
|||
case FFI_VECTORCALL_PARTIAL:
|
||||
return strpprintf(0, "%s@@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
|
||||
# endif
|
||||
default:
|
||||
/* other calling conventions don't apply name mangling */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return zend_string_copy(name);
|
||||
|
|
|
@ -62,11 +62,6 @@ TODO:
|
|||
#include "gdhelpers.h"
|
||||
#include "gd_intern.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma optimize("t", on)
|
||||
# include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
static gdImagePtr gdImageScaleBilinear(gdImagePtr im,
|
||||
const unsigned int new_width,
|
||||
const unsigned int new_height);
|
||||
|
|
|
@ -433,9 +433,9 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
|
|||
|
||||
if (strncasecmp(resolved_path, "file:/", pre_len) == 0
|
||||
&& '/' != resolved_path[pre_len]) {
|
||||
xmlChar *tmp = xmlStrdup(resolved_path + pre_len);
|
||||
xmlChar *tmp = xmlStrdup(BAD_CAST (resolved_path + pre_len));
|
||||
xmlFree(resolved_path);
|
||||
resolved_path = tmp;
|
||||
resolved_path = (char *) tmp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -746,7 +746,7 @@ static mysqlnd_rsa_t
|
|||
mysqlnd_sha256_get_rsa_from_pem(const char *buf, size_t len)
|
||||
{
|
||||
BCRYPT_KEY_HANDLE ret = 0;
|
||||
LPSTR der_buf = NULL;
|
||||
BYTE *der_buf = NULL;
|
||||
DWORD der_len;
|
||||
CERT_PUBLIC_KEY_INFO *key_info = NULL;
|
||||
DWORD key_info_len;
|
||||
|
@ -789,7 +789,7 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
|
|||
|
||||
ZeroMemory(&padding_info, sizeof padding_info);
|
||||
padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, (zend_uchar *) xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
|
|||
|
||||
*auth_data_len = server_public_key_len;
|
||||
ret = malloc(*auth_data_len);
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, (zend_uchar *) xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, ret, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
|
||||
DBG_RETURN(0);
|
||||
|
@ -1052,7 +1052,7 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
|
|||
|
||||
ZeroMemory(&padding_info, sizeof padding_info);
|
||||
padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, (zend_uchar *) xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
|
|||
}
|
||||
|
||||
*crypted = emalloc(server_public_key_len);
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, (zend_uchar *) xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, *crypted, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
|
||||
DBG_RETURN(0);
|
||||
|
|
|
@ -2241,7 +2241,7 @@ mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long se
|
|||
retval = php_select(max_fd + 1, &rfds, &wfds, &efds, tv_p);
|
||||
|
||||
if (retval == -1) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=%d)",
|
||||
php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=" PHP_SOCKET_FMT ")",
|
||||
errno, strerror(errno), max_fd);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
|
|
@ -700,7 +700,7 @@ static int php_openssl_win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx,
|
|||
err_code = e;
|
||||
}
|
||||
|
||||
php_error_docref(NULL, E_WARNING, "Error encoding X509 certificate: %d: %s", err_code, ERR_error_string(err_code, err_buf));
|
||||
php_error_docref(NULL, E_WARNING, "Error encoding X509 certificate: %lu: %s", err_code, ERR_error_string(err_code, err_buf));
|
||||
RETURN_CERT_VERIFY_FAILURE(SSL_R_CERTIFICATE_VERIFY_FAILED);
|
||||
}
|
||||
|
||||
|
|
|
@ -859,7 +859,7 @@ PHP_FUNCTION(stream_select)
|
|||
retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p);
|
||||
|
||||
if (retval == -1) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=%d)",
|
||||
php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=" PHP_SOCKET_FMT ")",
|
||||
errno, strerror(errno), max_fd);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,10 @@ END_EXTERN_C()
|
|||
|
||||
#ifdef PHP_WIN32
|
||||
typedef SOCKET php_socket_t;
|
||||
#define PHP_SOCKET_FMT "%" PRIxPTR
|
||||
#else
|
||||
typedef int php_socket_t;
|
||||
#define PHP_SOCKET_FMT "%d"
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
|
|
|
@ -94,7 +94,7 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
|
|||
memset(name, '\0', max_name+1);
|
||||
memset(value, '\0', max_value+1);
|
||||
|
||||
if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) == ERROR_SUCCESS) {
|
||||
if (RegEnumValue(key, i, name, &name_len, NULL, &type, (LPBYTE) value, &value_len) == ERROR_SUCCESS) {
|
||||
if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) {
|
||||
zval data;
|
||||
|
||||
|
@ -287,7 +287,7 @@ char *GetIniPathFromRegistry()
|
|||
if (OpenPhpRegistryKey(NULL, &hKey)) {
|
||||
DWORD buflen = MAXPATHLEN;
|
||||
reg_location = emalloc(MAXPATHLEN+1);
|
||||
if(RegQueryValueEx(hKey, PHPRC_REGISTRY_NAME, 0, NULL, reg_location, &buflen) != ERROR_SUCCESS) {
|
||||
if(RegQueryValueEx(hKey, PHPRC_REGISTRY_NAME, 0, NULL, (LPBYTE) reg_location, &buflen) != ERROR_SUCCESS) {
|
||||
RegCloseKey(hKey);
|
||||
efree(reg_location);
|
||||
reg_location = NULL;
|
||||
|
|
|
@ -89,7 +89,7 @@ void syslog(int priority, const char *message, ...)
|
|||
|
||||
void vsyslog(int priority, const char *message, va_list args)
|
||||
{
|
||||
LPTSTR strs[2];
|
||||
LPCSTR strs[2];
|
||||
unsigned short etype;
|
||||
char *tmp = NULL;
|
||||
DWORD evid;
|
||||
|
@ -120,7 +120,7 @@ void vsyslog(int priority, const char *message, va_list args)
|
|||
|
||||
/* report the event */
|
||||
if (strsw[0] && strsw[1]) {
|
||||
ReportEventW(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strsw, NULL);
|
||||
ReportEventW(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, (LPCWSTR *) strsw, NULL);
|
||||
free(strsw[0]);
|
||||
free(strsw[1]);
|
||||
efree(tmp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue