mirror of
https://github.com/curl/curl.git
synced 2026-08-25 03:43:31 +03:00
file: Support unicode urls on windows
Closes https://github.com/curl/curl/pull/6501
This commit is contained in:
parent
d4a3b87c13
commit
1269c80af1
6 changed files with 82 additions and 1 deletions
|
|
@ -82,6 +82,32 @@ char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
|
|||
|
||||
#if defined(USE_WIN32_LARGE_FILES) || defined(USE_WIN32_SMALL_FILES)
|
||||
|
||||
int curlx_win32_open(const char *filename, int oflag, ...)
|
||||
{
|
||||
int pmode = 0;
|
||||
|
||||
#ifdef _UNICODE
|
||||
int result = -1;
|
||||
wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
|
||||
#endif
|
||||
|
||||
va_list param;
|
||||
va_start(param, oflag);
|
||||
if(oflag & O_CREAT)
|
||||
pmode = va_arg(param, int);
|
||||
va_end(param);
|
||||
|
||||
#ifdef _UNICODE
|
||||
if(filename_w)
|
||||
result = _wopen(filename_w, oflag, pmode);
|
||||
free(filename_w);
|
||||
if(result != -1)
|
||||
return result;
|
||||
#endif
|
||||
|
||||
return (_open)(filename, oflag, pmode);
|
||||
}
|
||||
|
||||
FILE *curlx_win32_fopen(const char *filename, const char *mode)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
|
|
|
|||
|
|
@ -335,8 +335,10 @@
|
|||
# define stat(fname,stp) curlx_win32_stat(fname, stp)
|
||||
# define struct_stat struct _stati64
|
||||
# define LSEEK_ERROR (__int64)-1
|
||||
# define open curlx_win32_open
|
||||
# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
|
||||
# define access(fname,mode) curlx_win32_access(fname, mode)
|
||||
int curlx_win32_open(const char *filename, int oflag, ...);
|
||||
int curlx_win32_stat(const char *path, struct_stat *buffer);
|
||||
FILE *curlx_win32_fopen(const char *filename, const char *mode);
|
||||
int curlx_win32_access(const char *path, int mode);
|
||||
|
|
@ -356,9 +358,11 @@
|
|||
# define fstat(fdes,stp) _fstat(fdes, stp)
|
||||
# define stat(fname,stp) curlx_win32_stat(fname, stp)
|
||||
# define struct_stat struct _stat
|
||||
# define open curlx_win32_open
|
||||
# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
|
||||
# define access(fname,mode) curlx_win32_access(fname, mode)
|
||||
int curlx_win32_stat(const char *path, struct_stat *buffer);
|
||||
int curlx_win32_open(const char *filename, int oflag, ...);
|
||||
FILE *curlx_win32_fopen(const char *filename, const char *mode);
|
||||
int curlx_win32_access(const char *path, int mode);
|
||||
# endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue