Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc7b73e

Browse files
committed
fixes from review
1 parent 4c5dfaa commit cc7b73e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/_tkagg.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#else
2222
# define IMG_FORMAT "%zu %d %d"
2323
#endif
24-
# define BBOX_FORMAT "%f %f %f %f"
24+
#define BBOX_FORMAT "%f %f %f %f"
2525

2626
typedef struct
2727
{
@@ -47,7 +47,7 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
4747
// vars for blitting
4848

4949
size_t pdata;
50-
int wdata, hdata;
50+
int wdata, hdata, bbox_parse;
5151
float x1, x2, y1, y2;
5252
bool has_bbox;
5353
uint8_t *destbuffer, *buffer;
@@ -88,11 +88,15 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
8888
}
8989

9090
/* check for bbox/blitting */
91-
if (sscanf(argv[4], BBOX_FORMAT, &x1, &x2, &y1, &y2) == 4) {
91+
bbox_parse = sscanf(argv[4], BBOX_FORMAT, &x1, &x2, &y1, &y2);
92+
if (bbox_parse == 4) {
9293
has_bbox = true;
9394
}
94-
else {
95+
else if (bbox_parse == 1 && x1 == 0){
9596
has_bbox = false;
97+
} else {
98+
TCL_APPEND_RESULT(interp, "illegal bbox", (char *)NULL);
99+
return TCL_ERROR;
96100
}
97101

98102
if (has_bbox) {

0 commit comments

Comments
 (0)