@@ -34,6 +34,12 @@ extern "C"
34
34
#endif
35
35
}
36
36
37
+ #if defined(_MSC_VER)
38
+ # define SIZE_T_FORMAT " %Iu"
39
+ #else
40
+ # define SIZE_T_FORMAT " %zu"
41
+ #endif
42
+
37
43
38
44
39
45
typedef struct
@@ -53,7 +59,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
53
59
// vars for blitting
54
60
PyObject* bboxo;
55
61
56
- unsigned long aggl, bboxl;
62
+ size_t aggl, bboxl;
57
63
bool has_bbox;
58
64
agg::int8u *destbuffer;
59
65
double l, b, r, t;
@@ -83,7 +89,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
83
89
return TCL_ERROR;
84
90
}
85
91
/* 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 )
87
93
{
88
94
Tcl_AppendResult (interp, " error casting pointer" , (char *) NULL );
89
95
return TCL_ERROR;
@@ -109,7 +115,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
109
115
}
110
116
111
117
/* check for bbox/blitting */
112
- if (sscanf (argv[4 ], " %lu " , &bboxl) != 1 )
118
+ if (sscanf (argv[4 ], SIZE_T_FORMAT , &bboxl) != 1 )
113
119
{
114
120
Tcl_AppendResult (interp, " error casting pointer" , (char *) NULL );
115
121
return TCL_ERROR;
0 commit comments