mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
win32: switch handful of memmove over memcpy. (#17508)
This commit is contained in:
parent
709c0a9905
commit
252c0c9164
2 changed files with 4 additions and 4 deletions
|
@ -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);
|
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return -1;
|
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)) {
|
if (PHP_WIN32_IOUTIL_NORM_FAIL == php_win32_ioutil_normalize_path_w(&tmp, path_len, &path_len)) {
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
@ -331,7 +331,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return -1;
|
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;
|
src = tmp;
|
||||||
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
||||||
#ifndef ZTS
|
#ifndef ZTS
|
||||||
|
|
|
@ -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)) {
|
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';
|
ret[mb_len] = L'\0';
|
||||||
} else {
|
} else {
|
||||||
wchar_t *src = mb, *dst = ret + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
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
|
#ifndef ZTS
|
||||||
if (dir_len > 0) {
|
if (dir_len > 0) {
|
||||||
size_t len = GetCurrentDirectoryW(dir_len, dst);
|
size_t len = GetCurrentDirectoryW(dir_len, dst);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue