Skip to content

Commit 35e5370

Browse files
committedJul 26, 2012
postgres provider: fix signess of 64 bit fields
1 parent 9047367 commit 35e5370

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ int QgsPostgresConn::PQsendQuery( QString query )
878878

879879
qint64 QgsPostgresConn::getBinaryInt( QgsPostgresResult &queryResult, int row, int col )
880880
{
881-
qint64 oid;
881+
quint64 oid;
882882
char *p = PQgetvalue( queryResult.result(), row, col );
883883
size_t s = PQgetlength( queryResult.result(), row, col );
884884

@@ -895,15 +895,15 @@ qint64 QgsPostgresConn::getBinaryInt( QgsPostgresResult &queryResult, int row, i
895895
switch ( s )
896896
{
897897
case 2:
898-
oid = *( qint16 * )p;
898+
oid = *( quint16 * )p;
899899
if ( mSwapEndian )
900900
oid = ntohs( oid );
901901
break;
902902

903903
case 6:
904904
{
905-
qint64 block = *( qint32 * ) p;
906-
qint64 offset = *( qint16 * )( p + sizeof( qint32 ) );
905+
quint64 block = *( quint32 * ) p;
906+
quint64 offset = *( quint16 * )( p + sizeof( quint32 ) );
907907

908908
if ( mSwapEndian )
909909
{
@@ -917,8 +917,8 @@ qint64 QgsPostgresConn::getBinaryInt( QgsPostgresResult &queryResult, int row, i
917917

918918
case 8:
919919
{
920-
qint32 oid0 = *( qint32 * ) p;
921-
qint32 oid1 = *( qint32 * )( p + sizeof( qint32 ) );
920+
quint32 oid0 = *( quint32 * ) p;
921+
quint32 oid1 = *( quint32 * )( p + sizeof( quint32 ) );
922922

923923
if ( mSwapEndian )
924924
{
@@ -941,7 +941,7 @@ qint64 QgsPostgresConn::getBinaryInt( QgsPostgresResult &queryResult, int row, i
941941
QgsDebugMsg( QString( "unexpected size %1" ).arg( s ) );
942942

943943
case 4:
944-
oid = *( qint32 * )p;
944+
oid = *( quint32 * )p;
945945
if ( mSwapEndian )
946946
oid = ntohl( oid );
947947
break;

0 commit comments

Comments
 (0)
Please sign in to comment.