@@ -309,10 +309,10 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
309
309
if ( field.type () != nativeType.mType )
310
310
continue ;
311
311
312
- if ( field.length () == - 1 )
312
+ if ( field.length () <= 0 )
313
313
{
314
314
// source length unlimited
315
- if ( nativeType.mMinLen > - 1 || nativeType.mMaxLen > - 1 )
315
+ if ( nativeType.mMinLen > 0 || nativeType.mMaxLen > 0 )
316
316
{
317
317
// destination limited
318
318
continue ;
@@ -321,18 +321,18 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
321
321
else
322
322
{
323
323
// source length limited
324
- if ( nativeType.mMinLen > - 1 && nativeType. mMaxLen > - 1 &&
325
- ( field. length () < nativeType. mMinLen || field.length () > nativeType.mMaxLen ) )
324
+ if ( ( nativeType.mMinLen > 0 && field. length () < nativeType. mMinLen ) ||
325
+ ( nativeType. mMaxLen > 0 && field.length () > nativeType.mMaxLen ) )
326
326
{
327
327
// source length exceeds destination limits
328
328
continue ;
329
329
}
330
330
}
331
331
332
- if ( field.precision () == - 1 )
332
+ if ( field.precision () <= 0 )
333
333
{
334
334
// source precision unlimited / n/a
335
- if ( nativeType.mMinPrec > - 1 || nativeType.mMaxPrec > - 1 )
335
+ if ( nativeType.mMinPrec > 0 || nativeType.mMaxPrec > 0 )
336
336
{
337
337
// destination limited
338
338
continue ;
@@ -341,8 +341,8 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
341
341
else
342
342
{
343
343
// source precision unlimited / n/a
344
- if ( nativeType.mMinPrec > - 1 && nativeType. mMaxPrec > - 1 &&
345
- ( field. precision () < nativeType. mMinPrec || field.precision () > nativeType.mMaxPrec ) )
344
+ if ( ( nativeType.mMinPrec > 0 && field. precision () < nativeType. mMinPrec ) ||
345
+ ( nativeType. mMaxPrec > 0 && field.precision () > nativeType.mMaxPrec ) )
346
346
{
347
347
// source precision exceeds destination limits
348
348
continue ;
0 commit comments