Skip to content

Commit

Permalink
DBFIsValueNULL(): make GDAL 'detect_suspicious_char_digit_zero' scrip…
Browse files Browse the repository at this point in the history
…t happy
  • Loading branch information
rouault committed Aug 9, 2024
1 parent 2cc2975 commit 7d0c40e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dbfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,8 @@ static bool DBFIsValueNULL(char chType, const char *pszValue, int size)
return true;

case 'D':
{
const char DIGIT_ZERO = '0';
/* NULL date fields have value "00000000" or "0"*size */
/* Some DBF files have fields filled with spaces */
/* (trimmed by DBFReadStringAttribute) to indicate null */
Expand All @@ -1154,9 +1156,10 @@ static bool DBFIsValueNULL(char chType, const char *pszValue, int size)
strcmp(pszValue, " ") == 0 || strcmp(pszValue, "0") == 0)
return true;
for (int i = 0; i < size; i++)
if (pszValue[i] != '0')
if (pszValue[i] != DIGIT_ZERO)
return false;
return true;
}

case 'L':
/* NULL boolean fields have value "?" */
Expand Down

0 comments on commit 7d0c40e

Please sign in to comment.