Skip to content
Permalink
Browse files

qgsdelimitedtextprovider.cpp: make code more readable to avoid false …

…positive from cppcheck
  • Loading branch information
rouault committed Oct 2, 2020
1 parent 97e2e5e commit 88c4ee8764f2e6d71faa46f601e3b761701f020c
Showing with 27 additions and 7 deletions.
  1. +27 −7 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
@@ -664,13 +664,33 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes )
value[1] >= '0' && value[1] <= '9' &&
value[2] == ':' &&
value[3] >= '0' && value[3] <= '5' &&
value[4] >= '0' && value[4] <= '9' &&
( value.length() == 5 ||
( value.length() >= 8 && (
value[5] == ':' &&
value[6] >= '0' && value[6] <= '6' &&
value[7] >= '0' && value[7] <= '9' &&
( value.length() == 8 || value[8] == '.' ) ) ) );
value[4] >= '0' && value[4] <= '9';
if ( couldBeTime[i] && value.length() == 5 )
{
// ok
}
else if ( couldBeTime[i] && value.length() >= 8 )
{
couldBeTime[i] = value[5] == ':' &&
value[6] >= '0' && value[6] <= '6' &&
value[7] >= '0' && value[7] <= '9';
if ( couldBeTime[i] && value.length() == 8 )
{
// ok
}
else if ( couldBeTime[i] && value.length() >= 9 )
{
couldBeTime[i] = value[8] == '.';
}
else
{
couldBeTime[i] = false;
}
}
else
{
couldBeTime[i] = false;
}
#endif
}
}

0 comments on commit 88c4ee8

Please sign in to comment.
You can’t perform that action at this time.