1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

win32: switch handful of memmove over memcpy. (#17508)

This commit is contained in:
David CARLIER
2025-01-18 14:47:48 +00:00
committed by GitHub
parent 709c0a9905
commit 252c0c9164
2 changed files with 4 additions and 4 deletions

View File

@@ -316,7 +316,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
return -1;
}
memmove(tmp, path, (path_len + 1) * sizeof(wchar_t));
memcpy(tmp, path, (path_len + 1) * sizeof(wchar_t));
if (PHP_WIN32_IOUTIL_NORM_FAIL == php_win32_ioutil_normalize_path_w(&tmp, path_len, &path_len)) {
free(tmp);
@@ -331,7 +331,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
free(tmp);
return -1;
}
memmove(_tmp, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
memcpy(_tmp, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
src = tmp;
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
#ifndef ZTS

View File

@@ -220,11 +220,11 @@ zend_always_inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in
}
if (PHP_WIN32_IOUTIL_IS_LONG_PATHW(mb, mb_len) || PHP_WIN32_IOUTIL_IS_JUNCTION_PATHW(mb, mb_len) || PHP_WIN32_IOUTIL_IS_UNC_PATHW(mb, mb_len)) {
memmove(ret, mb, mb_len * sizeof(wchar_t));
memcpy(ret, mb, mb_len * sizeof(wchar_t));
ret[mb_len] = L'\0';
} else {
wchar_t *src = mb, *dst = ret + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
memmove(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
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);