summaryrefslogtreecommitdiffstats
path: root/win/tkWinButton.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinButton.c')
-rw-r--r--win/tkWinButton.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 4e965c2..ebf0ec6 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -14,6 +14,14 @@
#include "tkWinInt.h"
#include "tkButton.h"
+#ifdef _MSC_VER
+/*
+ * Earlier versions of MSVC don't know snprintf, but _snprintf is compatible.
+ * Note that sprintf is deprecated.
+ */
+# define snprintf _snprintf
+#endif
+
/*
* These macros define the base style flags for the different button types.
*/
@@ -186,7 +194,7 @@ TkpButtonSetDefaults(void)
{
int width = GetSystemMetrics(SM_CXEDGE);
if (width > 0) {
- sprintf(tkDefButtonBorderWidth, "%d", width);
+ snprintf(tkDefButtonBorderWidth, sizeof(tkDefButtonBorderWidth), "%d", width);
}
}