Skip to content

Commit a26df92

Browse files
committed
Fixes Coverity Scan warnings
1 parent 012e210 commit a26df92

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

frmts/iso8211/ddffielddefn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ bool DDFFieldDefn::BuildSubfields()
486486
CPLError(CE_Failure, CPLE_NotSupported,
487487
"Tag %s: repeated fields found in a part that is "
488488
"not the last one: %s",
489-
osTag.c_str(), pszSublist);
489+
osTag.c_str(), _arrayDescr.c_str());
490490
return false;
491491
}
492492

frmts/zarr/zarrdriver.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,17 +1258,16 @@ GDALDataset *ZarrDataset::Create(const char *pszName, int nXSize, int nYSize,
12581258
{
12591259
VSIStatBufL sStat;
12601260
const bool bExists = VSIStatL(pszName, &sStat) == 0;
1261-
const bool bIsFile = bExists && !VSI_ISDIR(sStat.st_mode);
1262-
const bool bIsDirectory =
1263-
!bIsFile && ((bExists && VSI_ISDIR(sStat.st_mode)) ||
1264-
!CPLStringList(VSIReadDirEx(pszName, 1)).empty());
1265-
if (bIsFile || bIsDirectory || bExists)
1261+
const char *pszObjType = nullptr;
1262+
if (bExists && !VSI_ISDIR(sStat.st_mode))
1263+
pszObjType = "File";
1264+
else if ((bExists /* && VSI_ISDIR(sStat.st_mode)*/) ||
1265+
!CPLStringList(VSIReadDirEx(pszName, 1)).empty())
1266+
pszObjType = "Directory";
1267+
if (pszObjType)
12661268
{
12671269
CPLError(CE_Failure, CPLE_FileIO, "%s %s already exists.",
1268-
bIsFile ? "File"
1269-
: bIsDirectory ? "Directory"
1270-
: "Object",
1271-
pszName);
1270+
pszObjType, pszName);
12721271
return nullptr;
12731272
}
12741273

0 commit comments

Comments
 (0)