Skip to content

Commit

Permalink
postgres provider: fix endianess detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 21, 2011
1 parent a21e1db commit c4258c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsidentifyresults.cpp
Expand Up @@ -802,7 +802,7 @@ void QgsIdentifyResults::highlightFeature( QTreeWidgetItem *item )
if ( mHighlights.contains( featItem ) )
return;

int fid = featItem->data( 0, Qt::UserRole ).toInt();
QgsFeatureId fid = featItem->data( 0, Qt::UserRole ).toInt();

QgsFeature feat;
if ( !layer->featureAtId( fid, feat, true, false ) )
Expand Down
9 changes: 5 additions & 4 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -461,9 +461,10 @@ qint64 QgsPostgresProvider::getBinaryInt( PGresult *queryResult, int row, int co
QString buf = "";
for ( size_t i = 0; i < s; i++ )
{
buf += QString( "%1 " ).arg( *( char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
buf += QString( "%1 " ).arg( *( unsigned char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
}
QgsDebugMsg( QString( "int in hex:%1" ).arg( buf ) );

QgsDebugMsgLevel( QString( "int in hex:%1" ).arg( buf ), 3 );

switch ( s )
{
Expand Down Expand Up @@ -530,7 +531,7 @@ bool QgsPostgresProvider::getFeature( PGresult *queryResult, int row, bool fetch
try
{
QgsFeatureId oid = getBinaryInt( queryResult, row, 0 );
QgsDebugMsg( QString( "oid=%1" ).arg( oid ) );
QgsDebugMsgLevel( QString( "oid=%1" ).arg( oid ), 3 );

feature.setFeatureId( oid );
feature.clearAttributeMap();
Expand Down Expand Up @@ -3145,7 +3146,7 @@ bool QgsPostgresProvider::deduceEndian()
QgsDebugMsg( QString( "First oid is %1" ).arg( oidValue ) );

// compare the two oid values to determine if we need to do an endian swap
if ( oid == oidValue.toLongLong() )
if ( oid != oidValue.toLongLong() )
swapEndian = false;
}
connectionRO->closeCursor( "oidcursor" );
Expand Down

0 comments on commit c4258c9

Please sign in to comment.