[fltk.development] snprintf() warnings under win32

2009-12-20 Thread Greg Ercolano
Greg Ercolano wrote: >..and complete build output just to show how it worked (and what >warning messages were left) over here: > > BUILD LOG: > > http://seriss.com/people/erco/fltk/tmp/okbuild-6971-win32-vsexpress-2008.txt Just a reminder; the warnings from the WIN32 buil

Re: [fltk.development] snprintf() warnings under win32

2009-12-30 Thread Greg Ercolano
> [..]it seems [the Microsoft] _snprintf() doesn't follow the C99 spec, > so the function apparently works incorrectly [or at least unexpectedly > if you're used to the C99 spec version) on the very > boundary conditions it's supposed to protect us from. eg: The following is a p

Re: [fltk.development] snprintf() warnings under win32

2009-12-30 Thread imacarthur
On 30 Dec 2009, at 19:24, Greg Ercolano wrote: > Solution on win32 is to change _snprintf() to _snprintf_s() > with the _TRUNCATE macro as the third argument. But there's no > clear way to use a macro shortcut to do this (since this is a > varargs function), so a cross pl

Re: [fltk.development] snprintf() warnings under win32

2009-12-30 Thread Greg Ercolano
imacarthur wrote: > On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >> Solution on win32 is to change _snprintf() to _snprintf_s() >> with the _TRUNCATE macro as the third argument. But there's no >> clear way to use a macro shortcut to do this (since this is a >> varargs functio

Re: [fltk.development] snprintf() warnings under win32

2009-12-30 Thread Greg Ercolano
imacarthur wrote: > On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >> Solution on win32 is to change _snprintf() to _snprintf_s() >> with the _TRUNCATE macro as the third argument. But there's no >> clear way to use a macro shortcut to do this (since this is a >> varargs functio

Re: [fltk.development] snprintf() warnings under win32

2009-12-31 Thread imacarthur
On 30 Dec 2009, at 23:14, Greg Ercolano wrote: > > BEFORE: #define SNPRINTF(SS, CC, ...) snprintf(SS, CC, _TRUNCATE, > __VA_ARGS__) > AFTER: #define SNPRINTF(SS, CC, ...) _snprintf_s(SS, CC, > _TRUNCATE, __VA_ARGS__) > ^^^ > > Gotta have tha

Re: [fltk.development] snprintf() warnings under win32

2009-12-31 Thread imacarthur
On 30 Dec 2009, at 23:14, Greg Ercolano wrote: > > ..and the output on win32 was just like linux, making the above code > cross platform compilable: > > Z:\erco\examples\c>.\test-snprintf_s > RET=6, SS='123456': TEST RESULT: OK > RET=7, SS='1234567': TEST RESULT: OK > RET=-1, SS='12345

Re: [fltk.development] snprintf() warnings under win32

2010-01-01 Thread imacarthur
It occurred to me that rather than using the variadic macros solution, we can always (on the win32 platforms) just define our own "snprintf()" wrapper function for _snprintf_s(...), say in Fl_win32.cxx or elsewhere. Then so long as libfltk is linked in before the system libs, "everyone" w

Re: [fltk.development] snprintf() warnings under win32

2010-01-01 Thread imacarthur
On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >> [..]it seems [the Microsoft] _snprintf() doesn't follow the >> C99 spec, >> so the function apparently works incorrectly [or at least >> unexpectedly >> if you're used to the C99 spec version) on the very >> boundary conditions

Re: [fltk.development] snprintf() warnings under win32

2010-01-01 Thread Greg Ercolano
imacarthur wrote: > On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >> Solution on win32 is to change _snprintf() to _snprintf_s() >> with the _TRUNCATE macro as the third argument. But there's no >> clear way to use a macro shortcut to do this (since this is a >> varargs functio

Re: [fltk.development] snprintf() warnings under win32

2010-01-01 Thread Greg Ercolano
imacarthur wrote: > On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >> Solution on win32 is to change _snprintf() to _snprintf_s() >> with the _TRUNCATE macro as the third argument. But there's no >> clear way to use a macro shortcut to do this (since this is a >> varargs functio

Re: [fltk.development] snprintf() warnings under win32

2010-01-01 Thread Albrecht Schlosser
imacarthur wrote: > Just tested this on Vista with mingw, and it fails exactly as Greg's VS > example fails (because mingw mainly just wraps the native system libs in > general.) That's strange. I can't confirm this with WinXP and the cygwin/mingw compiler (neither in cygwin nor in mingw (-mno-

Re: [fltk.development] snprintf() warnings under win32

2010-01-03 Thread imacarthur
On 1 Jan 2010, at 18:16, Greg Ercolano wrote: > imacarthur wrote: >> On 30 Dec 2009, at 19:24, Greg Ercolano wrote: >>> Solution on win32 is to change _snprintf() to _snprintf_s() >>> with the _TRUNCATE macro as the third argument. But there's no >>> clear way to use a macro shortcut

Re: [fltk.development] snprintf() warnings under win32

2010-01-03 Thread imacarthur
On 1 Jan 2010, at 20:32, Albrecht Schlosser wrote: > imacarthur wrote: > >> Just tested this on Vista with mingw, and it fails exactly as >> Greg's VS >> example fails (because mingw mainly just wraps the native system >> libs in >> general.) > > That's strange. I can't confirm this with WinX

Re: [fltk.development] snprintf() warnings under win32

2010-01-03 Thread Albrecht Schlosser
imacarthur wrote: > I acknowledge that we have differing views on this, but I do not believe > that "cygwin -mno-cygwin" is actually the same thing as mingw. > > In particular, I think that the -mno-cygwin option mainly turns off the > use of the "posix emulation" features of cygwin, but I do n

Re: [fltk.development] snprintf() warnings under win32

2010-01-04 Thread Greg Ercolano
>> Then I tried this: >> >> #ifdef _WIN32 >> extern "C" int fl_snprintf(char *, size_t, const char *, ...); >> #define snprintf fl_snprintf >> #endif /*MICROSOFT*/ Hmm, OK, so I guess I'll change my test program to use fl_snprintf. And if that works normally, is it the case the

Re: [fltk.development] snprintf() warnings under win32

2010-01-05 Thread Greg Ercolano
Greg Ercolano wrote: > Hmm, OK, so I guess I'll change my test program to use fl_snprintf. > > And if that works normally, is it the case the fix would be > to modify all fltk calls to snprintf() to call fl_snprintf() > instead? > > Will follow up. In VS 2008, u

Re: [fltk.development] snprintf() warnings under win32

2010-01-05 Thread Greg Ercolano
> [..] because fl_snprintf() appears to be a complete > standalone implementation of snprintf(), so its behavior should be > consistent on all platforms. Actually it's fl_vsnprintf() (emphasis on 'v') that's defined in full. fl_snprintf() is a wrapper function that invokes vsn