@@ -343,10 +343,10 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
343
343
if ( field.type () != nativeType.mType )
344
344
continue ;
345
345
346
- if ( field.length () == - 1 )
346
+ if ( field.length () <= 0 )
347
347
{
348
348
// source length unlimited
349
- if ( nativeType.mMinLen > - 1 || nativeType.mMaxLen > - 1 )
349
+ if ( nativeType.mMinLen > 0 || nativeType.mMaxLen > 0 )
350
350
{
351
351
// destination limited
352
352
continue ;
@@ -355,18 +355,18 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
355
355
else
356
356
{
357
357
// 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 ) )
360
360
{
361
361
// source length exceeds destination limits
362
362
continue ;
363
363
}
364
364
}
365
365
366
- if ( field.precision () == - 1 )
366
+ if ( field.precision () <= 0 )
367
367
{
368
368
// source precision unlimited / n/a
369
- if ( nativeType.mMinPrec > - 1 || nativeType.mMaxPrec > - 1 )
369
+ if ( nativeType.mMinPrec > 0 || nativeType.mMaxPrec > 0 )
370
370
{
371
371
// destination limited
372
372
continue ;
@@ -375,8 +375,8 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
375
375
else
376
376
{
377
377
// 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 ) )
380
380
{
381
381
// source precision exceeds destination limits
382
382
continue ;
0 commit comments