mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
comply with POSIX signature
This commit is contained in:
parent
8d0d326ff9
commit
ba5df1c682
2 changed files with 6 additions and 7 deletions
|
@ -395,14 +395,15 @@ PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newn
|
||||||
return ret;
|
return ret;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len)
|
PW32IO wchar_t *php_win32_ioutil_getcwd_w(wchar_t *buf, size_t len)
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
DWORD err = 0;
|
DWORD err = 0;
|
||||||
wchar_t *tmp_buf = NULL;
|
wchar_t *tmp_buf = NULL;
|
||||||
|
DWORD tmp_len;
|
||||||
|
|
||||||
/* If buf was NULL, the result has to be freed outside here. */
|
/* If buf was NULL, the result has to be freed outside here. */
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
DWORD tmp_len = GetCurrentDirectoryW(0, NULL) + 1;
|
tmp_len = GetCurrentDirectoryW(0, NULL) + 1;
|
||||||
if (!tmp_len) {
|
if (!tmp_len) {
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
SET_ERRNO_FROM_WIN32_CODE(err);
|
SET_ERRNO_FROM_WIN32_CODE(err);
|
||||||
|
@ -412,9 +413,7 @@ PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = tmp_len;
|
tmp_buf = (wchar_t *)malloc((tmp_len)*sizeof(wchar_t));
|
||||||
|
|
||||||
tmp_buf = (wchar_t *)malloc((len)*sizeof(wchar_t));
|
|
||||||
if (!tmp_buf) {
|
if (!tmp_buf) {
|
||||||
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
|
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -422,7 +421,7 @@ PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len)
|
||||||
buf = tmp_buf;
|
buf = tmp_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetCurrentDirectoryW(len, buf)) {
|
if (!GetCurrentDirectoryW(tmp_len, buf)) {
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
SET_ERRNO_FROM_WIN32_CODE(err);
|
SET_ERRNO_FROM_WIN32_CODE(err);
|
||||||
free(tmp_buf);
|
free(tmp_buf);
|
||||||
|
|
|
@ -222,7 +222,7 @@ PW32IO size_t php_win32_ioutil_dirname(char *buf, size_t len);
|
||||||
PW32IO int php_win32_ioutil_open_w(const wchar_t *path, int flags, ...);
|
PW32IO int php_win32_ioutil_open_w(const wchar_t *path, int flags, ...);
|
||||||
PW32IO int php_win32_ioutil_chdir_w(const wchar_t *path);
|
PW32IO int php_win32_ioutil_chdir_w(const wchar_t *path);
|
||||||
PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newname);
|
PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newname);
|
||||||
PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len);
|
PW32IO wchar_t *php_win32_ioutil_getcwd_w(wchar_t *buf, size_t len);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode);
|
PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue