Skip to content

Commit 6455628

Browse files
author
jef
committed
fix gcc 4.6 warnings
git-svn-id: http://svn.osgeo.org/qgis/trunk@15857 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2b9c837 commit 6455628

28 files changed

+28
-113
lines changed

src/analysis/raster/qgsrastercalculator.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
120120
{
121121
char* crsWKT = 0;
122122
OGRSpatialReferenceH ogrSRS = OSRNewSpatialReference( NULL );
123-
const QgsCoordinateReferenceSystem& outputCrs = rl->crs();
124-
int epsgCode = outputCrs.epsg();
125-
if ( epsgCode > 0 && OSRImportFromEPSG( ogrSRS, epsgCode ) == CE_None )
123+
if ( OSRSetFromUserInput( ogrSRS, rl->crs().authid().toUtf8().constData() ) == OGRERR_NONE )
126124
{
127125
OSRExportToWkt( ogrSRS, &crsWKT );
128126
GDALSetProjection( outputDataset, crsWKT );

src/app/ogr/qgsopenvectorlayerdialog.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,10 @@ void QgsOpenVectorLayerDialog::setConnectionTypeListPosition()
240240
QSettings settings;
241241

242242
QString toSelect = settings.value( "/ogr/connections/selectedtype" ).toString();
243-
bool set = false;
244243
for ( int i = 0; i < cmbDatabaseTypes->count(); ++i )
245244
if ( cmbDatabaseTypes->itemText( i ) == toSelect )
246245
{
247246
cmbDatabaseTypes->setCurrentIndex( i );
248-
set = true;
249247
break;
250248
}
251249
}

src/app/qgisapp.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -3877,8 +3877,6 @@ void QgisApp::mergeSelectedFeatures()
38773877
}
38783878

38793879
//make a first geometry union and notify the user straight away if the union geometry type does not match the layer one
3880-
QGis::WkbType originalType = vl->wkbType();
3881-
QGis::WkbType newType = unionGeom->wkbType();
38823880
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
38833881
{
38843882
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" ) );
@@ -3918,8 +3916,6 @@ void QgisApp::mergeSelectedFeatures()
39183916
return;
39193917
}
39203918

3921-
originalType = vl->wkbType();
3922-
newType = unionGeom->wkbType();
39233919
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
39243920
{
39253921
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" ) );

src/app/qgsattributetypedialog.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ void QgsAttributeTypeDialog::vCellChanged( int row, int column )
8686
void QgsAttributeTypeDialog::removeSelectedButtonPushed()
8787
{
8888
QList<QTableWidgetItem *> list = tableWidget->selectedItems();
89-
QList<QTableWidgetItem *>::iterator it = list.begin();
9089
QSet<int> rowsToRemove;
9190
int removed = 0;
9291
int i = 0;

src/app/qgsgraduatedsymboldialog.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ void QgsGraduatedSymbolDialog::adjustNumberOfClasses()
157157
show();
158158
return;
159159
}
160-
161-
std::map < QString, int >::iterator iter = mFieldMap.find( fieldstring );
162160
}
163161

164162
void QgsGraduatedSymbolDialog::apply()

src/app/qgslabelpropertydialog.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
5555
return;
5656
}
5757
const QgsAttributeMap& attributeValues = f.attributeMap();
58-
QgsAttributeMap::const_iterator attIt = attributeValues.constBegin();
5958

6059
//get layerproperties. Problem: only for pallabeling...
6160
QgsPalLabeling* lbl = dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() );

src/app/qgsrasterlayerproperties.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1886,8 +1886,6 @@ void QgsRasterLayerProperties::refreshHistogram()
18861886
// and max - scaled to image height. 1 line drawn per selected band
18871887
//
18881888
const int BINCOUNT = 255;
1889-
enum GRAPH_TYPE { BAR_CHART, LINE_CHART } myGraphType;
1890-
myGraphType = BAR_CHART;
18911889
bool myIgnoreOutOfRangeFlag = true;
18921890
bool myThoroughBandScanFlag = false;
18931891
int myBandCountInt = mRasterLayer->bandCount();

src/core/composer/qgscomposeritem.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
958958
//assume points 1 and 3 are on the rectangle boundaries. Calculate 2 and 4.
959959
double distM1 = sqrt(( x1 - midX ) * ( x1 - midX ) + ( y1 - midY ) * ( y1 - midY ) );
960960
QPointF p2 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x2, y2 ), distM1 );
961-
QPointF p4 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x4, y4 ), distM1 );
962961

963962
if ( p2.x() < width && p2.x() > 0 && p2.y() < height && p2.y() > 0 )
964963
{

src/core/composer/qgscomposerscalebar.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ void QgsComposerScaleBar::applyDefaultSize()
138138
if ( mComposerMap )
139139
{
140140
//calculate mNumUnitsPerSegment
141-
QRectF composerItemRect = mComposerMap->rect();
142141
QgsRectangle composerMapRect = mComposerMap->extent();
143142

144143
double proposedScaleBarLength = composerMapRect.width() / 4;

src/core/gps/gmath.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,13 @@ double nmea_distance_ellipsoid(
163163
while (( delta_lambda > 1e-12 ) && ( remaining_steps > 0 ) )
164164
{ /* Iterate */
165165
/* Variables */
166-
double tmp1, tmp2, tan_sigma, sin_alpha, cos_alpha, C, lambda_prev;
166+
double tmp1, tmp2, sin_alpha, cos_alpha, C, lambda_prev;
167167

168168
/* Calculation */
169169
tmp1 = cos_U2 * sin_lambda;
170170
tmp2 = cos_U1 * sin_U2 - sin_U1 * cos_U2 * cos_lambda;
171171
sin_sigma = sqrt( tmp1 * tmp1 + tmp2 * tmp2 );
172172
cos_sigma = sin_U1 * sin_U2 + cos_U1 * cos_U2 * cos_lambda;
173-
tan_sigma = sin_sigma / cos_sigma;
174173
sin_alpha = cos_U1 * cos_U2 * sin_lambda / sin_sigma;
175174
cos_alpha = cos( asin( sin_alpha ) );
176175
sqr_cos_alpha = cos_alpha * cos_alpha;
@@ -261,7 +260,7 @@ int nmea_move_horz_ellipsoid(
261260
/* Variables */
262261
double f, a, b, sqr_a, sqr_b;
263262
double phi1, tan_U1, sin_U1, cos_U1, s, alpha1, sin_alpha1, cos_alpha1;
264-
double tan_sigma1, sigma1, sin_alpha, cos_alpha, sqr_cos_alpha, sqr_u, A, B;
263+
double sigma1, sin_alpha, sqr_cos_alpha, sqr_u, A, B;
265264
double sigma_initial, sigma, sigma_prev, sin_sigma, cos_sigma, cos_2_sigmam, sqr_cos_2_sigmam, delta_sigma;
266265
int remaining_steps;
267266
double tmp1, phi2, lambda, C, L;
@@ -293,11 +292,9 @@ int nmea_move_horz_ellipsoid(
293292
alpha1 = azimuth;
294293
sin_alpha1 = sin( alpha1 );
295294
cos_alpha1 = cos( alpha1 );
296-
tan_sigma1 = tan_U1 / cos_alpha1;
297295
sigma1 = atan2( tan_U1, cos_alpha1 );
298296
sin_alpha = cos_U1 * sin_alpha1;
299297
sqr_cos_alpha = 1 - sin_alpha * sin_alpha;
300-
cos_alpha = sqrt( sqr_cos_alpha );
301298
sqr_u = sqr_cos_alpha * ( sqr_a - sqr_b ) / sqr_b;
302299
A = 1 + sqr_u / 16384 * ( 4096 + sqr_u * ( -768 + sqr_u * ( 320 - 175 * sqr_u ) ) );
303300
B = sqr_u / 1024 * ( 256 + sqr_u * ( -128 + sqr_u * ( 74 - 47 * sqr_u ) ) );

src/core/pal/feature.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,6 @@ namespace pal
10101010
if ( shapes_final->size() > 0 )
10111011
{
10121012
LinkedList<LabelPosition*> *positions = new LinkedList<LabelPosition*> ( ptrLPosCompare );
1013-
int it;
10141013

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

1040-
it = 0;
10411039
dx = dy = min( yrm, xrm ) / 2;
10421040

10431041
int num_try = 0;

src/core/pal/pointset.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ namespace pal
611611
double cp;
612612
double best_cp;
613613
double distNearestPoint;
614-
int nearestPoint;
615614

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

691690
best_cp = DBL_MAX;
692-
nearestPoint = -1;
693691
for ( j = 0; j < nbPoints; j++ )
694692
{
695693
cp = cross_product( bb[i+2], bb[i+3], bb[i], bb[i+1], x[cHull[j]], y[cHull[j]] );
696694
if ( cp < best_cp )
697695
{
698696
best_cp = cp;
699-
nearestPoint = cHull[j];
700697
}
701698
}
702699

src/core/pal/problem.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,6 @@ namespace pal
21382138
double initial_cost;
21392139
double cur_cost = 0;
21402140
double best_cost = 0;
2141-
double bestChain;
21422141

21432142
int nbOverlap = 0;
21442143

@@ -2166,7 +2165,6 @@ namespace pal
21662165

21672166
int tenure = pal->tenure;
21682167

2169-
int itBest = -1;
21702168
//int deltaIt = 0;
21712169

21722170
Triple **candidates = new Triple*[probSize];
@@ -2208,10 +2206,7 @@ namespace pal
22082206

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

2211-
int validCandidateId = -1;
2212-
22132209
int candidateListSize;
2214-
int seedSh;
22152210
candidateListSize = int ( pal->candListSize * ( double ) probSize + 0.5 );
22162211

22172212
if ( candidateListSize > probSize )
@@ -2226,16 +2221,13 @@ namespace pal
22262221
while ( it < stop_it )
22272222
{
22282223
retainedChain = NULL;
2229-
bestChain = DBL_MAX;
2230-
validCandidateId = -1;
22312224

22322225
#ifdef _DEBUG_FULL_
22332226
std::cout << std::endl << std::endl << candidateListSize << std::endl;
22342227
#endif
22352228
for ( itC = 0; itC < candidateListSize; itC++ )
22362229
{
22372230
seed = candidates[itC]->feat_id;
2238-
seedSh = seed - borderSize;
22392231

22402232
#ifdef _DEBUG_FULL_
22412233
std::cout << "new candidates:" << std::endl;
@@ -2253,7 +2245,6 @@ namespace pal
22532245
if ( !retainedChain )
22542246
{
22552247
retainedChain = current_chain;
2256-
bestChain = current_chain->delta;
22572248
#ifdef _DEBUG_FULL_
22582249
std::cout << "New chain, delta = " << current_chain->delta << std::endl;
22592250
#endif
@@ -2262,7 +2253,6 @@ namespace pal
22622253
{
22632254
delete_chain( retainedChain );
22642255
retainedChain = current_chain;
2265-
bestChain = current_chain->delta;
22662256
#ifdef _DEBUG_FULL_
22672257
std::cout << "New best chain, delta = " << current_chain->delta << std::endl;
22682258
#endif
@@ -2355,8 +2345,6 @@ namespace pal
23552345
best_cost = cur_cost;
23562346
memcpy( best_sol, sol, sizeof( int ) *subSize );
23572347

2358-
itBest = it;
2359-
23602348
stop_it = ( it + itwimp > maxit ? maxit : it + itwimp );
23612349
}
23622350
sort(( void** ) candidates, probSize, decreaseCost );

src/core/qgsgeometry.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,6 @@ QgsRectangle QgsGeometry::boundingBox()
34433443
int numLineStrings;
34443444
int idx, jdx, kdx;
34453445
unsigned char *ptr;
3446-
char lsb;
34473446
QgsPoint pt;
34483447
QGis::WkbType wkbType;
34493448
bool hasZValue = false;
@@ -3568,7 +3567,6 @@ QgsRectangle QgsGeometry::boundingBox()
35683567
for ( jdx = 0; jdx < numLineStrings; jdx++ )
35693568
{
35703569
// each of these is a wbklinestring so must handle as such
3571-
lsb = *ptr;
35723570
ptr += 5; // skip type since we know its 2
35733571
nPoints = ( int * ) ptr;
35743572
ptr += sizeof( int );
@@ -4135,7 +4133,6 @@ bool QgsGeometry::exportWkbToGeos()
41354133
int numLineStrings;
41364134
int idx, jdx, kdx;
41374135
unsigned char *ptr;
4138-
char lsb;
41394136
QgsPoint pt;
41404137
QGis::WkbType wkbtype;
41414138
bool hasZValue = false;
@@ -4226,7 +4223,6 @@ bool QgsGeometry::exportWkbToGeos()
42264223
QgsPolyline sequence;
42274224

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

51675163
GEOSGeometry** newInnerRings = new GEOSGeometry*[ringList.size()];
5168-
QList<GEOSGeometry*>::const_iterator it = ringList.constBegin();
51695164
for ( int i = 0; i < ringList.size(); ++i )
51705165
{
51715166
newInnerRings[i] = ringList.at( i );

src/core/qgsmaprenderer.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,8 @@ void QgsMapRenderer::render( QPainter* painter )
320320
}
321321
}
322322

323-
bool placeOverlays = false;
324323
QgsOverlayObjectPositionManager* overlayManager = overlayManagerFromSettings();
325324
QList<QgsVectorOverlay*> allOverlayList; //list of all overlays, used to draw them after layers have been rendered
326-
if ( overlayManager )
327-
{
328-
placeOverlays = true;
329-
}
330325

331326
// render all layers in the stack, starting at the base
332327
QListIterator<QString> li( mLayerSet );

src/core/qgsvectorlayer.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -4214,8 +4214,10 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
42144214
// used in all cases of the statement (otherwise they may get
42154215
// executed, but never used, in a bit of code where performance is
42164216
// critical).
4217-
if ( ! fet.isValid() ) { return; }
4218-
bool needToTrim = false;
4217+
if ( ! fet.isValid() )
4218+
{
4219+
return;
4220+
}
42194221

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

42854287
// Work around a +/- 32768 limitation on coordinates
4286-
if ( qAbs( x ) > QgsClipper::MAX_X ||
4287-
qAbs( y ) > QgsClipper::MAX_Y )
4288-
needToTrim = true;
4289-
else
4288+
if ( qAbs( x ) <= QgsClipper::MAX_X &&
4289+
qAbs( y ) <= QgsClipper::MAX_Y )
42904290
p->drawImage( pt, *marker );
42914291
}
42924292
p->restore();

src/gui/qgsannotationitem.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ void QgsAnnotationItem::drawMarkerSymbol( QPainter* p )
216216
return;
217217
}
218218

219-
QPointF canvasPoint = toCanvasCoordinates( mMapPosition );
220219
if ( mMarkerSymbol )
221220
{
222221
mMarkerSymbol->startRender( renderContext );

src/gui/qgsmapoverviewcanvas.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ void QgsMapOverviewCanvas::updatePanningWidget( const QPoint& pos )
240240
{
241241
// if (mPanningWidget->isHidden())
242242
// return;
243-
QSize size = mPanningWidget->size();
244243
mPanningWidget->move( pos.x() - mPanningCursorOffset.x(), pos.y() - mPanningCursorOffset.y() );
245244
}
246245

src/gui/qgsquickprint.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,6 @@ void QgsQuickPrint::printMap()
247247
#endif
248248
QString myFontFamily = "Arial";
249249

250-
// Background color for pixmaps
251-
QColor myLegendBackgroundColor = Qt::white;
252-
//QColor myMapBackgroundColor = "#98dbf9"; // nice blue color
253-
254-
255250
//
256251
// Draw the PageBorder
257252
//

src/mapserver/qgssldparser.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
767767
{
768768
if ( !labelBufferElementList.item( 0 ).toElement().isNull() )
769769
{
770-
double radius = 5.0;
771770
QDomNodeList cssNodes = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
772771
QString cssName;
773772
QDomElement currentElement;
@@ -833,6 +832,13 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
833832
}
834833
}
835834
}
835+
836+
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
837+
myLabelAttributes->setBufferEnabled( true );
838+
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
839+
840+
#if 0
841+
double radius = 5.0;
836842
QDomElement radiusElement = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "Radius" ).item( 0 ).toElement();
837843
if ( !radiusElement.isNull() )
838844
{
@@ -843,10 +849,8 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
843849
radius = 5.0;
844850
}
845851
}
846-
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
847-
myLabelAttributes->setBufferEnabled( true );
848-
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
849-
//myLabelAttributes->setBufferSize(radius, QgsLabelAttributes::PointUnits);
852+
myLabelAttributes->setBufferSize( radius, QgsLabelAttributes::PointUnits );
853+
#endif
850854

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

@@ -1397,13 +1401,11 @@ QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userSty
13971401
/* -------------------------------------------------------------------- */
13981402
/* Invoke. */
13991403
/* -------------------------------------------------------------------- */
1400-
CPLErr eErr;
1401-
1402-
eErr = GDALContourGenerate( hBand, dfInterval, dfOffset,
1403-
nFixedLevelCount, adfFixedLevels,
1404-
bNoDataSet, dfNoData,
1405-
hLayer, 0, nElevField,
1406-
GDALTermProgress, NULL );
1404+
GDALContourGenerate( hBand, dfInterval, dfOffset,
1405+
nFixedLevelCount, adfFixedLevels,
1406+
bNoDataSet, dfNoData,
1407+
hLayer, 0, nElevField,
1408+
GDALTermProgress, NULL );
14071409

14081410
delete adfFixedLevels;
14091411

0 commit comments

Comments
 (0)