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

David Dick <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
used the same idea as the snprintf call in src/tds/threadsafe.c

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
freetds_snprintf.patch (text/plain, 1.1 KB)
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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.