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
2ec4f154
Commit
2ec4f154
authored
May 04, 2000
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark Hammond should get his act into gear (his words :-). Zero length
strings _are_ valid!
parent
1e6e8d9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Objects/unicodeobject.c
Objects/unicodeobject.c
+7
-2
No files found.
Objects/unicodeobject.c
View file @
2ec4f154
...
@@ -1554,7 +1554,7 @@ PyObject *PyUnicode_DecodeMBCS(const char *s,
...
@@ -1554,7 +1554,7 @@ PyObject *PyUnicode_DecodeMBCS(const char *s,
/* First get the size of the result */
/* First get the size of the result */
DWORD
usize
=
MultiByteToWideChar
(
CP_ACP
,
0
,
s
,
size
,
NULL
,
0
);
DWORD
usize
=
MultiByteToWideChar
(
CP_ACP
,
0
,
s
,
size
,
NULL
,
0
);
if
(
usize
==
0
)
if
(
size
>
0
&&
usize
==
0
)
return
PyErr_SetFromWindowsErrWithFilename
(
0
,
NULL
);
return
PyErr_SetFromWindowsErrWithFilename
(
0
,
NULL
);
v
=
_PyUnicode_New
(
usize
);
v
=
_PyUnicode_New
(
usize
);
...
@@ -1577,9 +1577,14 @@ PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p,
...
@@ -1577,9 +1577,14 @@ PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p,
{
{
PyObject
*
repr
;
PyObject
*
repr
;
char
*
s
;
char
*
s
;
DWORD
mbcssize
;
/* If there are no characters, bail now! */
if
(
size
==
0
)
return
PyString_FromString
(
""
);
/* First get the size of the result */
/* First get the size of the result */
DWORD
mbcssize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
size
,
NULL
,
0
,
NULL
,
NULL
);
mbcssize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
size
,
NULL
,
0
,
NULL
,
NULL
);
if
(
mbcssize
==
0
)
if
(
mbcssize
==
0
)
return
PyErr_SetFromWindowsErrWithFilename
(
0
,
NULL
);
return
PyErr_SetFromWindowsErrWithFilename
(
0
,
NULL
);
...
...
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