Skip to content

Commit

Permalink
Revert use of sttoll (I cannot reproduce anymore)
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Nov 29, 2021
1 parent f78ae1e commit 7163749
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
Expand Up @@ -549,14 +549,9 @@ void QgsDelimitedTextFeatureIterator::fetchAttribute( QgsFeature &feature, int f
{
if ( ! value.isEmpty() )
{
// Use std library because QString( "9189304972279762602").toLongLong( &ok )
// sets ok to true and returns 1836535466
// See: https://bugreports.qt.io/browse/QTBUG-98725
try
{
val = QVariant( std::stoll( value.toStdString() ) );
}
catch ( const std::invalid_argument & )
bool ok;
val = value.toLongLong( &ok );
if ( ! ok )
{
val = QVariant( mSource->mFields.at( fieldIdx ).type() );
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgsdelimitedtextprovider_wanted.py
Expand Up @@ -2146,7 +2146,7 @@ def test_034_csvt_file():
'fdatetime': '80',
'fdate': '2015-03-28',
'ftime': '2014-12-30',
'flong': '1',
'flong': 'NULL',
'flonglong': '9189304972279762602',
'field_12': '-3123724580211819352',
'#fid': 3,
Expand Down Expand Up @@ -2585,7 +2585,7 @@ def test_042_no_detect_types_csvt():
'fdatetime': '80',
'fdate': '2015-03-28',
'ftime': '2014-12-30',
'flong': '1',
'flong': 'NULL',
'flonglong': '9189304972279762602',
'field_12': '-3123724580211819352',
'#fid': 3,
Expand Down

0 comments on commit 7163749

Please sign in to comment.