On 13/10/2017 20:48, Selva wrote:
> Hi,
> 
> On Fri, Oct 13, 2017 at 12:55 AM, Simon Rozman <si...@rozman.si
> <mailto:si...@rozman.si>> wrote:
> ...
> 
> 
>     > As said above, I would have replaced all _snwprintf and snwprintf by
>     > swprintf
>     > and avoided the #define. That has the added advantage that mingw builds
>     > also will no longer depend on the non-standard snwprintf.
> 
>     Are you sure MinGW supports swprintf() in an ISO C conformant way?
>     People all
>     over the web complain about MinGW's non-ISO C conformant swprintf()
>     declaration being a legacy of VC 6.0 runtime library used:
>     https://stackoverflow.com/questions/35072373/swprintf-declaration-mismatch
>     
> <https://stackoverflow.com/questions/35072373/swprintf-declaration-mismatch>
>     As said before, I am not familiar with MinGW. I read OpenVPN has a
>     patched
>     version of it. Perhaps you moved to a more recent VC runtime library
>     meanwhile. 
> 
> 
>     If we change _snwprintf/snwprintf() to swprintf() as you suggested, I am
>     afraid OpenVPN would not compile on MinGW anymore without #define
>     tweaks. But,
>     this time MinGW will need them, not MSVC*2017*.
> 
> 
> There are two issues here: sprintf signature in Windows runtime and
> mingw-w64's  support for the standard conforming variant.
> 
> @samuli: Which versions of mingw-w64 should we test against to ensure
> release and snapshot builds would succeed?

Right now _we_ use Ubuntu 16.04 for building:

  mingw-w64 4.0.4
  gcc-mingw-w64 5.3.1
  g++-mingw-w64 5.3.1

That said, I'm pretty sure many people still build with Ubuntu 14.04. So
keeping support for it would make sense if it is not horribly painful.
This is what Ubuntu 14.04 comes with:

  mingw-w64 3.1.0
  gcc-mingw-w64 4.8.2
  g++-mingw-w64 4.8.2

Samuli

> 
> Windows runtime used to have an swprintf that does not take the buffer 
> size. But to get that non-conformant behaviour you will need some
> preprocessor define like ....NON_CONFORMING_SWPRINTF... so hopefully
> modern VS installations does pick the right function. 
> 
> As for mingw, note that I use mingw-w64, not the older one
> from mingw.org <http://mingw.org>.
> In the former, my understanding is that an implementation based on 
> _vsnwprintf is used unless the above NON_CONFORMING.. define is active.
> 
> Probably there are some old mingw releases where this was broken --- 
> I'll test your latest patch. That said, I would not depend on any of these
> for nul-termination, we should continue to append an explicit L'\0'.
> 
> Selva

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to