Skip to content

Commit

Permalink
fix gcc 4.6 warnings
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15857 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 30, 2011
1 parent 238b0de commit 6b21e4c
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 113 deletions.
4 changes: 1 addition & 3 deletions src/analysis/raster/qgsrastercalculator.cpp
Expand Up @@ -120,9 +120,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
{
char* crsWKT = 0;
OGRSpatialReferenceH ogrSRS = OSRNewSpatialReference( NULL );
const QgsCoordinateReferenceSystem& outputCrs = rl->crs();
int epsgCode = outputCrs.epsg();
if ( epsgCode > 0 && OSRImportFromEPSG( ogrSRS, epsgCode ) == CE_None )
if ( OSRSetFromUserInput( ogrSRS, rl->crs().authid().toUtf8().constData() ) == OGRERR_NONE )
{
OSRExportToWkt( ogrSRS, &crsWKT );
GDALSetProjection( outputDataset, crsWKT );
Expand Down
2 changes: 0 additions & 2 deletions src/app/ogr/qgsopenvectorlayerdialog.cpp
Expand Up @@ -240,12 +240,10 @@ void QgsOpenVectorLayerDialog::setConnectionTypeListPosition()
QSettings settings;

QString toSelect = settings.value( "/ogr/connections/selectedtype" ).toString();
bool set = false;
for ( int i = 0; i < cmbDatabaseTypes->count(); ++i )
if ( cmbDatabaseTypes->itemText( i ) == toSelect )
{
cmbDatabaseTypes->setCurrentIndex( i );
set = true;
break;
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -3877,8 +3877,6 @@ void QgisApp::mergeSelectedFeatures()
}

//make a first geometry union and notify the user straight away if the union geometry type does not match the layer one
QGis::WkbType originalType = vl->wkbType();
QGis::WkbType newType = unionGeom->wkbType();
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{
QMessageBox::critical( 0, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
Expand Down Expand Up @@ -3918,8 +3916,6 @@ void QgisApp::mergeSelectedFeatures()
return;
}

originalType = vl->wkbType();
newType = unionGeom->wkbType();
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{
QMessageBox::critical( 0, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsattributetypedialog.cpp
Expand Up @@ -86,7 +86,6 @@ void QgsAttributeTypeDialog::vCellChanged( int row, int column )
void QgsAttributeTypeDialog::removeSelectedButtonPushed()
{
QList<QTableWidgetItem *> list = tableWidget->selectedItems();
QList<QTableWidgetItem *>::iterator it = list.begin();
QSet<int> rowsToRemove;
int removed = 0;
int i = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsgraduatedsymboldialog.cpp
Expand Up @@ -157,8 +157,6 @@ void QgsGraduatedSymbolDialog::adjustNumberOfClasses()
show();
return;
}

std::map < QString, int >::iterator iter = mFieldMap.find( fieldstring );
}

void QgsGraduatedSymbolDialog::apply()
Expand Down
1 change: 0 additions & 1 deletion src/app/qgslabelpropertydialog.cpp
Expand Up @@ -55,7 +55,6 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
return;
}
const QgsAttributeMap& attributeValues = f.attributeMap();
QgsAttributeMap::const_iterator attIt = attributeValues.constBegin();

//get layerproperties. Problem: only for pallabeling...
QgsPalLabeling* lbl = dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() );
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -1886,8 +1886,6 @@ void QgsRasterLayerProperties::refreshHistogram()
// and max - scaled to image height. 1 line drawn per selected band
//
const int BINCOUNT = 255;
enum GRAPH_TYPE { BAR_CHART, LINE_CHART } myGraphType;
myGraphType = BAR_CHART;
bool myIgnoreOutOfRangeFlag = true;
bool myThoroughBandScanFlag = false;
int myBandCountInt = mRasterLayer->bandCount();
Expand Down
1 change: 0 additions & 1 deletion src/core/composer/qgscomposeritem.cpp
Expand Up @@ -958,7 +958,6 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
//assume points 1 and 3 are on the rectangle boundaries. Calculate 2 and 4.
double distM1 = sqrt(( x1 - midX ) * ( x1 - midX ) + ( y1 - midY ) * ( y1 - midY ) );
QPointF p2 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x2, y2 ), distM1 );
QPointF p4 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x4, y4 ), distM1 );

if ( p2.x() < width && p2.x() > 0 && p2.y() < height && p2.y() > 0 )
{
Expand Down
1 change: 0 additions & 1 deletion src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -138,7 +138,6 @@ void QgsComposerScaleBar::applyDefaultSize()
if ( mComposerMap )
{
//calculate mNumUnitsPerSegment
QRectF composerItemRect = mComposerMap->rect();
QgsRectangle composerMapRect = mComposerMap->extent();

double proposedScaleBarLength = composerMapRect.width() / 4;
Expand Down
7 changes: 2 additions & 5 deletions src/core/gps/gmath.c
Expand Up @@ -163,14 +163,13 @@ double nmea_distance_ellipsoid(
while (( delta_lambda > 1e-12 ) && ( remaining_steps > 0 ) )
{ /* Iterate */
/* Variables */
double tmp1, tmp2, tan_sigma, sin_alpha, cos_alpha, C, lambda_prev;
double tmp1, tmp2, sin_alpha, cos_alpha, C, lambda_prev;

/* Calculation */
tmp1 = cos_U2 * sin_lambda;
tmp2 = cos_U1 * sin_U2 - sin_U1 * cos_U2 * cos_lambda;
sin_sigma = sqrt( tmp1 * tmp1 + tmp2 * tmp2 );
cos_sigma = sin_U1 * sin_U2 + cos_U1 * cos_U2 * cos_lambda;
tan_sigma = sin_sigma / cos_sigma;
sin_alpha = cos_U1 * cos_U2 * sin_lambda / sin_sigma;
cos_alpha = cos( asin( sin_alpha ) );
sqr_cos_alpha = cos_alpha * cos_alpha;
Expand Down Expand Up @@ -261,7 +260,7 @@ int nmea_move_horz_ellipsoid(
/* Variables */
double f, a, b, sqr_a, sqr_b;
double phi1, tan_U1, sin_U1, cos_U1, s, alpha1, sin_alpha1, cos_alpha1;
double tan_sigma1, sigma1, sin_alpha, cos_alpha, sqr_cos_alpha, sqr_u, A, B;
double sigma1, sin_alpha, sqr_cos_alpha, sqr_u, A, B;
double sigma_initial, sigma, sigma_prev, sin_sigma, cos_sigma, cos_2_sigmam, sqr_cos_2_sigmam, delta_sigma;
int remaining_steps;
double tmp1, phi2, lambda, C, L;
Expand Down Expand Up @@ -293,11 +292,9 @@ int nmea_move_horz_ellipsoid(
alpha1 = azimuth;
sin_alpha1 = sin( alpha1 );
cos_alpha1 = cos( alpha1 );
tan_sigma1 = tan_U1 / cos_alpha1;
sigma1 = atan2( tan_U1, cos_alpha1 );
sin_alpha = cos_U1 * sin_alpha1;
sqr_cos_alpha = 1 - sin_alpha * sin_alpha;
cos_alpha = sqrt( sqr_cos_alpha );
sqr_u = sqr_cos_alpha * ( sqr_a - sqr_b ) / sqr_b;
A = 1 + sqr_u / 16384 * ( 4096 + sqr_u * ( -768 + sqr_u * ( 320 - 175 * sqr_u ) ) );
B = sqr_u / 1024 * ( 256 + sqr_u * ( -128 + sqr_u * ( 74 - 47 * sqr_u ) ) );
Expand Down
2 changes: 0 additions & 2 deletions src/core/pal/feature.cpp
Expand Up @@ -1010,7 +1010,6 @@ namespace pal
if ( shapes_final->size() > 0 )
{
LinkedList<LabelPosition*> *positions = new LinkedList<LabelPosition*> ( ptrLPosCompare );
int it;

int id = 0; // ids for candidates
double dlx, dly; // delta from label center and bottom-left corner
Expand All @@ -1037,7 +1036,6 @@ namespace pal
j++;
}

it = 0;
dx = dy = min( yrm, xrm ) / 2;

int num_try = 0;
Expand Down
3 changes: 0 additions & 3 deletions src/core/pal/pointset.cpp
Expand Up @@ -611,7 +611,6 @@ namespace pal
double cp;
double best_cp;
double distNearestPoint;
int nearestPoint;

double area;
double width;
Expand Down Expand Up @@ -689,14 +688,12 @@ namespace pal
alpha_seg = (( i / 4 > 0 ? ( i / 4 ) - 1 : 3 ) ) * M_PI / 2 + alpha;

best_cp = DBL_MAX;
nearestPoint = -1;
for ( j = 0; j < nbPoints; j++ )
{
cp = cross_product( bb[i+2], bb[i+3], bb[i], bb[i+1], x[cHull[j]], y[cHull[j]] );
if ( cp < best_cp )
{
best_cp = cp;
nearestPoint = cHull[j];
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/core/pal/problem.cpp
Expand Up @@ -2138,7 +2138,6 @@ namespace pal
double initial_cost;
double cur_cost = 0;
double best_cost = 0;
double bestChain;

int nbOverlap = 0;

Expand Down Expand Up @@ -2166,7 +2165,6 @@ namespace pal

int tenure = pal->tenure;

int itBest = -1;
//int deltaIt = 0;

Triple **candidates = new Triple*[probSize];
Expand Down Expand Up @@ -2208,10 +2206,7 @@ namespace pal

sort(( void** ) candidates, probSize, decreaseCost );

int validCandidateId = -1;

int candidateListSize;
int seedSh;
candidateListSize = int ( pal->candListSize * ( double ) probSize + 0.5 );

if ( candidateListSize > probSize )
Expand All @@ -2226,16 +2221,13 @@ namespace pal
while ( it < stop_it )
{
retainedChain = NULL;
bestChain = DBL_MAX;
validCandidateId = -1;

#ifdef _DEBUG_FULL_
std::cout << std::endl << std::endl << candidateListSize << std::endl;
#endif
for ( itC = 0; itC < candidateListSize; itC++ )
{
seed = candidates[itC]->feat_id;
seedSh = seed - borderSize;

#ifdef _DEBUG_FULL_
std::cout << "new candidates:" << std::endl;
Expand All @@ -2253,7 +2245,6 @@ namespace pal
if ( !retainedChain )
{
retainedChain = current_chain;
bestChain = current_chain->delta;
#ifdef _DEBUG_FULL_
std::cout << "New chain, delta = " << current_chain->delta << std::endl;
#endif
Expand All @@ -2262,7 +2253,6 @@ namespace pal
{
delete_chain( retainedChain );
retainedChain = current_chain;
bestChain = current_chain->delta;
#ifdef _DEBUG_FULL_
std::cout << "New best chain, delta = " << current_chain->delta << std::endl;
#endif
Expand Down Expand Up @@ -2355,8 +2345,6 @@ namespace pal
best_cost = cur_cost;
memcpy( best_sol, sol, sizeof( int ) *subSize );

itBest = it;

stop_it = ( it + itwimp > maxit ? maxit : it + itwimp );
}
sort(( void** ) candidates, probSize, decreaseCost );
Expand Down
5 changes: 0 additions & 5 deletions src/core/qgsgeometry.cpp
Expand Up @@ -3443,7 +3443,6 @@ QgsRectangle QgsGeometry::boundingBox()
int numLineStrings;
int idx, jdx, kdx;
unsigned char *ptr;
char lsb;
QgsPoint pt;
QGis::WkbType wkbType;
bool hasZValue = false;
Expand Down Expand Up @@ -3568,7 +3567,6 @@ QgsRectangle QgsGeometry::boundingBox()
for ( jdx = 0; jdx < numLineStrings; jdx++ )
{
// each of these is a wbklinestring so must handle as such
lsb = *ptr;
ptr += 5; // skip type since we know its 2
nPoints = ( int * ) ptr;
ptr += sizeof( int );
Expand Down Expand Up @@ -4135,7 +4133,6 @@ bool QgsGeometry::exportWkbToGeos()
int numLineStrings;
int idx, jdx, kdx;
unsigned char *ptr;
char lsb;
QgsPoint pt;
QGis::WkbType wkbtype;
bool hasZValue = false;
Expand Down Expand Up @@ -4226,7 +4223,6 @@ bool QgsGeometry::exportWkbToGeos()
QgsPolyline sequence;

// each of these is a wbklinestring so must handle as such
lsb = *ptr;
ptr += 5; // skip type since we know its 2
nPoints = ( int * ) ptr;
ptr += sizeof( int );
Expand Down Expand Up @@ -5165,7 +5161,6 @@ GEOSGeometry* QgsGeometry::reshapePolygon( const GEOSGeometry* polygon, const GE
}

GEOSGeometry** newInnerRings = new GEOSGeometry*[ringList.size()];
QList<GEOSGeometry*>::const_iterator it = ringList.constBegin();
for ( int i = 0; i < ringList.size(); ++i )
{
newInnerRings[i] = ringList.at( i );
Expand Down
5 changes: 0 additions & 5 deletions src/core/qgsmaprenderer.cpp
Expand Up @@ -320,13 +320,8 @@ void QgsMapRenderer::render( QPainter* painter )
}
}

bool placeOverlays = false;
QgsOverlayObjectPositionManager* overlayManager = overlayManagerFromSettings();
QList<QgsVectorOverlay*> allOverlayList; //list of all overlays, used to draw them after layers have been rendered
if ( overlayManager )
{
placeOverlays = true;
}

// render all layers in the stack, starting at the base
QListIterator<QString> li( mLayerSet );
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -4214,8 +4214,10 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
// used in all cases of the statement (otherwise they may get
// executed, but never used, in a bit of code where performance is
// critical).
if ( ! fet.isValid() ) { return; }
bool needToTrim = false;
if ( ! fet.isValid() )
{
return;
}

QgsGeometry* geom = fet.geometry();
if ( !geom )
Expand Down Expand Up @@ -4283,10 +4285,8 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
//QPointF pt( x, y );

// Work around a +/- 32768 limitation on coordinates
if ( qAbs( x ) > QgsClipper::MAX_X ||
qAbs( y ) > QgsClipper::MAX_Y )
needToTrim = true;
else
if ( qAbs( x ) <= QgsClipper::MAX_X &&
qAbs( y ) <= QgsClipper::MAX_Y )
p->drawImage( pt, *marker );
}
p->restore();
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsannotationitem.cpp
Expand Up @@ -216,7 +216,6 @@ void QgsAnnotationItem::drawMarkerSymbol( QPainter* p )
return;
}

QPointF canvasPoint = toCanvasCoordinates( mMapPosition );
if ( mMarkerSymbol )
{
mMarkerSymbol->startRender( renderContext );
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsmapoverviewcanvas.cpp
Expand Up @@ -240,7 +240,6 @@ void QgsMapOverviewCanvas::updatePanningWidget( const QPoint& pos )
{
// if (mPanningWidget->isHidden())
// return;
QSize size = mPanningWidget->size();
mPanningWidget->move( pos.x() - mPanningCursorOffset.x(), pos.y() - mPanningCursorOffset.y() );
}

Expand Down
5 changes: 0 additions & 5 deletions src/gui/qgsquickprint.cpp
Expand Up @@ -247,11 +247,6 @@ void QgsQuickPrint::printMap()
#endif
QString myFontFamily = "Arial";

// Background color for pixmaps
QColor myLegendBackgroundColor = Qt::white;
//QColor myMapBackgroundColor = "#98dbf9"; // nice blue color


//
// Draw the PageBorder
//
Expand Down
26 changes: 14 additions & 12 deletions src/mapserver/qgssldparser.cpp
Expand Up @@ -767,7 +767,6 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
{
if ( !labelBufferElementList.item( 0 ).toElement().isNull() )
{
double radius = 5.0;
QDomNodeList cssNodes = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
QString cssName;
QDomElement currentElement;
Expand Down Expand Up @@ -833,6 +832,13 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
}
}
}

//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
myLabelAttributes->setBufferEnabled( true );
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );

#if 0
double radius = 5.0;
QDomElement radiusElement = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "Radius" ).item( 0 ).toElement();
if ( !radiusElement.isNull() )
{
Expand All @@ -843,10 +849,8 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
radius = 5.0;
}
}
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
myLabelAttributes->setBufferEnabled( true );
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
//myLabelAttributes->setBufferSize(radius, QgsLabelAttributes::PointUnits);
myLabelAttributes->setBufferSize( radius, QgsLabelAttributes::PointUnits );
#endif

// ******** BUG ************ see why setting buffersize dows not work (is a problem in QGIS vector layer rendering)

Expand Down Expand Up @@ -1397,13 +1401,11 @@ QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userSty
/* -------------------------------------------------------------------- */
/* Invoke. */
/* -------------------------------------------------------------------- */
CPLErr eErr;

eErr = GDALContourGenerate( hBand, dfInterval, dfOffset,
nFixedLevelCount, adfFixedLevels,
bNoDataSet, dfNoData,
hLayer, 0, nElevField,
GDALTermProgress, NULL );
GDALContourGenerate( hBand, dfInterval, dfOffset,
nFixedLevelCount, adfFixedLevels,
bNoDataSet, dfNoData,
hLayer, 0, nElevField,
GDALTermProgress, NULL );

delete adfFixedLevels;

Expand Down

0 comments on commit 6b21e4c

Please sign in to comment.