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
d4b45cb9
Commit
d4b45cb9
authored
Jun 17, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
ctypes: the type of b_size is Py_ssize_t.
parents
a63073a8
85e6635e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+4
-4
No files found.
Modules/_ctypes/_ctypes.c
View file @
d4b45cb9
...
...
@@ -1124,7 +1124,7 @@ CharArray_get_raw(CDataObject *self)
static
PyObject
*
CharArray_get_value
(
CDataObject
*
self
)
{
in
t
i
;
Py_ssize_
t
i
;
char
*
ptr
=
self
->
b_ptr
;
for
(
i
=
0
;
i
<
self
->
b_size
;
++
i
)
if
(
*
ptr
++
==
'\0'
)
...
...
@@ -1180,9 +1180,9 @@ static PyGetSetDef CharArray_getsets[] = {
static
PyObject
*
WCharArray_get_value
(
CDataObject
*
self
)
{
unsigned
in
t
i
;
Py_ssize_
t
i
;
wchar_t
*
ptr
=
(
wchar_t
*
)
self
->
b_ptr
;
for
(
i
=
0
;
i
<
self
->
b_size
/
sizeof
(
wchar_t
);
++
i
)
for
(
i
=
0
;
i
<
self
->
b_size
/
(
Py_ssize_t
)
sizeof
(
wchar_t
);
++
i
)
if
(
*
ptr
++
==
(
wchar_t
)
0
)
break
;
return
PyUnicode_FromWideChar
((
wchar_t
*
)
self
->
b_ptr
,
i
);
...
...
@@ -1211,7 +1211,7 @@ WCharArray_set_value(CDataObject *self, PyObject *value)
wstr
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
len
);
if
(
wstr
==
NULL
)
return
-
1
;
if
((
unsigned
)
len
>
self
->
b_size
/
sizeof
(
wchar_t
))
{
if
((
size_t
)
len
>
self
->
b_size
/
sizeof
(
wchar_t
))
{
PyErr_SetString
(
PyExc_ValueError
,
"string too long"
);
result
=
-
1
;
...
...
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