Skip to content

Commit 1e4f787

Browse files
committed
trying scanf for tcl pointer conversion
svn path=/trunk/matplotlib/; revision=5142
1 parent d4965f7 commit 1e4f787

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/_tkagg.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <Python.h>
1313
#include <stdlib.h>
14+
#include <stdio.h>
1415
#include <sstream>
1516

1617
#include "agg_basics.h"
@@ -47,6 +48,8 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
4748

4849
// vars for blitting
4950
PyObject* bboxo;
51+
52+
unsigned long aggl, bboxl;
5053
bool has_bbox;
5154
agg::int8u *destbuffer;
5255
double l,b,r,t;
@@ -73,10 +76,14 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
7376
return TCL_ERROR;
7477
}
7578
/* get array (or object that can be converted to array) pointer */
76-
std::stringstream agg_ptr_ss;
77-
agg_ptr_ss.str(argv[2]);
78-
agg_ptr_ss >> tmp_ptr;
79-
aggo = (PyObject*)tmp_ptr;
79+
sscanf (argv[2],"%lu",&aggl);
80+
aggo = (PyObject*)aggl;
81+
//aggo = (PyObject*)atol(argv[2]);
82+
83+
//std::stringstream agg_ptr_ss;
84+
//agg_ptr_ss.str(argv[2]);
85+
//agg_ptr_ss >> tmp_ptr;
86+
//aggo = (PyObject*)tmp_ptr;
8087
RendererAgg *aggRenderer = (RendererAgg *)aggo;
8188
int srcheight = (int)aggRenderer->get_height();
8289

@@ -90,10 +97,14 @@ PyAggImagePhoto(ClientData clientdata, Tcl_Interp* interp,
9097
}
9198

9299
/* check for bbox/blitting */
93-
std::stringstream bbox_ptr_ss;
94-
bbox_ptr_ss.str(argv[4]);
95-
bbox_ptr_ss >> tmp_ptr;
96-
bboxo = (PyObject*)tmp_ptr;
100+
sscanf (argv[4],"%lu",&bboxl);
101+
bboxo = (PyObject*)bboxl;
102+
103+
//bboxo = (PyObject*)atol(argv[4]);
104+
//std::stringstream bbox_ptr_ss;
105+
//bbox_ptr_ss.str(argv[4]);
106+
//bbox_ptr_ss >> tmp_ptr;
107+
//bboxo = (PyObject*)tmp_ptr;
97108
if (py_convert_bbox(bboxo, l, b, r, t)) {
98109
has_bbox = true;
99110

0 commit comments

Comments
 (0)