[QGIS Commit] r10535 - in trunk/qgis/src: core core/pal
core/spatialite plugins/diagram_overlay providers/spatialite
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Apr 11 15:52:01 EDT 2009
Author: jef
Date: 2009-04-11 15:52:01 -0400 (Sat, 11 Apr 2009)
New Revision: 10535
Modified:
trunk/qgis/src/core/pal/feature.cpp
trunk/qgis/src/core/pal/pointset.cpp
trunk/qgis/src/core/pal/problem.cpp
trunk/qgis/src/core/pal/rtree.hpp
trunk/qgis/src/core/pal/util.h
trunk/qgis/src/core/qgspalobjectpositionmanager.cpp
trunk/qgis/src/core/spatialite/spatialite.c
trunk/qgis/src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp
Log:
fix various warnings
Modified: trunk/qgis/src/core/pal/feature.cpp
===================================================================
--- trunk/qgis/src/core/pal/feature.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/pal/feature.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -558,7 +558,7 @@
int it;
double dlx, dly; // delta from label center and bottom-left corner
- double alpha; // rotation for the label
+ double alpha = 0.0; // rotation for the label
double px, py;
double dx;
double dy;
Modified: trunk/qgis/src/core/pal/pointset.cpp
===================================================================
--- trunk/qgis/src/core/pal/pointset.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/pal/pointset.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -347,7 +347,7 @@
double startX, startY;
double stopX, stopY;
- bool seg_complete;
+ bool seg_complete = false;
Crossing *crossing;
startX = x[0];
@@ -712,7 +712,8 @@
b = tmp;
}
// split shape into two new shape
- if (( newShape = shape->extractPath( path_a, nbPtPathA, nbBboxPoint, bbx, bby, b, a, ( b->pt + 1 ) % shape->nbPoints ) ) )
+ newShape = shape->extractPath( path_a, nbPtPathA, nbBboxPoint, bbx, bby, b, a, ( b->pt + 1 ) % shape->nbPoints );
+ if ( newShape )
{
if ( path_a == -1 ) // new shape inside => push into shapes_final
{
@@ -724,7 +725,8 @@
}
}
- if (( newShape = shape->extractPath( path_b, nbPtPathB, nbBboxPoint, bbx, bby, a, b, ( a->pt + 1 ) % shape->nbPoints ) ) )
+ newShape = shape->extractPath( path_b, nbPtPathB, nbBboxPoint, bbx, bby, a, b, ( a->pt + 1 ) % shape->nbPoints );
+ if ( newShape )
{
if ( path_b == -1 )
{
@@ -1052,7 +1054,7 @@
// retainedPt = deppest point in hole
// bestArea = area of triangle HoleS->holeE->retainedPoint
bestArea = sqrt( bestArea );
- double cx, cy, dx, dy, ex, ey, fx, fy, seg_length, ptx, pty, fptx = 0, fpty = 0;
+ double cx, cy, dx, dy, ex, ey, fx, fy, seg_length, ptx = 0, pty = 0, fptx = 0, fpty = 0;
int ps = -1, pe = -1, fps = -1, fpe = -1;
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)
{
Modified: trunk/qgis/src/core/pal/problem.cpp
===================================================================
--- trunk/qgis/src/core/pal/problem.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/pal/problem.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -59,8 +59,8 @@
#include "util.h"
#include "priorityqueue.h"
+#define UNUSED(x) (void)x;
-
namespace pal
{
@@ -720,7 +720,6 @@
bool subPartCallback( LabelPosition *lp, void *ctx )
{
- int lpid = lp->id;
int *isIn = (( SubPartContext* ) ctx )->isIn;
LinkedList<int> *queue = (( SubPartContext* ) ctx )->queue;
@@ -1749,7 +1748,7 @@
#ifdef _DEBUG_FULL_
std::cout << "catch int " << i << std::endl;
#else
- i;
+ UNUSED(i);
#endif
while ( conflicts->size() > 0 )
conflicts->pop_front();
@@ -2053,7 +2052,7 @@
#ifdef _DEBUG_FULL_
std::cout << "catch Cycle in chain" << std::endl;
#else
- i;
+ UNUSED(i);
#endif
while ( conflicts->size() > 0 )
conflicts->pop_front();
@@ -2197,7 +2196,8 @@
{
seed = ( it % probSize ) + borderSize;
- if (( current_chain = chain( part, seed ) ) )
+ current_chain = chain( part, seed );
+ if ( current_chain )
{
/* we accept a modification only if the seed is not tabu or
Modified: trunk/qgis/src/core/pal/rtree.hpp
===================================================================
--- trunk/qgis/src/core/pal/rtree.hpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/pal/rtree.hpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -1355,7 +1355,7 @@
// Search in an index tree or subtree for all data retangles that overlap the argument rectangle.
RTREE_TEMPLATE
- 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) {
+ 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) {
ASSERT (a_node);
ASSERT (a_node->m_level >= 0);
ASSERT (a_rect);
@@ -1374,7 +1374,7 @@
DATATYPE& id = a_node->m_branch[index].m_data;
// NOTE: There are different ways to return results. Here's where to modify
- if (&a_resultCallback) {
+ if (a_resultCallback) {
++a_foundCount;
if (!a_resultCallback (id, a_context)) {
return false; // Don't continue searching
Modified: trunk/qgis/src/core/pal/util.h
===================================================================
--- trunk/qgis/src/core/pal/util.h 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/pal/util.h 2009-04-11 19:52:01 UTC (rev 10535)
@@ -157,8 +157,13 @@
case pal::FOOT:
return (( x / double( dpi ) )*12 ) * scale;
case pal::DEGREE:
- double iw = degree2meter( delta_canvas_width ) * 39.3700787;
- return ( x * delta_canvas_width * scale ) / ( iw * dpi );
+ {
+ double iw = degree2meter( delta_canvas_width ) * 39.3700787;
+ return ( x * delta_canvas_width * scale ) / ( iw * dpi );
+ }
+ default:
+ fprintf( stderr, "Target unit undefined\n" );
+ return 0.0;
}
break;
case pal::METER:
@@ -169,8 +174,13 @@
case pal::FOOT:
return x / 0.3048;
case pal::DEGREE:
- double mw = degree2meter( delta_canvas_width );
- return ( x * delta_canvas_width ) / mw;
+ {
+ double mw = degree2meter( delta_canvas_width );
+ return ( x * delta_canvas_width ) / mw;
+ }
+ default:
+ fprintf( stderr, "Target unit undefined\n" );
+ return 0.0;
}
break;
case pal::FOOT:
@@ -181,27 +191,39 @@
case pal::METER:
return x*0.3048;
case pal::DEGREE:
- double iw = degree2meter( delta_canvas_width ) * 39.3700787;
- return ( x * delta_canvas_width ) / iw;
+ {
+ double iw = degree2meter( delta_canvas_width ) * 39.3700787;
+ return ( x * delta_canvas_width ) / iw;
+ }
+ default:
+ fprintf( stderr, "Target unit undefined\n" );
+ return 0.0;
}
break;
case pal::DEGREE:
switch ( to )
{
case pal::PIXEL:
- fprintf( stderr, "Degree to pixel not yet implemented" );
+ fprintf( stderr, "Degree to pixel not yet implemented\n" );
break;
case pal::METER:
- fprintf( stderr, "Degree to meter not yet implemented" );
+ fprintf( stderr, "Degree to meter not yet implemented\n" );
break;
case pal::FOOT:
- fprintf( stderr, "Degree to foot not yet implemented" );
+ fprintf( stderr, "Degree to foot not yet implemented\n" );
break;
+ default:
+ fprintf( stderr, "Target unit undefined\n" );
+ return 0.0;
}
break;
+ default:
+ fprintf( stderr, "Source unit undefined" );
+ return 0.0;
+
}
- fprintf( stderr, "Unable to convert. Unknown units" );
+ fprintf( stderr, "Unable to convert. Unknown units\n" );
return 0.0;
}
Modified: trunk/qgis/src/core/qgspalobjectpositionmanager.cpp
===================================================================
--- trunk/qgis/src/core/qgspalobjectpositionmanager.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/qgspalobjectpositionmanager.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -67,7 +67,6 @@
}
//register the labeling objects in the layer
- QgsVectorOverlay* currentOverlay = 0;
int objectNr = 0;
QList<QgsVectorOverlay*>::const_iterator overlayIt = overlays.begin();
for ( ; overlayIt != overlays.end(); ++overlayIt )
@@ -114,6 +113,8 @@
case QGis::Degrees:
mapUnits = pal::DEGREE;
break;
+ default:
+ return;
}
mPositionEngine.setMapUnit( mapUnits );
std::list<pal::Label*>* resultLabelList = mPositionEngine.labeller( renderContext.rendererScale(), bbox, &stat, true );
Modified: trunk/qgis/src/core/spatialite/spatialite.c
===================================================================
--- trunk/qgis/src/core/spatialite/spatialite.c 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/core/spatialite/spatialite.c 2009-04-11 19:52:01 UTC (rev 10535)
@@ -1502,13 +1502,11 @@
char utf8buf[65536];
#if defined(__MINGW32__) || defined(_WIN32)
const char *pBuf;
- int len;
- int utf8len;
#else /* not MINGW32 - WIN32 */
char *pBuf;
+#endif
size_t len;
size_t utf8len;
-#endif
char *pUtf8buf;
iconv_t cvt = iconv_open (toCs, fromCs);
if (cvt == (iconv_t) - 1)
@@ -1554,13 +1552,11 @@
char *utf8buf = 0;
#if defined(__MINGW32__) || defined(_WIN32)
const char *pBuf;
- int len;
- int utf8len;
#else
char *pBuf;
+#endif
size_t len;
size_t utf8len;
-#endif
int maxlen = buflen * 4;
char *pUtf8buf;
*err = 0;
@@ -2727,10 +2723,10 @@
type = exifImportU16 (blob + offset + 2, endian_mode, endian_arch);
count = exifImportU32 (blob + offset + 4, endian_mode, endian_arch);
tag = malloc (sizeof (gaiaExifTag));
- tag->Gps = gps;
+ tag->Gps = (char) gps;
tag->TagId = tag_id;
tag->Type = type;
- tag->Count = count;
+ tag->Count = (unsigned short) count;
memcpy (tag->TagOffset, blob + offset + 8, 4);
tag->ByteValue = NULL;
tag->StringValue = NULL;
@@ -4228,14 +4224,11 @@
double y;
double dist;
int ind;
- for (ind = 0; ind < vert; ind++)
+
+ gaiaGetPoint (coords, 0, &xx1, &yy1);
+
+ for (ind = 1; ind < vert; ind++)
{
- if (ind == 0)
- {
- gaiaGetPoint (coords, ind, &xx1, &yy1);
- }
- else
- {
gaiaGetPoint (coords, ind, &xx2, &yy2);
x = xx1 - xx2;
y = yy1 - yy2;
@@ -4243,7 +4236,6 @@
lung += dist;
xx1 = xx2;
yy1 = yy2;
- }
}
return lung;
}
@@ -4371,10 +4363,6 @@
if (y > maxy)
maxy = y;
}
- if (x < minx || x > maxx)
- goto end; /* outside the bounding box (x axis) */
- if (y < miny || y > maxy)
- goto end; /* outside the bounding box (y axis) */
for (i = 0, j = cnt - 1; i < cnt; j = i++)
{
/* The definitive reference is "Point in Polyon Strategies" by
@@ -4383,14 +4371,13 @@
/ incorrect.
*/
if ((((vert_y[i] <= pt_y) && (pt_y < vert_y[j]))
- || ((vert_y[j] <= pt_y) && (y < vert_y[i])))
+ || ((vert_y[j] <= pt_y) && (pt_y < vert_y[i])))
&& (pt_x <
(vert_x[j] - vert_x[i]) * (pt_y - vert_y[i]) / (vert_y[j] -
vert_y[i]) +
vert_x[i]))
isInternal = !isInternal;
}
- end:
free (vert_x);
free (vert_y);
return isInternal;
@@ -6277,21 +6264,18 @@
{
/* checks for points */
return 0;
- point = point->Next;
}
line = geom->FirstLinestring;
while (line)
{
/* checks for linestrings */
return 0;
- line = line->Next;
}
polyg = geom->FirstPolygon;
while (polyg)
{
/* checks for polygons */
return 0;
- polyg = polyg->Next;
}
return 1;
}
@@ -9514,8 +9498,8 @@
*(buf_shp + 2) = 1;
*(buf_shp + 3) = 1;
gaiaExport32 (buf_shp + 4, dbf_recno, GAIA_LITTLE_ENDIAN, endian_arch); /* exports # records in this DBF */
- gaiaExport16 (buf_shp + 8, dbf_size, GAIA_LITTLE_ENDIAN, endian_arch); /* exports the file header size */
- gaiaExport16 (buf_shp + 10, dbf_reclen, GAIA_LITTLE_ENDIAN, endian_arch); /* exports the record length */
+ gaiaExport16 (buf_shp + 8, (short) dbf_size, GAIA_LITTLE_ENDIAN, endian_arch); /* exports the file header size */
+ gaiaExport16 (buf_shp + 10, (short) dbf_reclen, GAIA_LITTLE_ENDIAN, endian_arch); /* exports the record length */
fwrite (buf_shp, 1, 32, fl_dbf);
}
@@ -10531,8 +10515,8 @@
type = gaiaImport32 (blob + 39, little_endian, endian_arch);
geo = gaiaAllocGeomColl ();
geo->Srid = gaiaImport32 (blob + 2, little_endian, endian_arch);
- geo->endian_arch = endian_arch;
- geo->endian = little_endian;
+ geo->endian_arch = (char) endian_arch;
+ geo->endian = (char) little_endian;
geo->blob = blob;
geo->size = size;
geo->offset = 43;
@@ -10956,8 +10940,8 @@
type = gaiaImport32 (blob + 1, little_endian, endian_arch);
geo = gaiaAllocGeomColl ();
geo->Srid = -1;
- geo->endian_arch = endian_arch;
- geo->endian = little_endian;
+ geo->endian_arch = (char) endian_arch;
+ geo->endian = (char) little_endian;
geo->blob = blob;
geo->size = size;
geo->offset = 5;
@@ -11360,7 +11344,7 @@
unsigned int *consumed)
{
/* decoding a POLYGON Geometry from FGF */
- gaiaPolygonPtr pg;
+ gaiaPolygonPtr pg = NULL;
gaiaRingPtr rng;
int rings;
int ir;
@@ -13638,27 +13622,25 @@
char buf[256];
double x;
double y;
- double lastX;
- double lastY;
+ double lastX = 0.0;
+ double lastY = 0.0;
int iv;
for (iv = 0; iv < points; iv++)
{
gaiaGetPoint (coords, iv, &x, &y);
gaiaOutCheckBuffer (buffer, size);
+
+ sprintf (buf_x, "%.*f", precision, x - lastX);
+ gaiaOutClean (buf_x);
+ sprintf (buf_y, "%.*f", precision, lastY - y);
+ gaiaOutClean (buf_y);
+
if (iv == 0)
{
- sprintf (buf_x, "%.*f", precision, x);
- gaiaOutClean (buf_x);
- sprintf (buf_y, "%.*f", precision, y * -1);
- gaiaOutClean (buf_y);
sprintf (buf, "M %s %s l ", buf_x, buf_y);
}
else
{
- sprintf (buf_x, "%.*f", precision, (x - lastX));
- gaiaOutClean (buf_x);
- sprintf (buf_y, "%.*f", precision, (y - lastY) * -1);
- gaiaOutClean (buf_y);
sprintf (buf, "%s %s ", buf_x, buf_y);
}
lastX = x;
@@ -14008,10 +13990,10 @@
unsigned char *p_blob = NULL;
int n_bytes = 0;
int srid;
- int geom_srid;
+ int geom_srid = -1;
const unsigned char *type;
int xtype;
- int geom_type;
+ int geom_type = -1;
int ret;
if (sqlite3_value_type (argv[0]) == SQLITE_BLOB
|| sqlite3_value_type (argv[0]) == SQLITE_NULL)
@@ -14752,8 +14734,8 @@
len = strlen ((char *) colname);
curr_idx->ColumnName = malloc (len + 1);
strcpy (curr_idx->ColumnName, (char *) colname);
- curr_idx->ValidRtree = index;
- curr_idx->ValidCache = cached;
+ curr_idx->ValidRtree = (char) index;
+ curr_idx->ValidCache = (char) cached;
curr_idx->Next = NULL;
if (!first_idx)
first_idx = curr_idx;
@@ -21133,8 +21115,10 @@
int_value = sqlite3_value_int (argv[0]);
x = int_value;
}
- else
+ else {
sqlite3_result_null (context);
+ return;
+ }
tang = tan (x);
if (tang == 0.0)
{
@@ -21164,8 +21148,11 @@
x = int_value;
}
else
- sqlite3_result_null (context);
- x = x * 57.29577951308232;
+ {
+ sqlite3_result_null (context);
+ return;
+ }
+ x *= 57.29577951308232;
sqlite3_result_double (context, x);
}
@@ -21267,8 +21254,8 @@
/ or NULL if any error is encountered
*/
int int_value;
- double x;
- double b;
+ double x = 0.0;
+ double b = 1.0;
double log1;
double log2;
errno = 0;
@@ -22373,7 +22360,7 @@
spatialite_init (int verbose)
{
/* used when SQLite initializes SpatiaLite via statically linked lib */
- sqlite3_auto_extension ((void *) init_static_spatialite);
+ sqlite3_auto_extension ( (void (*)(void)) init_static_spatialite);
if (verbose)
{
printf ("SpatiaLite version ..: %s", spatialite_version ());
@@ -22863,9 +22850,7 @@
math_llabs (sqlite3_int64 value)
{
/* replacing the C99 llabs() function */
- double dbl = value;
- sqlite3_int64 int_value = fabs (dbl);
- return (int_value);
+ return value<0 ? -value : value;
}
SPATIALITE_DECLARE double
@@ -24403,8 +24388,6 @@
}
*ppVTab = (sqlite3_vtab *) p_vt;
return SQLITE_OK;
- *pzErr = sqlite3_mprintf ("%s", p_vt->Shp->LastError);
- return SQLITE_ERROR;
}
if (p_vt->Shp->
Shape == 3
@@ -25699,7 +25682,7 @@
int ia;
int index;
char code[256];
- int nodeId;
+ int nodeId = -1;
int arcs;
NetworkNodePtr pN;
NetworkArcPtr pA;
@@ -27968,13 +27951,13 @@
/* parsing the file, one char at each time */
if (c == '\r' && !is_string)
{
- last = c;
+ last = (char) c;
continue;
}
if (c == field_separator && !is_string)
{
/* insering a field into the fields tmp array */
- last = c;
+ last = (char) c;
*p = '\0';
len = strlen (buffer);
if (len)
@@ -27993,7 +27976,7 @@
if (is_string)
{
is_string = 0;
- last = c;
+ last = (char) c;
}
else
{
@@ -28003,7 +27986,7 @@
}
continue;
}
- last = c;
+ last = (char) c;
if (c == '\n' && !is_string)
{
/* inserting the row into the text buffer */
@@ -28032,7 +28015,7 @@
fld = 0;
continue;
}
- *p++ = c;
+ *p++ = (char) c;
}
fclose (in);
/* checking if the text file really seems to contain a table */
@@ -28207,7 +28190,7 @@
return NULL;
}
/* ok, we can now go to prepare the rows array */
- text->rows = malloc (sizeof (struct text_row *) * text->n_rows);
+ text->rows = malloc (sizeof (struct row_buffer *) * text->n_rows);
ir = 0;
row = text->first;
while (row)
Modified: trunk/qgis/src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
===================================================================
--- trunk/qgis/src/plugins/diagram_overlay/qgsdiagramoverlay.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/plugins/diagram_overlay/qgsdiagramoverlay.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -86,8 +86,6 @@
std::list<unsigned char*>::iterator bufferIt;
std::list<int>::iterator sizeIt;
- int multifeaturecounter = 0;
-
while ( theProvider->nextFeature( currentFeature ) )
{
//todo: insert more objects for multipart features
@@ -195,7 +193,7 @@
for ( int i = 0; i < classificationFieldList.size(); ++i )
{
bool conversionSuccess = false;
- int classificationField = classificationFieldList.at( i ).toElement().text().toInt( &conversionSuccess );
+ classificationFieldList.at( i ).toElement().text().toInt( &conversionSuccess );
if ( conversionSuccess )
{
classAttrList.push_back( classificationFieldList.at( i ).toElement().text().toInt() );
Modified: trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp
===================================================================
--- trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp 2009-04-11 19:41:20 UTC (rev 10534)
+++ trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp 2009-04-11 19:52:01 UTC (rev 10535)
@@ -42,7 +42,7 @@
QMap < QString, QgsSpatiaLiteProvider::SqliteHandles * >QgsSpatiaLiteProvider::SqliteHandles::handles;
QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ): QgsVectorDataProvider( uri ),
- geomType( QGis::WKBUnknown ), mSrid( -1 ), spatialIndexRTree( false ), spatialIndexMbrCache( false ), sqliteHandle( NULL ), sqliteStatement( NULL )
+ geomType( QGis::WKBUnknown ), mSrid( -1 ), spatialIndexRTree( false ), sqliteHandle( NULL ), spatialIndexMbrCache( false ), sqliteStatement( NULL )
{
QgsDataSourceURI mUri = QgsDataSourceURI( uri );
@@ -346,7 +346,6 @@
bool QgsSpatiaLiteProvider::nextFeature( QgsFeature & feature )
{
- char xSql[1024];
char geomName[128];
feature.setValid( false );
More information about the QGIS-commit
mailing list