Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f711f4a
Commit
3f711f4a
authored
Oct 16, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_Py_wreadlink() uses _Py_char2wchar() to decode the result, to support
surrogate characters.
parent
9d396399
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Python/fileutils.c
Python/fileutils.c
+7
-2
No files found.
Python/fileutils.c
View file @
3f711f4a
...
...
@@ -307,6 +307,7 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
{
char
*
cpath
;
char
cbuf
[
PATH_MAX
];
wchar_t
*
wbuf
;
int
res
;
size_t
r1
;
...
...
@@ -324,11 +325,15 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
return
-
1
;
}
cbuf
[
res
]
=
'\0'
;
/* buf will be null terminated */
r1
=
mbstowcs
(
buf
,
cbuf
,
bufsiz
);
if
(
r1
==
-
1
)
{
wbuf
=
_Py_char2wchar
(
cbuf
);
r1
=
wcslen
(
wbuf
);
if
(
bufsiz
<=
r1
)
{
PyMem_Free
(
wbuf
);
errno
=
EINVAL
;
return
-
1
;
}
wcsncpy
(
buf
,
wbuf
,
bufsiz
);
PyMem_Free
(
wbuf
);
return
(
int
)
r1
;
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment