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
ef42dae7
Commit
ef42dae7
authored
Mar 24, 2015
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23765: Remove IsBadStringPtr calls in ctypes
Also renames a local to avoid warnings about shadowing
parent
c98290b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
Modules/_ctypes/cfield.c
Modules/_ctypes/cfield.c
+4
-20
No files found.
Modules/_ctypes/cfield.c
View file @
ef42dae7
...
...
@@ -1354,14 +1354,6 @@ z_get(void *ptr, Py_ssize_t size)
{
/* XXX What about invalid pointers ??? */
if
(
*
(
void
**
)
ptr
)
{
#if defined(MS_WIN32) && !defined(_WIN32_WCE)
if
(
IsBadStringPtrA
(
*
(
char
**
)
ptr
,
-
1
))
{
PyErr_Format
(
PyExc_ValueError
,
"invalid string pointer %p"
,
*
(
char
**
)
ptr
);
return
NULL
;
}
#endif
return
PyBytes_FromStringAndSize
(
*
(
char
**
)
ptr
,
strlen
(
*
(
char
**
)
ptr
));
}
else
{
...
...
@@ -1418,14 +1410,6 @@ Z_get(void *ptr, Py_ssize_t size)
wchar_t
*
p
;
p
=
*
(
wchar_t
**
)
ptr
;
if
(
p
)
{
#if defined(MS_WIN32) && !defined(_WIN32_WCE)
if
(
IsBadStringPtrW
(
*
(
wchar_t
**
)
ptr
,
-
1
))
{
PyErr_Format
(
PyExc_ValueError
,
"invalid string pointer %p"
,
*
(
wchar_t
**
)
ptr
);
return
NULL
;
}
#endif
return
PyUnicode_FromWideChar
(
p
,
wcslen
(
p
));
}
else
{
Py_INCREF
(
Py_None
);
...
...
@@ -1455,15 +1439,15 @@ BSTR_set(void *ptr, PyObject *value, Py_ssize_t size)
/* create a BSTR from value */
if
(
value
)
{
wchar_t
*
wvalue
;
Py_ssize_t
size
;
wvalue
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
size
);
Py_ssize_t
w
size
;
wvalue
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
w
size
);
if
(
wvalue
==
NULL
)
return
NULL
;
if
((
unsigned
)
size
!=
size
)
{
if
((
unsigned
)
wsize
!=
w
size
)
{
PyErr_SetString
(
PyExc_ValueError
,
"String too long for BSTR"
);
return
NULL
;
}
bstr
=
SysAllocStringLen
(
wvalue
,
(
unsigned
)
size
);
bstr
=
SysAllocStringLen
(
wvalue
,
(
unsigned
)
w
size
);
Py_DECREF
(
value
);
}
else
bstr
=
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