[Kalzium] [Bug 114813] Compile error on Solaris 8 - spectrum.cpp uses round() which is not available

Albert Astals Cid tsdgeos at terra.es
Sun Oct 23 17:34:16 CEST 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=114813         
tsdgeos terra es changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From tsdgeos terra es  2005-10-23 17:34 -------
SVN commit 473393 by aacid:

round() -> qRound()
BUGS: 114813


 M  +1 -1      kalziumutils.cpp  
 M  +1 -1      spectrum.cpp  
 M  +3 -18     spectrumwidget.cpp  
 M  +0 -2      spectrumwidget.h  


--- branches/KDE/3.5/kdeedu/kalzium/src/kalziumutils.cpp #473392:473393
 @ -63,7 +63,7  @
 		power *= 10;
 
 	num = num / power * 10000;
-	num = round( num );
+	num = qRound( num );
 
 	return num * power / 10000;
 }
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrum.cpp #473392:473393
 @ -97,7 +97,7  @
 		double curInt = ( ( double )( *it ).intensity );
 		
 		double newInt = max*1000/curInt;
-		( *it ).intensity = ( int ) round( newInt );
+		( *it ).intensity = qRound( newInt );
 	}
 }
 
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrumwidget.cpp #473392:473393
 @ -21,6 +21,7  @
 #include "spectrumwidget.h"
 #include "spectrum.h"
 #include "element.h"
+#include "kalziumutils.h"
 
 #include <kdebug.h>
 #include <klocale.h>
 @ -216,7 +217,7  @
 	if ( color == 0.0 )
 		return 0;
 	else
-		return ( int )( round( IntensityMax * pow( color*factor, Gamma ) ) );
+		return qRound( IntensityMax * pow( color*factor, Gamma ) );
 }
 
 void SpectrumWidget::drawTickmarks( QPainter* p )
 @ -243,7 +244,7  @
 			{
 				pos = ( double ) ( i*d )/width();
 				p->fillRect( i*d-space, m_realHeight+12, 2*space, 15, Qt::white );
-				p->drawText( i*d-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( strippedValue( Wavelength( pos ) ) ) );
+				p->drawText( i*d-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( KalziumUtils::strippedValue( Wavelength( pos ) ) ) );
 			}
 		}
 		else {//small tickmarks
 @ -252,22 +253,6  @
 	}
 }
 
-double SpectrumWidget::strippedValue( double num )
-{
-	if ( !finite( num ) )
-		return num;
-
-	double power;
-	power = 1e-6;
-	while ( power < num )
-		power *= 10;
-
-	num = num / power * 10000;
-	num = round( num );
-
-	return num * power / 10000;
-}
-
 void SpectrumWidget::keyPressEvent( QKeyEvent *e )
 {
 	 kdDebug() << "SpectrumWidget::keyPressEvent()" << endl;
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrumwidget.h #473392:473393
 @ -141,8 +141,6  @
 			return startValue + (  (  endValue-startValue ) *  xpos );
 		}
 
-		double strippedValue( double num );
-
 		/**
 		 * This method changes the three values  p r,  p g and  p b to the
 		 * correct values


More information about the Kalzium mailing list