1111
1212#include < Python.h>
1313#include < stdlib.h>
14+ #include < sstream>
1415
1516#include " agg_basics.h"
1617#include " _backend_agg.h"
@@ -50,6 +51,7 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
5051 agg::int8u *destbuffer;
5152 double l,b,r,t;
5253 int destx, desty, destwidth, destheight, deststride;
54+ unsigned long tmp_ptr;
5355
5456 long mode;
5557 long nval;
@@ -71,7 +73,10 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
7173 return TCL_ERROR;
7274 }
7375 /* get array (or object that can be converted to array) pointer */
74- aggo = (PyObject*)atol (argv[2 ]);
76+ std::stringstream agg_ptr_ss;
77+ agg_ptr_ss.str (argv[2 ]);
78+ agg_ptr_ss >> tmp_ptr;
79+ aggo = (PyObject*)tmp_ptr;
7580 RendererAgg *aggRenderer = (RendererAgg *)aggo;
7681 int srcheight = (int )aggRenderer->get_height ();
7782
@@ -85,7 +90,10 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
8590 }
8691
8792 /* check for bbox/blitting */
88- bboxo = (PyObject*)atol (argv[4 ]);
93+ std::stringstream bbox_ptr_ss;
94+ bbox_ptr_ss.str (argv[4 ]);
95+ bbox_ptr_ss >> tmp_ptr;
96+ bboxo = (PyObject*)tmp_ptr;
8997 if (py_convert_bbox (bboxo, l, b, r, t)) {
9098 has_bbox = true ;
9199
0 commit comments