Skip to content
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

Solve C4267 warnings in win32/ioutil for x64 #17674

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions win32/ioutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ PW32IO int php_win32_ioutil_close(int fd)

PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
{/*{{{*/
size_t path_len, dir_len = 0;
size_t path_len;
DWORD dir_len = 0;
const wchar_t *my_path;

if (!path) {
Expand Down Expand Up @@ -336,7 +337,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
#ifndef ZTS
if (dir_len > 0) {
size_t len = GetCurrentDirectoryW(dir_len, dst);
DWORD len = GetCurrentDirectoryW(dir_len, dst);
if (len == 0 || len + 1 != dir_len) {
free(tmp);
free(_tmp);
Expand Down
7 changes: 4 additions & 3 deletions win32/ioutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ PW32IO php_win32_ioutil_normalization_result php_win32_ioutil_normalize_path_w(w
zend_always_inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in, size_t in_len, size_t *out_len)
{/*{{{*/
wchar_t *mb, *ret;
size_t mb_len, dir_len = 0;
size_t mb_len;
DWORD dir_len = 0;

mb = php_win32_cp_conv_any_to_w(in, in_len, &mb_len);
if (!mb) {
Expand Down Expand Up @@ -227,8 +228,8 @@ zend_always_inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in
memcpy(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
#ifndef ZTS
if (dir_len > 0) {
size_t len = GetCurrentDirectoryW(dir_len, dst);
if (len == 0 || len + 1 != dir_len) {
DWORD len = GetCurrentDirectoryW(dir_len, dst);
if (len == 0 || len != dir_len - 1) {
free(ret);
free(mb);
return NULL;
Expand Down