Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] for win32 support of snprintf call in src/ctlib/ct.c

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] for win32 support of snprintf call in src/ctlib/ct.c
  • Date: Mon, 8 Feb 2010 23:07:45 -0500

David Dick wrote:
> +#ifdef WIN32
> + *outlen= _snprintf(
> +#else
> + *outlen= snprintf(
> +#endif

Thank you for the patch, but we have to turn it down! Cf.
include/tds_sysdep_private.h for a better way:

#ifdef __MSVCRT__
#define getpid() _getpid()
#define strdup(s) _strdup(s)
#define stricmp(s1,s2) _stricmp(s1,s2)
#define strnicmp(s1,s2,n) _strnicmp(s1,s2,n)
#endif

The test is for using Microsoft's compiler, not Win32, because we're
actually interested in something slightly different: which C Standard
library is being used.

Your patch assumes any Win32 compilation uses Microsoft's library, which
wouldn't be the case with MinGW, for instance. The above test assumes --
rather more safely -- that anyone compiling with Microsoft's compiler is
using their C runtime. (While it's possible to use another
implementation, it's surely rarely done.)

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page