Re: sprintf to snprintf conversion

William S Fulton <[email protected]> Thu, 30 Mar 2023 18:37:45 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <CANGqftCwCvC5CbN44Of7CEqVOVOKdRRZ+tJV2y3KfoYxtNqUDA@mail.gmail.com>
On Sun, 19 Feb 2023 at 23:37, Rob McDonald <[email protected]> wrote:

> Recent versions of clang / xcode have deprecated sprintf to the point
> where the warning messages are getting overwhelming (nine long lines of
> output for each occurrence).
>
> Some of these appear in SWIG generated code (Python wrapping) in my
> project.  It would be great if SWIG could change calls from
> sprintf(str,….); to snprintf(str,sizeof(str),…);
>
> It would also be great if you received the return code and handled errors,
> but even without that, the code should be safer than it is now – and the
> warnings will go away.
>
> I see calls to sprintf in 'setslice' and 'SwigPySequence_Ref'
>

This usage of sprintf in the Python wrappers has been refactored for the
next release. See https://github.com/swig/swig/issues/2502 for details of
sprintf on OSX.

William

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user