[issue25889] Find_BOM accepts a char*, but is passed an unsigned char*; and related usage

Alexander Riccio report at bugs.python.org
Wed Dec 16 17:28:45 EST 2015


New submission from Alexander Riccio:

This is safe, but warns on /W4. In maybe_handle_shebang, an unsigned char* is passed to find_BOM, which accepts a char* (https://hg.python.org/cpython/file/tip/PC/launcher.c#l1139).

Without an explicit cast, this generates a warning:

10>..\PC\launcher.c(1139): warning C4057: 'function': 'char *' differs in indirection to slightly different base types from 'unsigned char [256]'

    for `bom = find_BOM(buffer);`

Similarly, assigning start to buffer generates warnings:

10>..\PC\launcher.c(1141): warning C4057: '=': 'char *' differs in indirection to slightly different base types from 'unsigned char *'

    for `start = buffer;`


10>..\PC\launcher.c(1148): warning C4057: '=': 'char *' differs in indirection to slightly different base types from 'unsigned char *'
    for `start = &buffer[bom->length];`

----------
components: Windows
messages: 256547
nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Find_BOM accepts a char*, but is passed an unsigned char*; and related usage
type: compile error

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25889>
_______________________________________


More information about the Python-bugs-list mailing list