Summary: | Compile error on Solaris 8 - spectrum.cpp uses round() which is not available | ||
---|---|---|---|
Product: | [Applications] kalzium | Reporter: | Steve Evans <stevee> |
Component: | general | Assignee: | Kalzium Developers <kalzium> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Steve Evans
2005-10-21 14:44:02 UTC
kalziumutils.cpp and spectrumwidget.cpp suffer from the same problem 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 |