Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-04-30 Thread Pali Rohár
On Friday 21 February 2020 17:22:13 Pali Rohár wrote: > On Friday 21 February 2020 18:17:37 Liu Hao wrote: > > 在 2020/2/21 2:27, Pali Rohár 写道: > > > Hello! Based on raymod2 suggestion on IRC, I prepared full patch and > > > tested it that snprintf() and vsnprintf() works correctly. > > > > > > Pa

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-23 Thread Liu Hao
在 2020/2/23 6:06, Martin Storsjö 写道: > While they are "wrong" in that sense, this now means that there is no > symbol "snprintf" defined at all, which does break compilation of a > number of projects. (That primarily happens within configure scripts of > certain projects, that try to detect if "snp

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-23 Thread Martin Storsjö
On Sun, 23 Feb 2020, Pali Rohár wrote: On Sunday 23 February 2020 22:37:43 Martin Storsjö wrote: On Sat, 22 Feb 2020, Pali Rohár wrote: Also another detail I noticed in your patch: diff --git a/mingw-w64-crt/stdio/snprintf.c b/mingw-w64-crt/stdio/snprintf.c index 93300113..0bb5556f 100644 -

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-23 Thread Martin Storsjö
On Sat, 22 Feb 2020, Pali Rohár wrote: Also another detail I noticed in your patch: diff --git a/mingw-w64-crt/stdio/snprintf.c b/mingw-w64-crt/stdio/snprintf.c index 93300113..0bb5556f 100644 --- a/mingw-w64-crt/stdio/snprintf.c +++ b/mingw-w64-crt/stdio/snprintf.c @@ -12,7 +12,27 @@ int __cd

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-22 Thread Liu Hao
在 2020/2/23 6:06, Martin Storsjö 写道: > On Thu, 20 Feb 2020, Pali Rohár wrote: > > While they are "wrong" in that sense, this now means that there is no > symbol "snprintf" defined at all, which does break compilation of a > number of projects. (That primarily happens within configure scripts of >

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-22 Thread Liu Hao
在 2020/2/23 6:06, Martin Storsjö 写道: > On Thu, 20 Feb 2020, Pali Rohár wrote: > > While they are "wrong" in that sense, this now means that there is no > symbol "snprintf" defined at all, which does break compilation of a > number of projects. (That primarily happens within configure scripts of >

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-22 Thread Martin Storsjö
On Thu, 20 Feb 2020, Pali Rohár wrote: In patch I also removed vsnprintf == _vsnprintf and snprintf == _snprintf aliases as they wrong, snprintf() is not same as msvcrt's _snprintf() function, and above __ms_snprintf() or __ms_vsnprintf() wrapper is needed. While they are "wrong" in that sense

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-22 Thread Liu Hao
在 2020/2/22 18:34, Pali Rohár 写道: > On Friday 21 February 2020 17:22:13 Pali Rohár wrote: > > Hello! raymod2 on IRC pointed that _vscprintf() function used by above > patch is not provided by original VC6 msvcrt.dll library. It was > introduced in VC7 msvcr70.dll, but in may be provided in system32

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-21 Thread Liu Hao
在 2020/2/21 2:27, Pali Rohár 写道: > Hello! Based on raymod2 suggestion on IRC, I prepared full patch and > tested it that snprintf() and vsnprintf() works correctly. > > Patch is attached in email as jon_y on IRC suggested. I fixed directly > __ms_snprintf() and __ms_vsnprintf() wrappers (around ms

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-20 Thread Pali Rohár
Hello! Based on raymod2 suggestion on IRC, I prepared full patch and tested it that snprintf() and vsnprintf() works correctly. Patch is attached in email as jon_y on IRC suggested. I fixed directly __ms_snprintf() and __ms_vsnprintf() wrappers (around msvcrt's _snprintf()/_vsnprintf() calls) whic

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2020-02-20 Thread Pali Rohár
Hello! Year ago I sent this email about snprintf() problem in mingw-w64 but I have not received any response yet. For one week I tried to contact mingw-w64 developers on IRC #mingw-w64, but nobody replied, so now I do not know if there are some active people in mingw-w64 project or not... Just re

Re: [Mingw-w64-public] snprintf() is broken in mingw-w64

2019-05-17 Thread sisyphus
Hi, Alternatively, you can compile the program with -D__USE_MINGW_ANSI_STDIO : C:\_32\C>type try.c /* try.c */ #include int main() { char buf[5] = ""; int ret = snprintf(buf, 3, "%d", 123456789); printf("buf=%s ret=%d\n", buf, ret); return 0; } C:\_32\C>gcc -o try.exe try

[Mingw-w64-public] snprintf() is broken in mingw-w64

2019-05-10 Thread Pali Rohár
Hello! snprintf() function in mingw-w64 is broken. Seems that it just calls MSVC's _snprintf() function which is not same as snprintf(). MSVC until ucrt does not provide snprintf() at all, just _snprintf(). Differences are that MSVC's _snrpintf() does not ensure that filled buffer would be null-t