Skip to content

Commit

Permalink
fix compile error (don't reference std namespace)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11604 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 9, 2009
1 parent f38c80d commit eac5851
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/providers/osm/osmprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include <QDateTime>
#include <QByteArray>

using namespace std;


static const QString TEXT_PROVIDER_KEY = "osm";
static const QString TEXT_PROVIDER_DESCRIPTION = "Open Street Map data provider";
static const QString DATE_TIME_FMT = "dd.MM.yyyy HH:mm:ss";
Expand Down Expand Up @@ -587,11 +584,11 @@ bool QgsOSMDataProvider::fetchNode( QgsFeature& feature, sqlite3_stmt* stmt, boo
if ( fetchGeometry )
{
char* geo = new char[21];
std::memset( geo, 0, 21 );
memset( geo, 0, 21 );
geo[0] = QgsApplication::endian();
geo[geo[0] == QgsApplication::NDR ? 1 : 4] = QGis::WKBPoint;
std::memcpy( geo + 5, &selLon, sizeof( double ) );
std::memcpy( geo + 13, &selLat, sizeof( double ) );
memcpy( geo + 5, &selLon, sizeof( double ) );
memcpy( geo + 13, &selLat, sizeof( double ) );
feature.setGeometryAndOwnership(( unsigned char * )geo, 24 ); // 24 is size of wkb point structure!
}

Expand Down Expand Up @@ -1017,11 +1014,11 @@ bool QgsOSMDataProvider::updateWayWKB( int wayId, int isClosed, char **geo, int
( *geo ) = new char[9 + 16 * memberCnt];
( *geolen ) = 9 + 16 * memberCnt;

std::memset(( *geo ), 0, 9 + 16 * memberCnt );
memset(( *geo ), 0, 9 + 16 * memberCnt );

( *geo )[0] = QgsApplication::endian();
( *geo )[( *geo )[0] == QgsApplication::NDR ? 1 : 4] = QGis::WKBLineString;
std::memcpy(( *geo ) + 5, &memberCnt, 4 );
memcpy(( *geo ) + 5, &memberCnt, 4 );

sqlite3_bind_int( stmtSelectMembers, 1, wayId );

Expand All @@ -1043,8 +1040,8 @@ bool QgsOSMDataProvider::updateWayWKB( int wayId, int isClosed, char **geo, int
if ( selLat > maxLat ) maxLat = selLat;
if ( selLon > maxLon ) maxLon = selLon;

std::memcpy(( *geo ) + 9 + 16 * i, &selLon, sizeof( double ) );
std::memcpy(( *geo ) + 9 + 16 * i + 8, &selLat, sizeof( double ) );
memcpy(( *geo ) + 9 + 16 * i, &selLon, sizeof( double ) );
memcpy(( *geo ) + 9 + 16 * i + 8, &selLat, sizeof( double ) );
i++;
}

Expand All @@ -1057,11 +1054,11 @@ bool QgsOSMDataProvider::updateWayWKB( int wayId, int isClosed, char **geo, int
memberCnt++;
( *geo ) = new char[13 + 16 * memberCnt];
( *geolen ) = 13 + 16 * memberCnt;
std::memset(( *geo ), 0, 13 + 16 * memberCnt );
memset(( *geo ), 0, 13 + 16 * memberCnt );
( *geo )[0] = QgsApplication::endian();
( *geo )[( *geo )[0] == QgsApplication::NDR ? 1 : 4] = QGis::WKBPolygon;
std::memcpy(( *geo ) + 5, &ringsCnt, 4 );
std::memcpy(( *geo ) + 9, &memberCnt, 4 );
memcpy(( *geo ) + 5, &ringsCnt, 4 );
memcpy(( *geo ) + 9, &memberCnt, 4 );

sqlite3_bind_int( stmtSelectMembers, 1, wayId );

Expand All @@ -1085,8 +1082,8 @@ bool QgsOSMDataProvider::updateWayWKB( int wayId, int isClosed, char **geo, int
if ( selLat > maxLat ) maxLat = selLat;
if ( selLon > maxLon ) maxLon = selLon;

std::memcpy(( *geo ) + 13 + 16 * i, &selLon, sizeof( double ) );
std::memcpy(( *geo ) + 13 + 16 * i + 8, &selLat, sizeof( double ) );
memcpy(( *geo ) + 13 + 16 * i, &selLon, sizeof( double ) );
memcpy(( *geo ) + 13 + 16 * i + 8, &selLat, sizeof( double ) );

if ( firstLat == -1000.0 )
firstLat = selLat;
Expand All @@ -1095,8 +1092,8 @@ bool QgsOSMDataProvider::updateWayWKB( int wayId, int isClosed, char **geo, int
i++;
}
// add last polygon line
std::memcpy(( *geo ) + 13 + 16 * i, &firstLon, sizeof( double ) );
std::memcpy(( *geo ) + 13 + 16 * i + 8, &firstLat, sizeof( double ) );
memcpy(( *geo ) + 13 + 16 * i, &firstLon, sizeof( double ) );
memcpy(( *geo ) + 13 + 16 * i + 8, &firstLat, sizeof( double ) );

sqlite3_bind_blob( stmtUpdateWay, 1, ( *geo ), 13 + 16 * memberCnt, SQLITE_TRANSIENT );
}
Expand Down Expand Up @@ -1368,7 +1365,7 @@ bool QgsOSMDataProvider::loadOsmFile( QString osm_filename )

if ( sqlite3_exec( mDatabase, ptr, 0, 0, 0 ) != SQLITE_OK )
{
cout << "Storing osm-file-last-modified info into database failed." << endl;
QgsDebugMsg( "Storing osm-file-last-modified info into database failed." );
// its not fatal situation, lets continue..
}

Expand All @@ -1378,7 +1375,7 @@ bool QgsOSMDataProvider::loadOsmFile( QString osm_filename )

if ( sqlite3_exec( mDatabase, ptr2, 0, 0, 0 ) != SQLITE_OK )
{
cout << "Storing osm-provider-version info into database failed." << endl;
QgsDebugMsg( "Storing osm-provider-version info into database failed." );
return false;
}

Expand All @@ -1396,7 +1393,7 @@ bool QgsOSMDataProvider::loadOsmFile( QString osm_filename )

if ( sqlite3_exec( mDatabase, ptr3, 0, 0, 0 ) != SQLITE_OK )
{
cout << "Storing default area boundaries information into database failed." << endl;
QgsDebugMsg( "Storing default area boundaries information into database failed." );
// its not critical situation
}

Expand Down

0 comments on commit eac5851

Please sign in to comment.