summaryrefslogtreecommitdiffstats
path: root/generic/tkScale.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-03-04 20:36:04 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-03-04 20:36:04 (GMT)
commit7f0376c51034471e24aa2b44dd0b1aec38ef03b0 (patch)
treeda3213735439a29886ea99a4e2acc483c80a2df9 /generic/tkScale.c
parentd7c4676109faa97abf627a58d578ba2c0a40c978 (diff)
downloadtk-7f0376c51034471e24aa2b44dd0b1aec38ef03b0.zip
tk-7f0376c51034471e24aa2b44dd0b1aec38ef03b0.tar.gz
tk-7f0376c51034471e24aa2b44dd0b1aec38ef03b0.tar.bz2
Make the branch build with MSVC by replacing calls to C99 functions round(), fmin() and fmax() by equivalent macros.
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r--generic/tkScale.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 5ed6618..0d9bc10 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -185,6 +185,10 @@ static const Tk_ClassProcs scaleClass = {
NULL, /* createProc */
NULL /* modalProc */
};
+
+#define ROUND(d) ((int) floor((d) + 0.5))
+#define MIN(a, b) ((a) < (b)? (a): (b))
+#define MAX(a, b) ((a) > (b)? (a): (b))
/*
*--------------------------------------------------------------
@@ -790,13 +794,13 @@ MaxTickRoundingError(
int tickCount;
tickPosn = scalePtr->fromValue/tickResolution;
- firstTickError = tickPosn - round(tickPosn);
+ firstTickError = tickPosn - ROUND(tickPosn);
tickPosn = scalePtr->tickInterval/tickResolution;
- intervalError = tickPosn - round(tickPosn);
+ intervalError = tickPosn - ROUND(tickPosn);
tickCount = (int)((scalePtr->toValue-scalePtr->fromValue) /
scalePtr->tickInterval); // not including first
- lastTickError = fmin(fabs(firstTickError + tickCount*intervalError), 0.5);
- return fmax(fabs(firstTickError),lastTickError)*tickResolution;
+ lastTickError = MIN(fabs(firstTickError + tickCount*intervalError), 0.5);
+ return MAX(fabs(firstTickError),lastTickError)*tickResolution;
}