Browse Source

resolve ambiguous log() overload

log() may accept `float` or `double` for C++, so passing `int` is ambiguous.
Change to exactly pass valiables as `double` to log(), it is expected here.

Signed-off-by: OBATA Akio <obache@wizdas.com>
OBATA Akio 1 month ago
parent
commit
28d80743c0
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      kcontrol/access/kcmaccess.cpp

+ 7
- 7
kcontrol/access/kcmaccess.cpp View File

@@ -63,13 +63,13 @@ void ExtendedIntNumInput::setRange(int min, int max, int step, bool slider) {
63 63
 		this->min = min;
64 64
 		this->max = max;
65 65
 		sliderMax = (int)floor (0.5
66
-				+ 2*(log(max)-log(min)) / (log(max)-log(max-1)));
66
+				+ 2*(log((double)max)-log((double)min)) / (log((double)max)-log((double)max-1)));
67 67
 		m_slider->setRange(0, sliderMax);
68 68
 		m_slider->setSteps(step, sliderMax/10);
69 69
 		m_slider->setTickInterval(sliderMax/10);
70 70
 
71
-		double alpha  = sliderMax / (log(max) - log(min));
72
-		double logVal = alpha * (log(value())-log(min));
71
+		double alpha  = sliderMax / (log((double)max) - log((double)min));
72
+		double logVal = alpha * (log((double)value())-log((double)min));
73 73
 		m_slider->setValue ((int)floor (0.5 + logVal));
74 74
 
75 75
 		connect(m_slider, TQT_SIGNAL(valueChanged(int)),
@@ -86,8 +86,8 @@ void ExtendedIntNumInput::slotSpinValueChanged(int val)
86 86
 {
87 87
 
88 88
 	if(m_slider) {
89
-		double alpha  = sliderMax / (log(max) - log(min));
90
-		double logVal = alpha * (log(val)-log(min));
89
+		double alpha  = sliderMax / (log((double)max) - log((double)min));
90
+		double logVal = alpha * (log((double)val)-log((double)min));
91 91
 		m_slider->setValue ((int)floor (0.5 + logVal));
92 92
 	}
93 93
 
@@ -96,8 +96,8 @@ void ExtendedIntNumInput::slotSpinValueChanged(int val)
96 96
 
97 97
 void ExtendedIntNumInput::slotSliderValueChanged(int val)
98 98
 {
99
-	double alpha  = sliderMax / (log(max) - log(min));
100
-	double linearVal = exp (val/alpha + log(min));
99
+	double alpha  = sliderMax / (log((double)max) - log((double)min));
100
+	double linearVal = exp (val/alpha + log((double)min));
101 101
 	m_spin->setValue ((int)floor(0.5 + linearVal));
102 102
 }
103 103
 

Loading…
Cancel
Save