From 7d0c40ee1d98602bbf1786f55aab3657ebafe010 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 9 Aug 2024 15:07:45 +0200 Subject: [PATCH] DBFIsValueNULL(): make GDAL 'detect_suspicious_char_digit_zero' script happy --- dbfopen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbfopen.c b/dbfopen.c index ea0f067..90ed7ea 100644 --- a/dbfopen.c +++ b/dbfopen.c @@ -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 */ @@ -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 "?" */