Skip to content

Commit bad1ab4

Browse files
committedJun 1, 2018
QgsVectorDataProvider::supportedType(): use -1 as the value for unspecified length/width (this is the default in QgsField constructor and QgsVectorDataProvider::NativeType())
1 parent 04a55b2 commit bad1ab4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎src/core/qgsvectordataprovider.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
343343
if ( field.type() != nativeType.mType )
344344
continue;
345345

346-
if ( field.length() == -1 )
346+
if ( field.length() <= 0 )
347347
{
348348
// source length unlimited
349-
if ( nativeType.mMinLen > -1 || nativeType.mMaxLen > -1 )
349+
if ( nativeType.mMinLen > 0 || nativeType.mMaxLen > 0 )
350350
{
351351
// destination limited
352352
continue;
@@ -355,18 +355,18 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
355355
else
356356
{
357357
// source length limited
358-
if ( nativeType.mMinLen > -1 && nativeType.mMaxLen > -1 &&
359-
( field.length() < nativeType.mMinLen || field.length() > nativeType.mMaxLen ) )
358+
if ( ( nativeType.mMinLen > 0 && field.length() < nativeType.mMinLen ) ||
359+
( nativeType.mMaxLen > 0 && field.length() > nativeType.mMaxLen ) )
360360
{
361361
// source length exceeds destination limits
362362
continue;
363363
}
364364
}
365365

366-
if ( field.precision() == -1 )
366+
if ( field.precision() <= 0 )
367367
{
368368
// source precision unlimited / n/a
369-
if ( nativeType.mMinPrec > -1 || nativeType.mMaxPrec > -1 )
369+
if ( nativeType.mMinPrec > 0 || nativeType.mMaxPrec > 0 )
370370
{
371371
// destination limited
372372
continue;
@@ -375,8 +375,8 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
375375
else
376376
{
377377
// source precision unlimited / n/a
378-
if ( nativeType.mMinPrec > -1 && nativeType.mMaxPrec > -1 &&
379-
( field.precision() < nativeType.mMinPrec || field.precision() > nativeType.mMaxPrec ) )
378+
if ( ( nativeType.mMinPrec > 0 && field.precision() < nativeType.mMinPrec ) ||
379+
( nativeType.mMaxPrec > 0 && field.precision() > nativeType.mMaxPrec ) )
380380
{
381381
// source precision exceeds destination limits
382382
continue;

0 commit comments

Comments
 (0)
Please sign in to comment.