@@ -34,6 +34,12 @@ extern "C"
3434#endif
3535}
3636
37+ #if defined(_MSC_VER)
38+ # define SIZE_T_FORMAT " %Iu"
39+ #else
40+ # define SIZE_T_FORMAT " %zu"
41+ #endif
42+
3743
3844
3945typedef struct
@@ -53,7 +59,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
5359 // vars for blitting
5460 PyObject* bboxo;
5561
56- unsigned long aggl, bboxl;
62+ size_t aggl, bboxl;
5763 bool has_bbox;
5864 agg::int8u *destbuffer;
5965 double l, b, r, t;
@@ -83,7 +89,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
8389 return TCL_ERROR;
8490 }
8591 /* get array (or object that can be converted to array) pointer */
86- if (sscanf (argv[2 ], " %lu " , &aggl) != 1 )
92+ if (sscanf (argv[2 ], SIZE_T_FORMAT , &aggl) != 1 )
8793 {
8894 Tcl_AppendResult (interp, " error casting pointer" , (char *) NULL );
8995 return TCL_ERROR;
@@ -109,7 +115,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
109115 }
110116
111117 /* check for bbox/blitting */
112- if (sscanf (argv[4 ], " %lu " , &bboxl) != 1 )
118+ if (sscanf (argv[4 ], SIZE_T_FORMAT , &bboxl) != 1 )
113119 {
114120 Tcl_AppendResult (interp, " error casting pointer" , (char *) NULL );
115121 return TCL_ERROR;
0 commit comments