Fix printf style issues in Windows specific code (GH-17452)

A couple of calls pass strings as formats (`-Wformat-security`), and
some others mix up types (`-Wformat`).
This commit is contained in:
Christoph M. Becker 2025-01-13 11:50:05 +01:00 committed by GitHub
parent 26bf239e6d
commit 1675d32261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 17 additions and 17 deletions

View file

@ -610,7 +610,7 @@ PHP_FUNCTION(sapi_windows_cp_set)
cp = php_win32_cp_set_by_id((DWORD)id);
}
if (!cp) {
php_error_docref(NULL, E_WARNING, "Failed to switch to codepage %d", id);
php_error_docref(NULL, E_WARNING, "Failed to switch to codepage " ZEND_LONG_FMT, id);
RETURN_FALSE;
}

View file

@ -468,7 +468,7 @@ static zend_always_inline BOOL is_compatible(HMODULE handle, BOOL is_smaller, ch
if (GetModuleFileName(handle, buf, sizeof(buf)) != 0) {
spprintf(err, 0, format, buf, major, minor, PHP_LINKER_MAJOR, PHP_LINKER_MINOR);
} else {
spprintf(err, 0, "Can't retrieve the module name (error %u)", GetLastError());
spprintf(err, 0, "Can't retrieve the module name (error %lu)", GetLastError());
}
return FALSE;
}
@ -493,7 +493,7 @@ PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err)
# endif
HMODULE handle = GetModuleHandle(crt_name);
if (handle == NULL) {
spprintf(err, 0, "Can't get handle of module %s (error %u)", crt_name, GetLastError());
spprintf(err, 0, "Can't get handle of module %s (error %lu)", crt_name, GetLastError());
return FALSE;
}
return is_compatible(handle, FALSE, "'%s' %u.%u is not compatible with this PHP build linked with %d.%d", err);