Skip to content
Permalink
Browse files

Make all QgsGeometry methods return values, not pointers

Reduces likelihood of crashes and leaks
  • Loading branch information
nyalldawson committed Aug 1, 2016
1 parent bd7d913 commit 4b78b1c20828936cba8a673da734b8b9e7adb8d6
Showing with 1,158 additions and 1,562 deletions.
  1. +9 −1 doc/api_break.dox
  2. +2 −2 python/analysis/vector/qgsgeometryanalyzer.sip
  3. +36 −34 python/core/geometry/qgsgeometry.sip
  4. +2 −2 python/core/qgsgeometrysimplifier.sip
  5. +1 −1 python/core/qgsmaptopixelgeometrysimplifier.sip
  6. +2 −2 python/core/qgsogcutils.sip
  7. +1 −1 python/core/qgspallabeling.sip
  8. +1 −1 python/gui/qgsrubberband.sip
  9. +1 −3 src/analysis/interpolation/DualEdgeTriangulation.cc
  10. +5 −9 src/analysis/openstreetmap/qgsosmdatabase.cpp
  11. +50 −73 src/analysis/vector/qgsgeometryanalyzer.cpp
  12. +5 −5 src/analysis/vector/qgsgeometryanalyzer.h
  13. +3 −8 src/analysis/vector/qgspointsample.cpp
  14. +32 −65 src/analysis/vector/qgstransectsample.cpp
  15. +4 −5 src/analysis/vector/qgszonalstatistics.cpp
  16. +3 −3 src/app/nodetool/qgsnodeeditor.cpp
  17. +4 −7 src/app/qgisapp.cpp
  18. +1 −3 src/app/qgsattributetabledialog.cpp
  19. +3 −4 src/app/qgsclipboard.cpp
  20. +4 −5 src/app/qgsmaptooladdfeature.cpp
  21. +6 −12 src/app/qgsmaptooldeletepart.cpp
  22. +1 −1 src/app/qgsmaptooldeletepart.h
  23. +10 −13 src/app/qgsmaptooldeletering.cpp
  24. +1 −1 src/app/qgsmaptooldeletering.h
  25. +2 −3 src/app/qgsmaptoolfillring.cpp
  26. +2 −3 src/app/qgsmaptoollabel.cpp
  27. +3 −6 src/app/qgsmaptoolmovefeature.cpp
  28. +2 −6 src/app/qgsmaptooloffsetcurve.cpp
  29. +2 −4 src/app/qgsmaptoolpinlabels.cpp
  30. +3 −5 src/app/qgsmaptoolrotatefeature.cpp
  31. +2 −2 src/app/qgsmaptoolselect.cpp
  32. +1 −2 src/app/qgsmaptoolselectfreehand.cpp
  33. +1 −2 src/app/qgsmaptoolselectpolygon.cpp
  34. +1 −2 src/app/qgsmaptoolselectradius.cpp
  35. +1 −3 src/app/qgsmaptoolselectrectangle.cpp
  36. +15 −15 src/app/qgsmaptoolselectutils.cpp
  37. +4 −4 src/app/qgsmaptoolselectutils.h
  38. +3 −3 src/app/qgsmaptoolshowhidelabels.cpp
  39. +9 −10 src/app/qgsmaptoolsimplify.cpp
  40. +2 −3 src/core/composer/qgscomposermap.cpp
  41. +14 −26 src/core/composer/qgscomposermapgrid.cpp
  42. +125 −203 src/core/geometry/qgsgeometry.cpp
  43. +33 −57 src/core/geometry/qgsgeometry.h
  44. +35 −49 src/core/qgsexpression.cpp
  45. +2 −3 src/core/qgsexpressioncontext.cpp
  46. +5 −10 src/core/qgsgeometrysimplifier.cpp
  47. +2 −2 src/core/qgsgeometrysimplifier.h
  48. +1 −3 src/core/qgsgml.cpp
  49. +3 −4 src/core/qgslabelingenginev2.cpp
  50. +3 −9 src/core/qgsmaptopixelgeometrysimplifier.cpp
  51. +1 −1 src/core/qgsmaptopixelgeometrysimplifier.h
  52. +2 −3 src/core/qgsofflineediting.cpp
  53. +63 −68 src/core/qgsogcutils.cpp
  54. +8 −8 src/core/qgsogcutils.h
  55. +12 −15 src/core/qgspallabeling.cpp
  56. +2 −1 src/core/qgspallabeling.h
  57. +2 −2 src/core/qgspointlocator.cpp
  58. +6 −8 src/core/qgssnappingutils.cpp
  59. +2 −3 src/core/qgstracer.cpp
  60. +6 −6 src/core/qgsvectorlayerdiagramprovider.cpp
  61. +1 −1 src/core/qgsvectorlayerlabelprovider.cpp
  62. +6 −13 src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
  63. +2 −3 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  64. +19 −28 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  65. +2 −3 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  66. +7 −13 src/gui/qgsmapcanvassnapper.cpp
  67. +2 −2 src/gui/qgsrubberband.cpp
  68. +1 −1 src/gui/qgsrubberband.h
  69. +1 −3 src/plugins/roadgraph/shortestpathwidget.cpp
  70. +7 −7 src/plugins/topology/checkDock.cpp
  71. +19 −20 src/plugins/topology/topolError.cpp
  72. +19 −19 src/plugins/topology/topolError.h
  73. +67 −96 src/plugins/topology/topolTest.cpp
  74. +16 −19 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  75. +3 −3 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h
  76. +13 −16 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  77. +1 −1 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  78. +1 −3 src/providers/grass/qgis.v.in.cpp
  79. +0 −3 src/providers/memory/qgsmemoryfeatureiterator.cpp
  80. +2 −1 src/providers/memory/qgsmemoryfeatureiterator.h
  81. +1 −3 src/providers/oracle/qgsoracleprovider.cpp
  82. +5 −9 src/providers/wfs/qgswfsshareddata.cpp
  83. +18 −31 src/server/qgswfsserver.cpp
  84. +6 −7 src/server/qgswmsconfigparser.cpp
  85. +4 −6 tests/src/app/testqgsattributetable.cpp
  86. +4 −6 tests/src/app/testqgsfieldcalculator.cpp
  87. +6 −9 tests/src/app/testqgsmaptoolidentifyaction.cpp
  88. +7 −7 tests/src/core/testqgsdistancearea.cpp
  89. +99 −130 tests/src/core/testqgsexpression.cpp
  90. +28 −16 tests/src/core/testqgsfeature.cpp
  91. +135 −133 tests/src/core/testqgsgeometry.cpp
  92. +6 −8 tests/src/core/testqgsgeometryimport.cpp
  93. +15 −21 tests/src/core/testqgslegendrenderer.cpp
  94. +2 −3 tests/src/core/testqgsmaprendererjob.cpp
  95. +7 −7 tests/src/core/testqgsmaptopixelgeometrysimplifier.cpp
  96. +16 −17 tests/src/core/testqgsogcutils.cpp
  97. +4 −6 tests/src/core/testqgspointlocator.cpp
  98. +6 −9 tests/src/core/testqgssnappingutils.cpp
  99. +6 −9 tests/src/core/testqgsspatialindex.cpp
  100. +6 −9 tests/src/core/testqgstracer.cpp
  101. +12 −37 tests/src/core/testqgsvectorfilewriter.cpp
  102. +8 −8 tests/src/gui/testqgsrubberband.cpp
  103. +1 −1 tests/src/providers/grass/testqgsgrassprovider.cpp
@@ -226,10 +226,18 @@ true, as the method will return an empty geometry if the feature has no geometry
<li>setFields( const QgsFields*, bool ) has been removed, use setFields( const QgsFields&, bool ) instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGeometry QgsGeometry

<ul>
<li>All QgsGeometry methods now accept geometry references instead of pointers, and return a QgsGeometry
value instead of a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGeometryAnalyzer QgsGeometryAnalyzer

<ul>
<li>locateBetweenMeasures() and locateAlongMeasure() now take geometry references, not pointers</li>
<li>locateBetweenMeasures() and locateAlongMeasure() now take geometry references, not pointers, and return
a QgsGeometry value rather than a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGroupWMSDataDialog QgsGroupWMSDataDialog
@@ -95,10 +95,10 @@ class QgsGeometryAnalyzer
bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = 0, QProgressDialog* p = 0 );

/** Returns linear reference geometry as a multiline (or 0 if no match). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)*/
QgsGeometry* locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry& lineGeom );
QgsGeometry locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry& lineGeom );
/** Returns linear reference geometry. Unlike the PostGIS function, this method always returns multipoint or 0 if no match (not geometry collection).
* Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)
*/
QgsGeometry* locateAlongMeasure( double measure, const QgsGeometry& lineGeom );
QgsGeometry locateAlongMeasure( double measure, const QgsGeometry& lineGeom );

};
@@ -65,21 +65,21 @@ class QgsGeometry
bool isEmpty() const;

/** Creates a new geometry from a WKT string */
static QgsGeometry* fromWkt( const QString& wkt ) /Factory/;
static QgsGeometry fromWkt( const QString& wkt );
/** Creates a new geometry from a QgsPoint object*/
static QgsGeometry* fromPoint( const QgsPoint& point ) /Factory/;
static QgsGeometry fromPoint( const QgsPoint& point );
/** Creates a new geometry from a QgsMultiPoint object */
static QgsGeometry* fromMultiPoint( const QgsMultiPoint& multipoint ) /Factory/;
static QgsGeometry fromMultiPoint( const QgsMultiPoint& multipoint );
/** Creates a new geometry from a QgsPolyline object */
static QgsGeometry* fromPolyline( const QgsPolyline& polyline ) /Factory/;
static QgsGeometry fromPolyline( const QgsPolyline& polyline );
/** Creates a new geometry from a QgsMultiPolyline object*/
static QgsGeometry* fromMultiPolyline( const QgsMultiPolyline& multiline ) /Factory/;
static QgsGeometry fromMultiPolyline( const QgsMultiPolyline& multiline );
/** Creates a new geometry from a QgsPolygon */
static QgsGeometry* fromPolygon( const QgsPolygon& polygon ) /Factory/;
static QgsGeometry fromPolygon( const QgsPolygon& polygon );
/** Creates a new geometry from a QgsMultiPolygon */
static QgsGeometry* fromMultiPolygon( const QgsMultiPolygon& multipoly ) /Factory/;
static QgsGeometry fromMultiPolygon( const QgsMultiPolygon& multipoly );
/** Creates a new geometry from a QgsRectangle */
static QgsGeometry* fromRect( const QgsRectangle& rect ) /Factory/;
static QgsGeometry fromRect( const QgsRectangle& rect );

/**
* Set the geometry, feeding in a geometry in GEOS format.
@@ -408,42 +408,42 @@ class QgsGeometry
bool intersects( const QgsRectangle& r ) const;

/** Test for intersection with a geometry (uses GEOS) */
bool intersects( const QgsGeometry* geometry ) const;
bool intersects( const QgsGeometry& geometry ) const;

/** Test for containment of a point (uses GEOS) */
bool contains( const QgsPoint* p ) const;

/** Test for if geometry is contained in another (uses GEOS)
* @note added in 1.5 */
bool contains( const QgsGeometry* geometry ) const;
bool contains( const QgsGeometry& geometry ) const;

/** Test for if geometry is disjoint of another (uses GEOS)
* @note added in 1.5 */
bool disjoint( const QgsGeometry* geometry ) const;
bool disjoint( const QgsGeometry& geometry ) const;

/** Test for if geometry equals another (uses GEOS)
* @note added in 1.5 */
bool equals( const QgsGeometry* geometry ) const;
bool equals( const QgsGeometry& geometry ) const;

/** Test for if geometry touch another (uses GEOS)
* @note added in 1.5 */
bool touches( const QgsGeometry* geometry ) const;
bool touches( const QgsGeometry& geometry ) const;

/** Test for if geometry overlaps another (uses GEOS)
* @note added in 1.5 */
bool overlaps( const QgsGeometry* geometry ) const;
bool overlaps( const QgsGeometry& geometry ) const;

/** Test for if geometry is within another (uses GEOS)
* @note added in 1.5 */
bool within( const QgsGeometry* geometry ) const;
bool within( const QgsGeometry& geometry ) const;

/** Test for if geometry crosses another (uses GEOS)
* @note added in 1.5 */
bool crosses( const QgsGeometry* geometry ) const;
bool crosses( const QgsGeometry& geometry ) const;

/** Returns a buffer region around this geometry having the given width and with a specified number
of segments used to approximate curves */
QgsGeometry* buffer( double distance, int segments ) const /Factory/;
QgsGeometry buffer( double distance, int segments ) const;

/** Returns a buffer region around the geometry, with additional style options.
* @param distance buffer distance
@@ -454,44 +454,44 @@ class QgsGeometry
* @note added in 2.4
* @note needs GEOS >= 3.3 - otherwise always returns 0
*/
QgsGeometry* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit ) const /Factory/;
QgsGeometry buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit ) const;

/** Returns an offset line at a given distance and side from an input line.
* See buffer() method for details on parameters.
* @note added in 2.4
* @note needs GEOS >= 3.3 - otherwise always returns 0
*/
QgsGeometry* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const /Factory/;
QgsGeometry offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const;

/** Returns a simplified version of this geometry using a specified tolerance value */
QgsGeometry* simplify( double tolerance ) const /Factory/;
QgsGeometry simplify( double tolerance ) const;

/** Returns the center of mass of a geometry
* @note for line based geometries, the center point of the line is returned,
* and for point based geometries, the point itself is returned
*/
QgsGeometry* centroid() const /Factory/;
QgsGeometry centroid() const;

/** Returns a point within a geometry */
QgsGeometry* pointOnSurface() const /Factory/;
QgsGeometry pointOnSurface() const;

/** Returns the smallest convex polygon that contains all the points in the geometry. */
QgsGeometry* convexHull() const /Factory/;
QgsGeometry convexHull() const;

/**
* Return interpolated point on line at distance
* @note added in 1.9
*/
QgsGeometry* interpolate( double distance ) /Factory/;
QgsGeometry interpolate( double distance );

/** Returns a geometry representing the points shared by this geometry and other. */
QgsGeometry* intersection( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry intersection( const QgsGeometry& geometry ) const;

/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
* @note this operation is not called union since its a reserved word in C++.
*/
QgsGeometry* combine( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry combine( const QgsGeometry& geometry ) const;

/** Merges any connected lines in a LineString/MultiLineString geometry and
* converts them to single line strings.
@@ -503,10 +503,10 @@ class QgsGeometry
QgsGeometry mergeLines() const;

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* difference( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry difference( const QgsGeometry& geometry ) const;

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* symDifference( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry symDifference( const QgsGeometry& geometry ) const;

/** Returns an extruded version of this geometry. */
QgsGeometry extrude( double x, double y );
@@ -531,7 +531,7 @@ class QgsGeometry
* @return the converted geometry or nullptr if the conversion fails.
* @note added in 2.2
*/
QgsGeometry* convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const /Factory/;
QgsGeometry convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const;

/* Accessor functions for getting geometry data */

@@ -564,7 +564,7 @@ class QgsGeometry

/** Return contents of the geometry as a list of geometries
@note added in version 1.1 */
QList<QgsGeometry*> asGeometryCollection() const /Factory/;
QList<QgsGeometry> asGeometryCollection() const;

/** Return contents of the geometry as a QPointF if wkbType is WKBPoint,
* otherwise returns a null QPointF.
@@ -643,7 +643,7 @@ class QgsGeometry
* @param geometryList a list of QgsGeometry* as input
* @returns the new computed QgsGeometry, or null
*/
static QgsGeometry *unaryUnion( const QList<QgsGeometry*>& geometryList ) /Factory/;
static QgsGeometry unaryUnion( const QList<QgsGeometry>& geometryList );

/** Converts the geometry to straight line segments, if it is a curved geometry type.
* @note added in QGIS 2.10
@@ -704,15 +704,15 @@ class QgsGeometry
* @param point source QPointF
* @note added in QGIS 2.7
*/
static QgsGeometry* fromQPointF( QPointF point ) /Factory/;
static QgsGeometry fromQPointF( QPointF point );

/** Construct geometry from a QPolygonF. If the polygon is closed than
* the resultant geometry will be a polygon, if it is open than the
* geometry will be a polyline.
* @param polygon source QPolygonF
* @note added in QGIS 2.7
*/
static QgsGeometry* fromQPolygonF( const QPolygonF& polygon ) /Factory/;
static QgsGeometry fromQPolygonF( const QPolygonF& polygon );

/** Creates a QgsPolyline from a QPolygonF.
* @param polygon source polygon
@@ -768,7 +768,7 @@ class QgsGeometry
* of the geometry for each iteration. Smaller values result in "tighter" smoothing.
* @note added in 2.9
*/
QgsGeometry* smooth( const unsigned int iterations, const double offset ) const;
QgsGeometry smooth( const unsigned int iterations, const double offset ) const;

/** Smooths a polygon using the Chaikin algorithm*/
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;
@@ -794,5 +794,7 @@ class QgsGeometry
//! Allows direct construction of QVariants from geometry.
operator QVariant() const;

operator bool() const;

}; // class QgsGeometry

@@ -12,7 +12,7 @@ class QgsAbstractGeometrySimplifier
virtual ~QgsAbstractGeometrySimplifier();

//! Returns a simplified version the specified geometry
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const = 0;
virtual QgsGeometry simplify( const QgsGeometry& geometry ) const = 0;
//! Simplifies the specified geometry
virtual bool simplifyGeometry( QgsGeometry* geometry ) const = 0;

@@ -41,7 +41,7 @@ class QgsTopologyPreservingSimplifier : QgsAbstractGeometrySimplifier
virtual ~QgsTopologyPreservingSimplifier();

//! Returns a simplified version the specified geometry
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const;
virtual QgsGeometry simplify( const QgsGeometry& geometry ) const;
//! Simplifies the specified geometry
virtual bool simplifyGeometry( QgsGeometry* geometry ) const;
};
@@ -44,7 +44,7 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm );

//! Returns a simplified version the specified geometry
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const;
virtual QgsGeometry simplify( const QgsGeometry& geometry ) const;
//! Simplifies the specified geometry
virtual bool simplifyGeometry( QgsGeometry* geometry ) const;

@@ -13,11 +13,11 @@ class QgsOgcUtils
in default namespace (\verbatim {<Point>...</Point> \endverbatim) or in
"gml" namespace (\verbatim <gml:Point>...</gml:Point> \endverbatim)
*/
static QgsGeometry* geometryFromGML( const QString& xmlString ) /Factory/;
static QgsGeometry geometryFromGML( const QString& xmlString );

/** Static method that creates geometry from GML
*/
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode ) /Factory/;
static QgsGeometry geometryFromGML( const QDomNode& geometryNode );

/** Read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
@@ -742,7 +742,7 @@ class QgsPalLayerSettings

QgsPoint ptZero;
QgsPoint ptOne;
QgsGeometry* extentGeom;
QgsGeometry extentGeom;
int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL)
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
@@ -221,7 +221,7 @@ class QgsRubberBand: QgsMapCanvasItem
* Returns the rubberband as a Geometry.
* @return A geometry object which reflects the current state of the rubberband.
*/
QgsGeometry* asGeometry();
QgsGeometry asGeometry() const;

virtual void updatePosition();

@@ -3138,9 +3138,7 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString& fileName ) const
QgsPolyline lineGeom;
lineGeom.push_back( QgsPoint( p1->getX(), p1->getY() ) );
lineGeom.push_back( QgsPoint( p2->getX(), p2->getY() ) );
QgsGeometry* geom = QgsGeometry::fromPolyline( lineGeom );
edgeLineFeature.setGeometry( *geom );
delete geom;
edgeLineFeature.setGeometry( QgsGeometry::fromPolyline( lineGeom ) );
edgeLineFeature.initAttributes( 1 );

//attributes
@@ -410,7 +410,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
if ( skipNull )
continue;

QgsGeometry* geom = QgsGeometry::fromPoint( n.point() );
QgsGeometry geom = QgsGeometry::fromPoint( n.point() );
int col = 0;
sqlite3_bind_int64( stmtInsert, ++col, n.id() );

@@ -423,19 +423,17 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
sqlite3_bind_null( stmtInsert, ++col );
}

sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), ( int ) geom->wkbSize(), SQLITE_STATIC );
sqlite3_bind_blob( stmtInsert, ++col, geom.asWkb(), ( int ) geom.wkbSize(), SQLITE_STATIC );

int insertRes = sqlite3_step( stmtInsert );
if ( insertRes != SQLITE_DONE )
{
mError = QString( "Error inserting node %1 [%2]" ).arg( n.id() ).arg( insertRes );
delete geom;
break;
}

sqlite3_reset( stmtInsert );
sqlite3_clear_bindings( stmtInsert );
delete geom;
}

sqlite3_finalize( stmtInsert );
@@ -492,7 +490,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
if ( skipNull )
continue;

QgsGeometry* geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline );
QgsGeometry geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline );
int col = 0;
sqlite3_bind_int64( stmtInsert, ++col, w.id() );

@@ -505,22 +503,20 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
sqlite3_bind_null( stmtInsert, ++col );
}

if ( geom )
sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), ( int ) geom->wkbSize(), SQLITE_STATIC );
if ( !geom.isEmpty() )
sqlite3_bind_blob( stmtInsert, ++col, geom.asWkb(), ( int ) geom.wkbSize(), SQLITE_STATIC );
else
sqlite3_bind_null( stmtInsert, ++col );

int insertRes = sqlite3_step( stmtInsert );
if ( insertRes != SQLITE_DONE )
{
mError = QString( "Error inserting way %1 [%2]" ).arg( w.id() ).arg( insertRes );
delete geom;
break;
}

sqlite3_reset( stmtInsert );
sqlite3_clear_bindings( stmtInsert );
delete geom;
}

sqlite3_finalize( stmtInsert );

0 comments on commit 4b78b1c

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