Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong wsprintf usage #49057

Closed
eckhardt mannequin opened this issue Jan 2, 2009 · 4 comments
Closed

wrong wsprintf usage #49057

eckhardt mannequin opened this issue Jan 2, 2009 · 4 comments
Labels
build The build process and cross-build OS-windows

Comments

@eckhardt
Copy link
Mannequin

eckhardt mannequin commented Jan 2, 2009

BPO 4807
Nosy @amauryfa, @vstinner
Files
  • python-2.7-no-wsprint.0.patch: patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-01-13.23:19:43.599>
    created_at = <Date 2009-01-02.13:08:01.439>
    labels = ['build', 'OS-windows']
    title = 'wrong wsprintf usage'
    updated_at = <Date 2009-01-13.23:19:43.598>
    user = 'https://bugs.python.org/eckhardt'

    bugs.python.org fields:

    activity = <Date 2009-01-13.23:19:43.598>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-01-13.23:19:43.599>
    closer = 'amaury.forgeotdarc'
    components = ['Windows']
    creation = <Date 2009-01-02.13:08:01.439>
    creator = 'eckhardt'
    dependencies = []
    files = ['12538']
    hgrepos = []
    issue_num = 4807
    keywords = ['patch']
    message_count = 4.0
    messages = ['78790', '79748', '79764', '79789']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'vstinner', 'eckhardt']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue4807'
    versions = ['Python 2.7']

    @eckhardt
    Copy link
    Mannequin Author

    eckhardt mannequin commented Jan 2, 2009

    Note up front: there is a win32 function wsprintf() and an ISO C
    function swprintf(), these are different things in case you wonder.

    In _winreg.c, there are two functions that use wsprintf on a char
    buffer, while the function takes a TCHAR buffer instead. This leads to
    compile warning and runtime errors when _UNICODE is defined, like e.g.
    under MS Windows CE. The attached patch replaces the two calls to that
    function with calls to fprintf() and PyString_FromFormat().

    @eckhardt eckhardt mannequin added OS-windows build The build process and cross-build labels Jan 2, 2009
    @amauryfa
    Copy link
    Member

    The patch seems good.
    This only applies to trunk: py3k already uses PyUnicode_FromFormat.

    @vstinner
    Copy link
    Member

    fprintf() is much better than wsprintf() + fputs() with a fixed size
    buffer (with no size/error check!). Same remark for
    PyString_FromFormat() instead of wsprintf()+PyString_FromString().

    @amauryfa
    Copy link
    Member

    Fixed in r68592.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build OS-windows
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants