Skip to content

Commit

Permalink
Fix issue #167: windows x64 support in _tkagg.so
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohlke committed Oct 12, 2011
1 parent 8c0251e commit 13384a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/_tkagg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ extern "C"
#endif
}

#if defined(_MSC_VER)
# define SIZE_T_FORMAT "%Iu"
#else
# define SIZE_T_FORMAT "%zu"
#endif



typedef struct
Expand All @@ -53,7 +59,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
// vars for blitting
PyObject* bboxo;

unsigned long aggl, bboxl;
size_t aggl, bboxl;
bool has_bbox;
agg::int8u *destbuffer;
double l, b, r, t;
Expand Down Expand Up @@ -83,7 +89,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
return TCL_ERROR;
}
/* get array (or object that can be converted to array) pointer */
if (sscanf(argv[2], "%lu", &aggl) != 1)
if (sscanf(argv[2], SIZE_T_FORMAT, &aggl) != 1)
{
Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
return TCL_ERROR;
Expand All @@ -109,7 +115,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
}

/* check for bbox/blitting */
if (sscanf(argv[4], "%lu", &bboxl) != 1)
if (sscanf(argv[4], SIZE_T_FORMAT, &bboxl) != 1)
{
Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
return TCL_ERROR;
Expand Down

0 comments on commit 13384a1

Please sign in to comment.