On Sun, May 16, 2021 at 11:58 AM Liu Hao <[email protected]> wrote:
> Who was it that added the `#define`? Users should have known that `_snprintf` 
> does not
> null-terminate the output string if there is no enough room in the output 
> buffer, which is rather
> dangerous.

Some projects I've seen it in: gimp, silc-toolkit, libconfig, emacs

I agree that it is wrong and we are patching things to not use
_snprintf. On the one hand it exposes likely
bugs on the other it is not behaving like with msvcrt. I'm not 100%
sure what the right call here is.

Here is the resulting error btw (which is somewhat confusing at first):

In file included from D:/a/_temp/msys/msys64/ucrt64/include/libintl.h:314,
                 from
D:/a/_temp/msys/msys64/ucrt64/include/glib-2.0/glib/gi18n.h:23,
                 from ../script-fu-intl.h:28,
                 from scheme.c:49:
D:/a/_temp/msys/msys64/ucrt64/x86_64-w64-mingw32/include/stdio.h:746:15:
error: redefinition of '_snprintf'
  746 |   int __cdecl _snprintf(char * __restrict__ _Dest,size_t
_Count,const char * __restrict__ _Format,...)
      |               ^~~~~~~~~
scheme.c:35:18: note: previous definition of '_snprintf' was here
   35 | #define snprintf _snprintf
      |                  ^~~~~~~~~
scheme.c: In function 'alloc_cellseg':


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to