Skip to content

Commit 788e654

Browse files
author
jef
committed
fix various warnings
git-svn-id: http://svn.osgeo.org/qgis/trunk@10535 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2d76de3 commit 788e654

File tree

9 files changed

+97
-92
lines changed

9 files changed

+97
-92
lines changed

src/core/pal/feature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ namespace pal
558558
int it;
559559

560560
double dlx, dly; // delta from label center and bottom-left corner
561-
double alpha; // rotation for the label
561+
double alpha = 0.0; // rotation for the label
562562
double px, py;
563563
double dx;
564564
double dy;

src/core/pal/pointset.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ namespace pal
347347
double startX, startY;
348348
double stopX, stopY;
349349

350-
bool seg_complete;
350+
bool seg_complete = false;
351351

352352
Crossing *crossing;
353353
startX = x[0];
@@ -712,7 +712,8 @@ namespace pal
712712
b = tmp;
713713
}
714714
// split shape into two new shape
715-
if (( newShape = shape->extractPath( path_a, nbPtPathA, nbBboxPoint, bbx, bby, b, a, ( b->pt + 1 ) % shape->nbPoints ) ) )
715+
newShape = shape->extractPath( path_a, nbPtPathA, nbBboxPoint, bbx, bby, b, a, ( b->pt + 1 ) % shape->nbPoints );
716+
if ( newShape )
716717
{
717718
if ( path_a == -1 ) // new shape inside => push into shapes_final
718719
{
@@ -724,7 +725,8 @@ namespace pal
724725
}
725726
}
726727

727-
if (( newShape = shape->extractPath( path_b, nbPtPathB, nbBboxPoint, bbx, bby, a, b, ( a->pt + 1 ) % shape->nbPoints ) ) )
728+
newShape = shape->extractPath( path_b, nbPtPathB, nbBboxPoint, bbx, bby, a, b, ( a->pt + 1 ) % shape->nbPoints );
729+
if ( newShape )
728730
{
729731
if ( path_b == -1 )
730732
{
@@ -1052,7 +1054,7 @@ namespace pal
10521054
// retainedPt = deppest point in hole
10531055
// bestArea = area of triangle HoleS->holeE->retainedPoint
10541056
bestArea = sqrt( bestArea );
1055-
double cx, cy, dx, dy, ex, ey, fx, fy, seg_length, ptx, pty, fptx = 0, fpty = 0;
1057+
double cx, cy, dx, dy, ex, ey, fx, fy, seg_length, ptx = 0, pty = 0, fptx = 0, fpty = 0;
10561058
int ps = -1, pe = -1, fps = -1, fpe = -1;
10571059
if ( retainedPt >= 0 && bestArea > labelArea ) // there is a hole so we'll cut the shape in two new shape (only if hole area is bigger than twice labelArea)
10581060
{

src/core/pal/problem.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#include "util.h"
6060
#include "priorityqueue.h"
6161

62-
62+
#define UNUSED(x) (void)x;
6363

6464
namespace pal
6565
{
@@ -720,7 +720,6 @@ namespace pal
720720

721721
bool subPartCallback( LabelPosition *lp, void *ctx )
722722
{
723-
int lpid = lp->id;
724723
int *isIn = (( SubPartContext* ) ctx )->isIn;
725724
LinkedList<int> *queue = (( SubPartContext* ) ctx )->queue;
726725

@@ -1749,7 +1748,7 @@ namespace pal
17491748
#ifdef _DEBUG_FULL_
17501749
std::cout << "catch int " << i << std::endl;
17511750
#else
1752-
i;
1751+
UNUSED(i);
17531752
#endif
17541753
while ( conflicts->size() > 0 )
17551754
conflicts->pop_front();
@@ -2053,7 +2052,7 @@ namespace pal
20532052
#ifdef _DEBUG_FULL_
20542053
std::cout << "catch Cycle in chain" << std::endl;
20552054
#else
2056-
i;
2055+
UNUSED(i);
20572056
#endif
20582057
while ( conflicts->size() > 0 )
20592058
conflicts->pop_front();
@@ -2197,7 +2196,8 @@ namespace pal
21972196
{
21982197
seed = ( it % probSize ) + borderSize;
21992198

2200-
if (( current_chain = chain( part, seed ) ) )
2199+
current_chain = chain( part, seed );
2200+
if ( current_chain )
22012201
{
22022202

22032203
/* we accept a modification only if the seed is not tabu or

src/core/pal/rtree.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ namespace pal {
13551355

13561356
// Search in an index tree or subtree for all data retangles that overlap the argument rectangle.
13571357
RTREE_TEMPLATE
1358-
bool RTREE_QUAL::Search (Node* a_node, Rect* a_rect, int& a_foundCount, bool a_resultCallback (DATATYPE a_data, void* a_context), void* a_context) {
1358+
bool RTREE_QUAL::Search (Node* a_node, Rect* a_rect, int& a_foundCount, bool (*a_resultCallback)(DATATYPE a_data, void* a_context), void* a_context) {
13591359
ASSERT (a_node);
13601360
ASSERT (a_node->m_level >= 0);
13611361
ASSERT (a_rect);
@@ -1374,7 +1374,7 @@ namespace pal {
13741374
DATATYPE& id = a_node->m_branch[index].m_data;
13751375

13761376
// NOTE: There are different ways to return results. Here's where to modify
1377-
if (&a_resultCallback) {
1377+
if (a_resultCallback) {
13781378
++a_foundCount;
13791379
if (!a_resultCallback (id, a_context)) {
13801380
return false; // Don't continue searching

src/core/pal/util.h

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,13 @@ namespace pal
157157
case pal::FOOT:
158158
return (( x / double( dpi ) )*12 ) * scale;
159159
case pal::DEGREE:
160-
double iw = degree2meter( delta_canvas_width ) * 39.3700787;
161-
return ( x * delta_canvas_width * scale ) / ( iw * dpi );
160+
{
161+
double iw = degree2meter( delta_canvas_width ) * 39.3700787;
162+
return ( x * delta_canvas_width * scale ) / ( iw * dpi );
163+
}
164+
default:
165+
fprintf( stderr, "Target unit undefined\n" );
166+
return 0.0;
162167
}
163168
break;
164169
case pal::METER:
@@ -169,8 +174,13 @@ namespace pal
169174
case pal::FOOT:
170175
return x / 0.3048;
171176
case pal::DEGREE:
172-
double mw = degree2meter( delta_canvas_width );
173-
return ( x * delta_canvas_width ) / mw;
177+
{
178+
double mw = degree2meter( delta_canvas_width );
179+
return ( x * delta_canvas_width ) / mw;
180+
}
181+
default:
182+
fprintf( stderr, "Target unit undefined\n" );
183+
return 0.0;
174184
}
175185
break;
176186
case pal::FOOT:
@@ -181,27 +191,39 @@ namespace pal
181191
case pal::METER:
182192
return x*0.3048;
183193
case pal::DEGREE:
184-
double iw = degree2meter( delta_canvas_width ) * 39.3700787;
185-
return ( x * delta_canvas_width ) / iw;
194+
{
195+
double iw = degree2meter( delta_canvas_width ) * 39.3700787;
196+
return ( x * delta_canvas_width ) / iw;
197+
}
198+
default:
199+
fprintf( stderr, "Target unit undefined\n" );
200+
return 0.0;
186201
}
187202
break;
188203
case pal::DEGREE:
189204
switch ( to )
190205
{
191206
case pal::PIXEL:
192-
fprintf( stderr, "Degree to pixel not yet implemented" );
207+
fprintf( stderr, "Degree to pixel not yet implemented\n" );
193208
break;
194209
case pal::METER:
195-
fprintf( stderr, "Degree to meter not yet implemented" );
210+
fprintf( stderr, "Degree to meter not yet implemented\n" );
196211
break;
197212
case pal::FOOT:
198-
fprintf( stderr, "Degree to foot not yet implemented" );
213+
fprintf( stderr, "Degree to foot not yet implemented\n" );
199214
break;
215+
default:
216+
fprintf( stderr, "Target unit undefined\n" );
217+
return 0.0;
200218
}
201219
break;
220+
default:
221+
fprintf( stderr, "Source unit undefined" );
222+
return 0.0;
223+
202224
}
203225

204-
fprintf( stderr, "Unable to convert. Unknown units" );
226+
fprintf( stderr, "Unable to convert. Unknown units\n" );
205227
return 0.0;
206228
}
207229

src/core/qgspalobjectpositionmanager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ void QgsPALObjectPositionManager::addLayer( QgsVectorLayer* vl, QList<QgsVectorO
6767
}
6868

6969
//register the labeling objects in the layer
70-
QgsVectorOverlay* currentOverlay = 0;
7170
int objectNr = 0;
7271
QList<QgsVectorOverlay*>::const_iterator overlayIt = overlays.begin();
7372
for ( ; overlayIt != overlays.end(); ++overlayIt )
@@ -114,6 +113,8 @@ void QgsPALObjectPositionManager::findObjectPositions( const QgsRenderContext& r
114113
case QGis::Degrees:
115114
mapUnits = pal::DEGREE;
116115
break;
116+
default:
117+
return;
117118
}
118119
mPositionEngine.setMapUnit( mapUnits );
119120
std::list<pal::Label*>* resultLabelList = mPositionEngine.labeller( renderContext.rendererScale(), bbox, &stat, true );

0 commit comments

Comments
 (0)