Skip to content

Conversation

@petdance
Copy link
Contributor

@petdance petdance commented Mar 28, 2020

Make two pointers be const char *.  This quiets a warning from
-Wincompatible-pointer-types.

https://bugs.python.org/issue39943

Make two pointers be const char *.  This quiets a warning from
-Wincompatible-pointer-types.
@serhiy-storchaka
Copy link
Member

You can add const to WFILE.end, RFILE.ptr and RFILE.end.

@petdance
Copy link
Contributor Author

You can add const to WFILE.end, RFILE.ptr and RFILE.end.

I'm glad to do that. I was trying to keep changes minimal, but I'll resubmit.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done more cleanup in #19236.

if (wf.str != NULL) {
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);
const char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);
if (wf.ptr - base > PY_SSIZE_T_MAX) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me, that this condition is always false (see w_reserve()). So you can remove it.

w_object(x, &wf);
w_clear_refs(&wf);
if (wf.str != NULL) {
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the cast to PyBytesObject * is not needed.

@petdance petdance deleted the cast-Python-marshal branch April 3, 2020 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants