2016.05.09 06:48 "[Tiff] snprintf and MSVC 2015", by Mikhail

2016.05.09 19:29 "Re: [Tiff] snprintf and MSVC 2015", by Roger Leigh

On 09/05/2016 17:50, Edward Lam wrote:

On 09/05/2016 11:42 AM, Bob Friesenhahn wrote:

A proper patch suitable for inclusion in libtiff CVS (now that it is back) would be appreciated.

Here you go:

$ cvs diff -u tif_config.vc.h
Index: tif_config.vc.h

=================================================================== RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_config.vc.h,v retrieving revision 1.8

diff -u -r1.8 tif_config.vc.h

--- tif_config.vc.h     21 Jun 2015 17:02:12 -0000      1.8
+++ tif_config.vc.h     9 May 2016 17:49:32 -0000

@@ -107,6 +107,8 @@
  /* Visual Studio 2015 / VC 14 / MSVC 19.00 finally has snprintf() */
  #if defined(_MSC_VER) && _MSC_VER < 1900
  #define snprintf _snprintf
+#else
+#define HAVE_SNPRINTF
  #endif

  /* Define to 1 if your processor stores words with the most significant byte

I have built with and without the patch.

            -patch +patch

nmake      pass    pass
cmake      pass    pass
cmake-gui  pass    pass

nmake: nmake /f Makefile.vc

cmake: "cmake ." then "cmake --build ." then "ctest -C Debug" cmake-gui "cmake-gui", configure (defaults), generate, "cmake --build ." then "ctest -C Debug"

Every build was done in a pristine checkout of libtiff CVS.

While I can't see that the patch does any harm, I don't see it doing anything good either--for me it builds and passes all the tests with or without it.

It would be useful to know what exactly HAVE_SNPRINTF is set to for these failing builds I can't reproduce.

- is it undefined, or set to a value

- should the above patch be undef'ing it if defined rather than defining to nothing?

I would certainly like to understand why you're seeing failure here to fully understand why this is the correct solution. A complete transcript of the cmake run and build and/or the nmake build might shed some light, along with any generated headers. If you could do that for the three build types listed above, that would be quite useful.

Regards,
Roger