Skip to Content.
Sympa Menu

freetds - [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: David Dick <ddick AT cpan.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] [PATCH] for win32 support of snprintf call in src/ctlib/ct.c
  • Date: Tue, 09 Feb 2010 09:33:46 +1100

used the same idea as the snprintf call in src/tds/threadsafe.c
diff -Naur old/src/ctlib/ct.c new/src/ctlib/ct.c
--- old/src/ctlib/ct.c 2008-05-06 13:23:45.000000000 +1000
+++ new/src/ctlib/ct.c 2010-02-09 09:00:53.000000000 +1100
@@ -2430,7 +2430,12 @@
case CS_GET: {
if (buffer && buflen > 0 && outlen) {
const TDS_COMPILETIME_SETTINGS
*settings= tds_get_compiletime_settings();
- *outlen= snprintf((char*)buffer,
buflen, "%s (%s, default tds version=%s)",
+#ifdef WIN32
+ *outlen= _snprintf(
+#else
+ *outlen= snprintf(
+#endif
+ (char*)buffer, buflen, "%s
(%s, default tds version=%s)",
settings->freetds_version,
(settings->threadsafe ?
"threadsafe" : "non-threadsafe"),
settings->tdsver
@@ -2454,7 +2459,11 @@
case CS_GET: {
if (buffer && buflen > 0 && outlen) {
const TDS_COMPILETIME_SETTINGS
*settings= tds_get_compiletime_settings();
+#ifdef WIN32
+ *outlen= _snprintf(buffer, buflen,
"%s", settings->freetds_version);
+#else
*outlen= snprintf(buffer, buflen,
"%s", settings->freetds_version);
+#endif
((char*)buffer)[buflen - 1]= 0;
if (*outlen < 0)
*outlen = strlen((char*)
buffer);



Archive powered by MHonArc 2.6.24.

Top of Page