summaryrefslogtreecommitdiffstats
path: root/generic/tkImage.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkImage.c')
-rw-r--r--generic/tkImage.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tkImage.c b/generic/tkImage.c
index d42ed7d..54a0fe1 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -13,6 +13,14 @@
#include "tkInt.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
+
/*
* Each call to Tk_GetImage returns a pointer to one of the following
* structures, which is used as a token by clients (widgets) that display
@@ -285,7 +293,7 @@ Tk_ImageObjCmd(
if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) {
do {
dispPtr->imageId++;
- sprintf(idString, "image%d", dispPtr->imageId);
+ snprintf(idString, sizeof(idString), "image%d", dispPtr->imageId);
name = idString;
} while (Tcl_FindCommand(interp, name, NULL, 0) != NULL);
firstOption = 3;