Skip to content

Commit 00c301e

Browse files
rouaultslarosa
authored andcommittedJul 6, 2018
QgsVectorDataProvider::supportedType(): use -1 as the value for unspecified length/width (this is the default in QgsField constructor and QgsVectorDataProvider::NativeType())
1 parent 1a8f06e commit 00c301e

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
@@ -309,10 +309,10 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
309309
if ( field.type() != nativeType.mType )
310310
continue;
311311

312-
if ( field.length() == -1 )
312+
if ( field.length() <= 0 )
313313
{
314314
// source length unlimited
315-
if ( nativeType.mMinLen > -1 || nativeType.mMaxLen > -1 )
315+
if ( nativeType.mMinLen > 0 || nativeType.mMaxLen > 0 )
316316
{
317317
// destination limited
318318
continue;
@@ -321,18 +321,18 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
321321
else
322322
{
323323
// 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 ) )
326326
{
327327
// source length exceeds destination limits
328328
continue;
329329
}
330330
}
331331

332-
if ( field.precision() == -1 )
332+
if ( field.precision() <= 0 )
333333
{
334334
// source precision unlimited / n/a
335-
if ( nativeType.mMinPrec > -1 || nativeType.mMaxPrec > -1 )
335+
if ( nativeType.mMinPrec > 0 || nativeType.mMaxPrec > 0 )
336336
{
337337
// destination limited
338338
continue;
@@ -341,8 +341,8 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
341341
else
342342
{
343343
// 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 ) )
346346
{
347347
// source precision exceeds destination limits
348348
continue;

0 commit comments

Comments
 (0)