Skip to content
Permalink
Browse files

renamed doubleNear to qgsDoubleNear, QgsMalloc to qgsMalloc, QgsCallo…

…c to qgsCalloc, QgsFree to qgsFree
  • Loading branch information
blazek committed Apr 12, 2013
1 parent 19377fb commit f40e3a6fea1665da29d195e6c0a2a221a00c92c9
Showing with 150 additions and 150 deletions.
  1. +1 −1 src/analysis/raster/qgsrastercalculator.cpp
  2. +1 −1 src/analysis/raster/qgsrelief.cpp
  3. +3 −3 src/analysis/vector/qgsgeometryanalyzer.cpp
  4. +2 −2 src/app/composer/qgscompositionwidget.cpp
  5. +2 −2 src/app/qgsdecorationgrid.cpp
  6. +2 −2 src/app/qgsmaptoolsimplify.cpp
  7. +1 −1 src/core/composer/qgscomposeritem.cpp
  8. +2 −2 src/core/composer/qgscomposermap.cpp
  9. +8 −8 src/core/composer/qgscomposition.cpp
  10. +4 −4 src/core/qgis.cpp
  11. +5 −5 src/core/qgis.h
  12. +20 −20 src/core/qgsclipper.cpp
  13. +1 −1 src/core/qgsclipper.h
  14. +1 −1 src/core/qgscoordinatereferencesystem.cpp
  15. +1 −1 src/core/qgspoint.cpp
  16. +1 −1 src/core/raster/qgsmultibandcolorrenderer.cpp
  17. +10 −10 src/core/raster/qgsrasterblock.cpp
  18. +1 −1 src/core/raster/qgsrasterblock.h
  19. +2 −2 src/core/raster/qgsrasterdataprovider.cpp
  20. +7 −7 src/core/raster/qgsrasterfilewriter.cpp
  21. +4 −4 src/core/raster/qgsrasterinterface.cpp
  22. +1 −1 src/core/raster/qgsrasterlayer.cpp
  23. +2 −2 src/core/raster/qgsrasternuller.cpp
  24. +2 −2 src/core/raster/qgsrasterrange.cpp
  25. +2 −2 src/core/raster/qgsrasterrenderer.cpp
  26. +1 −1 src/core/raster/qgsrasterresamplefilter.cpp
  27. +7 −7 src/core/raster/qgsrastertransparency.cpp
  28. +1 −1 src/core/raster/qgssinglebandgrayrenderer.cpp
  29. +6 −6 src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
  30. +9 −9 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  31. +1 −1 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  32. +3 −3 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  33. +2 −2 src/core/symbology-ng/qgssvgcache.cpp
  34. +7 −7 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  35. +2 −2 src/gui/qgscomposerruler.cpp
  36. +1 −1 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  37. +1 −1 src/plugins/diagram_overlay/qgspiediagramfactory.cpp
  38. +1 −1 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  39. +8 −8 src/providers/gdal/qgsgdalprovider.cpp
  40. +1 −1 src/providers/grass/qgsgrassrasterprovider.cpp
  41. +10 −10 src/providers/wcs/qgswcsprovider.cpp
  42. +1 −1 src/providers/wfs/qgswfsprovider.cpp
  43. +2 −2 tests/src/core/testqgsrastersublayer.cpp
@@ -389,7 +389,7 @@ bool QgsRasterCalculator::transformationsEqual( double* t1, double* t2 ) const
{
for ( int i = 0; i < 6; ++i )
{
if ( !doubleNear( t1[i], t2[i], 0.00001 ) )
if ( !qgsDoubleNear( t1[i], t2[i], 0.00001 ) )
{
return false;
}
@@ -715,7 +715,7 @@ void QgsRelief::optimiseClassBreaks( QList<int>& breaks, double* frequencies )
continue;
}

if ( doubleNear( a[i - 1 ], a[i] ) )
if ( qgsDoubleNear( a[i - 1 ], a[i] ) )
{
continue;
}
@@ -1471,7 +1471,7 @@ void QgsGeometryAnalyzer::locateAlongSegment( double x1, double y1, double m1, d
}

//match with vertex1
if ( doubleNear( m1, measure, tolerance ) )
if ( qgsDoubleNear( m1, measure, tolerance ) )
{
if ( reversed )
{
@@ -1486,7 +1486,7 @@ void QgsGeometryAnalyzer::locateAlongSegment( double x1, double y1, double m1, d
}

//match with vertex2
if ( doubleNear( m2, measure, tolerance ) )
if ( qgsDoubleNear( m2, measure, tolerance ) )
{
if ( reversed )
{
@@ -1507,7 +1507,7 @@ void QgsGeometryAnalyzer::locateAlongSegment( double x1, double y1, double m1, d
}

//match between the vertices
if ( doubleNear( m1, m2 ) )
if ( qgsDoubleNear( m1, m2 ) )
{
pt1.setX( x1 );
pt1.setY( y1 );
@@ -361,8 +361,8 @@ void QgsCompositionWidget::displayCompositionWidthHeight()
QgsCompositionPaper currentPaper = paper_it.value();

//consider width and height values may be exchanged
if (( doubleNear( currentPaper.mWidth, paperWidth ) && doubleNear( currentPaper.mHeight, paperHeight ) )
|| ( doubleNear( currentPaper.mWidth, paperHeight ) && doubleNear( currentPaper.mHeight, paperWidth ) ) )
if (( qgsDoubleNear( currentPaper.mWidth, paperWidth ) && qgsDoubleNear( currentPaper.mHeight, paperHeight ) )
|| ( qgsDoubleNear( currentPaper.mWidth, paperHeight ) && qgsDoubleNear( currentPaper.mHeight, paperWidth ) ) )
{
mPaperSizeComboBox->setCurrentIndex( mPaperSizeComboBox->findText( paper_it.key() ) );
found = true;
@@ -541,7 +541,7 @@ int QgsDecorationGrid::xGridLines( QList< QPair< double, QLineF > >& lines, QPai
double roundCorrection = mapBoundingRect.top() > 0 ? 1.0 : 0.0;
double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + roundCorrection ) * mGridIntervalY + mGridOffsetY;

// if ( doubleNear( mRotation, 0.0 ) )
// if ( qgsDoubleNear( mRotation, 0.0 ) )
// {
//no rotation. Do it 'the easy way'

@@ -610,7 +610,7 @@ int QgsDecorationGrid::yGridLines( QList< QPair< double, QLineF > >& lines, QPai
double roundCorrection = mapBoundingRect.left() > 0 ? 1.0 : 0.0;
double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + roundCorrection ) * mGridIntervalX + mGridOffsetX;

// if ( doubleNear( mRotation, 0.0 ) )
// if ( qgsDoubleNear( mRotation, 0.0 ) )
// {
// //no rotation. Do it 'the easy way'
double xCanvasCoord;
@@ -216,7 +216,7 @@ bool QgsMapToolSimplify::calculateSliderBoudaries()
bottomFound = true;
highTol = tol;
tol = ( highTol + lowTol ) / 2;
if ( doubleNear( highTol, lowTol, 0.0001 ) ) // without 0.0001 tolerance sometimes an endless loop in epsg:4326
if ( qgsDoubleNear( highTol, lowTol, 0.0001 ) ) // without 0.0001 tolerance sometimes an endless loop in epsg:4326
{ //solving problem that two points are in same distance from line, so they will be both excluded at same time
//so some time more than required count of vertices can stay
found = true;
@@ -230,7 +230,7 @@ bool QgsMapToolSimplify::calculateSliderBoudaries()
{
lowTol = tol;
tol = ( highTol + lowTol ) / 2;
if ( doubleNear( highTol, lowTol, 0.0001 ) ) // without 0.0001 tolerance sometimes an endless loop in epsg:4326
if ( qgsDoubleNear( highTol, lowTol, 0.0001 ) ) // without 0.0001 tolerance sometimes an endless loop in epsg:4326
{ //solving problem that two points are in same distance from line, so they will be both excluded at same time
//so some time more than required count of vertices can stay
found = true;
@@ -1110,7 +1110,7 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
return true;
}

if ( doubleNear( qAbs( mRotation ), 90 ) || doubleNear( qAbs( mRotation ), 270 ) )
if ( qgsDoubleNear( qAbs( mRotation ), 90 ) || qgsDoubleNear( qAbs( mRotation ), 270 ) )
{
double tmp = width;
width = height;
@@ -1344,7 +1344,7 @@ int QgsComposerMap::xGridLines( QList< QPair< double, QLineF > >& lines ) const
double roundCorrection = mapBoundingRect.top() > 0 ? 1.0 : 0.0;
double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + roundCorrection ) * mGridIntervalY + mGridOffsetY;

if ( doubleNear( mRotation, 0.0 ) )
if ( qgsDoubleNear( mRotation, 0.0 ) )
{
//no rotation. Do it 'the easy way'

@@ -1412,7 +1412,7 @@ int QgsComposerMap::yGridLines( QList< QPair< double, QLineF > >& lines ) const
double roundCorrection = mapBoundingRect.left() > 0 ? 1.0 : 0.0;
double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + roundCorrection ) * mGridIntervalX + mGridOffsetX;

if ( doubleNear( mRotation, 0.0 ) )
if ( qgsDoubleNear( mRotation, 0.0 ) )
{
//no rotation. Do it 'the easy way'
double xCanvasCoord;
@@ -1277,7 +1277,7 @@ QGraphicsLineItem* QgsComposition::nearestSnapLine( bool horizontal, double x, d
QList< QGraphicsLineItem* >::const_iterator it = mSnapLines.constBegin();
for ( ; it != mSnapLines.constEnd(); ++it )
{
bool itemHorizontal = doubleNear(( *it )->line().y2() - ( *it )->line().y1(), 0 );
bool itemHorizontal = qgsDoubleNear(( *it )->line().y2() - ( *it )->line().y1(), 0 );
if ( horizontal && itemHorizontal )
{
currentYCoord = ( *it )->line().y1();
@@ -1312,30 +1312,30 @@ QGraphicsLineItem* QgsComposition::nearestSnapLine( bool horizontal, double x, d

if ( horizontal )
{
if ( doubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().top(), itemTolerance ) )
if ( qgsDoubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().top(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::UpperMiddle ) );
}
else if ( doubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().center().y(), itemTolerance ) )
else if ( qgsDoubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().center().y(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::Middle ) );
}
else if ( doubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().bottom(), itemTolerance ) )
else if ( qgsDoubleNear( currentYCoord, currentItem->transform().dy() + currentItem->rect().bottom(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::LowerMiddle ) );
}
}
else
{
if ( doubleNear( currentXCoord, currentItem->transform().dx(), itemTolerance ) )
if ( qgsDoubleNear( currentXCoord, currentItem->transform().dx(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::MiddleLeft ) );
}
else if ( doubleNear( currentXCoord, currentItem->transform().dx() + currentItem->rect().center().x(), itemTolerance ) )
else if ( qgsDoubleNear( currentXCoord, currentItem->transform().dx() + currentItem->rect().center().x(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::Middle ) );
}
else if ( doubleNear( currentXCoord, currentItem->transform().dx() + currentItem->rect().width(), itemTolerance ) )
else if ( qgsDoubleNear( currentXCoord, currentItem->transform().dx() + currentItem->rect().width(), itemTolerance ) )
{
snappedItems.append( qMakePair( currentItem, QgsComposerItem::MiddleRight ) );
}
@@ -2038,7 +2038,7 @@ void QgsComposition::collectAlignCoordinates( QMap< double, const QgsComposerIte
{
double x = ( *sIt )->line().x1();
double y = ( *sIt )->line().y1();
if ( doubleNear( y, 0.0 ) )
if ( qgsDoubleNear( y, 0.0 ) )
{
alignCoordsX.insert( x, 0 );
}
@@ -108,7 +108,7 @@ QString QGis::tr( QGis::UnitType unit )
return QCoreApplication::translate( "QGis::UnitType", qPrintable( toLiteral( unit ) ) );
}

void *QgsMalloc( size_t size )
void *qgsMalloc( size_t size )
{
if ( size == 0 || long( size ) < 0 )
{
@@ -123,22 +123,22 @@ void *QgsMalloc( size_t size )
return p;
}

void *QgsCalloc( size_t nmemb, size_t size )
void *qgsCalloc( size_t nmemb, size_t size )
{
if ( nmemb == 0 || long( nmemb ) < 0 || size == 0 || long( size ) < 0 )
{
QgsDebugMsg( QString( "Negative or zero nmemb %1 or size %2." ).arg( nmemb ).arg( size ) );
return NULL;
}
void *p = QgsMalloc( nmemb * size );
void *p = qgsMalloc( nmemb * size );
if ( p != NULL )
{
memset( p, 0, nmemb * size );
}
return p;
}

void QgsFree( void *ptr )
void qgsFree( void *ptr )
{
free( ptr );
}
@@ -246,7 +246,7 @@ inline void ( *cast_to_fptr( void *p ) )()
//
// compare two doubles (but allow some difference)
//
inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
{
const double diff = a - b;
return diff > -epsilon && diff <= epsilon;
@@ -255,7 +255,7 @@ inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
//
// compare two doubles using specified number of significant digits
//
inline bool doubleNearSig( double a, double b, int significantDigits = 10 )
inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
{
// The most simple would be to print numbers as %.xe and compare as strings
// but that is probably too costly
@@ -278,20 +278,20 @@ bool qgsVariantGreaterThan( const QVariant& lhs, const QVariant& rhs );
Works like C malloc() but prints debug message by QgsLogger if allocation fails.
@param size size in bytes
*/
void CORE_EXPORT *QgsMalloc( size_t size );
void CORE_EXPORT *qgsMalloc( size_t size );

/** Allocates memory for an array of nmemb elements of size bytes each and returns
a pointer to the allocated memory. Works like C calloc() but prints debug message
by QgsLogger if allocation fails.
@param nmemb number of elements
@param size size of element in bytes
*/
void CORE_EXPORT *QgsCalloc( size_t nmemb, size_t size );
void CORE_EXPORT *qgsCalloc( size_t nmemb, size_t size );

/** Frees the memory space pointed to by ptr. Works like C free().
@param ptr pointer to memory space
*/
void CORE_EXPORT QgsFree( void *ptr );
void CORE_EXPORT qgsFree( void *ptr );

/** Wkt string that represents a geographic coord sys
* @note added in 1.8 to replace GEOWkt
@@ -109,93 +109,93 @@ void QgsClipper::connectSeparatedLines( double x0, double y0, double x1, double
const QgsRectangle& clipRect, QPolygonF& pts )
{
//test the different edge combinations...
if ( doubleNear( x0, clipRect.xMinimum() ) )
if ( qgsDoubleNear( x0, clipRect.xMinimum() ) )
{
if ( doubleNear( x1, clipRect.xMinimum() ) )
if ( qgsDoubleNear( x1, clipRect.xMinimum() ) )
{
return;
}
else if ( doubleNear( y1, clipRect.yMaximum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMaximum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMaximum() );
return;
}
else if ( doubleNear( x1, clipRect.xMaximum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMaximum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMaximum() );
pts << QPointF( clipRect.xMaximum(), clipRect.yMaximum() );
return;
}
else if ( doubleNear( y1, clipRect.yMinimum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMinimum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMinimum() );
return;
}
}
else if ( doubleNear( y0, clipRect.yMaximum() ) )
else if ( qgsDoubleNear( y0, clipRect.yMaximum() ) )
{
if ( doubleNear( y1, clipRect.yMaximum() ) )
if ( qgsDoubleNear( y1, clipRect.yMaximum() ) )
{
return;
}
else if ( doubleNear( x1, clipRect.xMaximum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMaximum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMaximum() );
return;
}
else if ( doubleNear( y1, clipRect.yMinimum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMinimum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMaximum() );
pts << QPointF( clipRect.xMaximum(), clipRect.yMinimum() );
return;
}
else if ( doubleNear( x1, clipRect.xMinimum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMinimum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMaximum() );
return;
}
}
else if ( doubleNear( x0, clipRect.xMaximum() ) )
else if ( qgsDoubleNear( x0, clipRect.xMaximum() ) )
{
if ( doubleNear( x1, clipRect.xMaximum() ) )
if ( qgsDoubleNear( x1, clipRect.xMaximum() ) )
{
return;
}
else if ( doubleNear( y1, clipRect.yMinimum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMinimum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMinimum() );
return;
}
else if ( doubleNear( x1, clipRect.xMinimum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMinimum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMinimum() );
pts << QPointF( clipRect.xMinimum(), clipRect.yMinimum() );
return;
}
else if ( doubleNear( y1, clipRect.yMaximum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMaximum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMaximum() );
return;
}
}
else if ( doubleNear( y0, clipRect.yMinimum() ) )
else if ( qgsDoubleNear( y0, clipRect.yMinimum() ) )
{
if ( doubleNear( y1, clipRect.yMinimum() ) )
if ( qgsDoubleNear( y1, clipRect.yMinimum() ) )
{
return;
}
else if ( doubleNear( x1, clipRect.xMinimum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMinimum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMinimum() );
return;
}
else if ( doubleNear( y1, clipRect.yMaximum() ) )
else if ( qgsDoubleNear( y1, clipRect.yMaximum() ) )
{
pts << QPointF( clipRect.xMinimum(), clipRect.yMinimum() );
pts << QPointF( clipRect.xMinimum(), clipRect.yMaximum() );
return;
}
else if ( doubleNear( x1, clipRect.xMaximum() ) )
else if ( qgsDoubleNear( x1, clipRect.xMaximum() ) )
{
pts << QPointF( clipRect.xMaximum(), clipRect.yMinimum() );
return;
@@ -419,7 +419,7 @@ inline QPointF QgsClipper::intersectRect( const QPointF& pt1,
}

double r = 0;
if ( !doubleNear( r_d, 0.0 ) )
if ( !qgsDoubleNear( r_d, 0.0 ) )
{
r = r_n / r_d;
}
@@ -972,7 +972,7 @@ void QgsCoordinateReferenceSystem::setMapUnits()

QgsDebugMsg( "Projection has linear units of " + unit );

if ( doubleNear( toMeter, 1.0 ) ) //Unit name for meters would be "metre"
if ( qgsDoubleNear( toMeter, 1.0 ) ) //Unit name for meters would be "metre"
mMapUnits = QGis::Meters;
else if ( unit == "Foot" )
mMapUnits = QGis::Feet;
@@ -292,7 +292,7 @@ double QgsPoint::sqrDistToSegment( double x1, double y1, double x2, double y2, Q

double dist = sqrDist( minDistPoint );
//prevent rounding errors if the point is directly on the segment
if ( doubleNear( dist, 0.0, epsilon ) )
if ( qgsDoubleNear( dist, 0.0, epsilon ) )
{
minDistPoint.setX( m_x );
minDistPoint.setY( m_y );

0 comments on commit f40e3a6

Please sign in to comment.
You can’t perform that action at this time.