summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvText.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-04 14:51:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-04 14:51:24 (GMT)
commit17b29d382d70ebd534f9f06c1f0f575dbfb978ae (patch)
tree9eaf3c44a18f946e1aaa8c3584f023b178aec42a /generic/tkCanvText.c
parent9ad55137f6cdb5570ddd58f92495fb651daf4d16 (diff)
parent3eb69aee6980150b2fabbaaab9c5bb154af74d02 (diff)
downloadtk-17b29d382d70ebd534f9f06c1f0f575dbfb978ae.zip
tk-17b29d382d70ebd534f9f06c1f0f575dbfb978ae.tar.gz
tk-17b29d382d70ebd534f9f06c1f0f575dbfb978ae.tar.bz2
Fix [6cc8002951]: numeric parameter errors depending on whether string vs double/int rep
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r--generic/tkCanvText.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index aaf7c14..185d4a4 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1502,18 +1502,23 @@ GetTextIndex(
} else if (c == '@') {
int x, y;
double tmp, cs = textPtr->cosine, s = textPtr->sine;
- char *end;
+ char *rest;
const char *p;
p = string+1;
- tmp = strtod(p, &end);
- if ((end == p) || (*end != ',')) {
+ rest = strchr(p, ',');
+ if (!rest) {
goto badIndex;
}
+ *rest = '\0';
+ if (Tcl_GetDouble(NULL, p, &tmp) != TCL_OK) {
+ *rest = ',';
+ goto badIndex;
+ }
+ *rest = ',';
x = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5);
- p = end+1;
- tmp = strtod(p, &end);
- if ((end == p) || (*end != 0)) {
+ p = rest+1;
+ if (Tcl_GetDouble(NULL, p, &tmp) != TCL_OK) {
goto badIndex;
}
y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5);