Skip to content

Commit 514d443

Browse files
committed
Fix oracle provider and remove dead code
1 parent 9872b48 commit 514d443

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

src/core/qgspallabeling.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,11 +3407,6 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry& geometry, QgsRen
34073407
}
34083408
}
34093409

3410-
// MD: exporting geometry to GEOS just to see if the geometry is wrong...?
3411-
// if still needed, we could have a more specific test here
3412-
//if ( !geom.asGeos() )
3413-
// return QgsGeometry(); // there is something really wrong with the geometry
3414-
34153410
// fix invalid polygons
34163411
if ( geom.type() == QgsWkbTypes::PolygonGeometry && !geom.isGeosValid() )
34173412
{

src/providers/oracle/qgsoraclefeatureiterator.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,8 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
270270
QByteArray *ba = static_cast<QByteArray*>( mQry.value( col++ ).data() );
271271
if ( ba->size() > 0 )
272272
{
273-
unsigned char *copy = new unsigned char[ba->size()];
274-
memcpy( copy, ba->constData(), ba->size() );
275-
276273
QgsGeometry g;
277-
g.fromWkb( copy, ba->size() );
274+
g.fromWkb( *ba );
278275
feature.setGeometry( g );
279276
}
280277
else
@@ -381,13 +378,9 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
381378
QByteArray *ba = static_cast<QByteArray*>( v.data() );
382379
if ( ba->size() > 0 )
383380
{
384-
unsigned char *copy = new unsigned char[ba->size()];
385-
memcpy( copy, ba->constData(), ba->size() );
386-
387-
QgsGeometry *g = new QgsGeometry();
388-
g->fromWkb( copy, ba->size() );
389-
v = g->exportToWkt();
390-
delete g;
381+
QgsGeometry g;
382+
g.fromWkb( *ba );
383+
v = g.exportToWkt();
391384
}
392385
else
393386
{

src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,8 +1856,10 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry& geom, QSqlQuery &qry
18561856
{
18571857
QOCISpatialGeometry g;
18581858

1859+
QByteArray wkb = geom.exportToWkb();
1860+
18591861
wkbPtr ptr;
1860-
ptr.ucPtr = !geom.isEmpty() ? ( unsigned char * ) geom.asWkb() : 0;
1862+
ptr.ucPtr = !geom.isEmpty() ? reinterpret_cast< unsigned char * >( const_cast<char *>( wkb.constData() ) ) : 0;
18611863
g.isNull = !ptr.ucPtr;
18621864
g.gtype = -1;
18631865
g.srid = mSrid < 1 ? -1 : mSrid;
@@ -2274,10 +2276,8 @@ QgsRectangle QgsOracleProvider::extent() const
22742276
if ( ok && qry.next() )
22752277
{
22762278
QByteArray *ba = static_cast<QByteArray*>( qry.value( 0 ).data() );
2277-
unsigned char *copy = new unsigned char[ba->size()];
2278-
memcpy( copy, ba->constData(), ba->size() );
22792279
QgsGeometry g;
2280-
g.fromWkb( copy, ba->size() ); // take ownership
2280+
g.fromWkb( *ba );
22812281
mLayerExtent = g.boundingBox();
22822282
QgsDebugMsg( "extent: " + mLayerExtent.toString() );
22832283
}

0 commit comments

Comments
 (0)