Skip to content

Commit c4258c9

Browse files
committed
postgres provider: fix endianess detection
1 parent a21e1db commit c4258c9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/app/qgsidentifyresults.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ void QgsIdentifyResults::highlightFeature( QTreeWidgetItem *item )
802802
if ( mHighlights.contains( featItem ) )
803803
return;
804804

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

807807
QgsFeature feat;
808808
if ( !layer->featureAtId( fid, feat, true, false ) )

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,10 @@ qint64 QgsPostgresProvider::getBinaryInt( PGresult *queryResult, int row, int co
461461
QString buf = "";
462462
for ( size_t i = 0; i < s; i++ )
463463
{
464-
buf += QString( "%1 " ).arg( *( char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
464+
buf += QString( "%1 " ).arg( *( unsigned char * )( p + i ), 0, 16, QLatin1Char( ' ' ) );
465465
}
466-
QgsDebugMsg( QString( "int in hex:%1" ).arg( buf ) );
466+
467+
QgsDebugMsgLevel( QString( "int in hex:%1" ).arg( buf ), 3 );
467468

468469
switch ( s )
469470
{
@@ -530,7 +531,7 @@ bool QgsPostgresProvider::getFeature( PGresult *queryResult, int row, bool fetch
530531
try
531532
{
532533
QgsFeatureId oid = getBinaryInt( queryResult, row, 0 );
533-
QgsDebugMsg( QString( "oid=%1" ).arg( oid ) );
534+
QgsDebugMsgLevel( QString( "oid=%1" ).arg( oid ), 3 );
534535

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

31473148
// compare the two oid values to determine if we need to do an endian swap
3148-
if ( oid == oidValue.toLongLong() )
3149+
if ( oid != oidValue.toLongLong() )
31493150
swapEndian = false;
31503151
}
31513152
connectionRO->closeCursor( "oidcursor" );

0 commit comments

Comments
 (0)