Skip to content

Commit d122a57

Browse files
committed
Fix/workaround cppcheck master warnings
1 parent f647f3a commit d122a57

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

gcore/gdalmultidim_rat.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class GDALRasterAttributeTableFromMDArrays final
120120
arrayStartIdx, count, arrayStep, bufferStride,
121121
GDALExtendedDataType::CreateString(), pDstBuffer))
122122
return nullptr;
123+
// cppcheck-suppress knownConditionTrueFalse
123124
if (!pszStr)
124125
return nullptr;
125126
m_osTmp = pszStr;

ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ OGRFeature *OGRGeoRSSLayer::GetNextFeature()
958958

959959
CPLFree(ppoFeatureTab);
960960
ppoFeatureTab = nullptr;
961-
nFeatureTabLength = 0;
961+
this->nFeatureTabLength = 0;
962962
nFeatureTabIndex = 0;
963963

964964
int nDone = 0;
@@ -978,9 +978,10 @@ OGRFeature *OGRGeoRSSLayer::GetNextFeature()
978978
static_cast<int>(XML_GetCurrentColumnNumber(oParser)));
979979
bStopParsing = true;
980980
}
981-
} while (!nDone && !bStopParsing && nFeatureTabLength == 0);
981+
} while (!nDone && !bStopParsing && this->nFeatureTabLength == 0);
982982

983-
return nFeatureTabLength ? ppoFeatureTab[nFeatureTabIndex++] : nullptr;
983+
return this->nFeatureTabLength ? ppoFeatureTab[nFeatureTabIndex++]
984+
: nullptr;
984985
#else
985986
return nullptr;
986987
#endif
@@ -1758,11 +1759,11 @@ void OGRGeoRSSLayer::LoadSchema()
17581759
pszSubElementName = nullptr;
17591760
pszSubElementValue = nullptr;
17601761
nSubElementValueLen = 0;
1761-
bSameSRS = true;
1762-
CPLFree(pszGMLSRSName);
1763-
pszGMLSRSName = nullptr;
1764-
eGeomType = wkbUnknown;
1765-
bFoundGeom = false;
1762+
this->bSameSRS = true;
1763+
CPLFree(this->pszGMLSRSName);
1764+
this->pszGMLSRSName = nullptr;
1765+
this->eGeomType = wkbUnknown;
1766+
this->bFoundGeom = false;
17661767
bInTagWithSubTag = false;
17671768
pszTagWithSubTag = nullptr;
17681769
bStopParsing = false;
@@ -1802,9 +1803,9 @@ void OGRGeoRSSLayer::LoadSchema()
18021803
}
18031804

18041805
CPLAssert(poSRS == nullptr);
1805-
if (bSameSRS && bFoundGeom)
1806+
if (this->bSameSRS && this->bFoundGeom)
18061807
{
1807-
if (pszGMLSRSName == nullptr)
1808+
if (this->pszGMLSRSName == nullptr)
18081809
{
18091810
poSRS = new OGRSpatialReference();
18101811
poSRS->SetWellKnownGeogCS("WGS84");
@@ -1817,7 +1818,7 @@ void OGRGeoRSSLayer::LoadSchema()
18171818
}
18181819
}
18191820

1820-
if (eGeomType != wkbUnknown)
1821+
if (this->eGeomType != wkbUnknown)
18211822
poFeatureDefn->SetGeomType(eGeomType);
18221823
if (poFeatureDefn->GetGeomFieldCount() != 0)
18231824
poFeatureDefn->GetGeomFieldDefn(0)->SetSpatialRef(poSRS);

ogr/ogrsf_frmts/gml/gmlreader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ GMLFeature *GMLReader::NextFeatureExpat()
479479
VSIFErrorL(fpGML))
480480
return nullptr;
481481

482-
nFeatureTabLength = 0;
482+
this->nFeatureTabLength = 0;
483483
nFeatureTabIndex = 0;
484484

485485
int nDone = 0;
@@ -515,9 +515,9 @@ GMLFeature *GMLReader::NextFeatureExpat()
515515
if (!m_bStopParsing)
516516
m_bStopParsing = static_cast<GMLExpatHandler *>(m_poGMLHandler)
517517
->HasStoppedParsing();
518-
} while (!nDone && !m_bStopParsing && nFeatureTabLength == 0);
518+
} while (!nDone && !m_bStopParsing && this->nFeatureTabLength == 0);
519519

520-
if (nFeatureTabLength)
520+
if (this->nFeatureTabLength)
521521
return ppoFeatureTab[nFeatureTabIndex++];
522522

523523
if (!m_osErrorMessage.empty())

ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ OGRFeature *OGRGPXLayer::GetNextFeature()
996996
if (m_bStopParsing)
997997
return nullptr;
998998

999-
if (!m_oFeatureQueue.empty())
999+
if (!this->m_oFeatureQueue.empty())
10001000
{
10011001
OGRFeature *poFeature = std::move(m_oFeatureQueue.front()).release();
10021002
m_oFeatureQueue.pop_front();
@@ -1028,7 +1028,7 @@ OGRFeature *OGRGPXLayer::GetNextFeature()
10281028
break;
10291029
}
10301030
m_nWithoutEventCounter++;
1031-
} while (!nDone && m_oFeatureQueue.empty() && !m_bStopParsing &&
1031+
} while (!nDone && this->m_oFeatureQueue.empty() && !m_bStopParsing &&
10321032
m_nWithoutEventCounter < 10);
10331033

10341034
if (m_nWithoutEventCounter == 10)
@@ -1038,7 +1038,7 @@ OGRFeature *OGRGPXLayer::GetNextFeature()
10381038
m_bStopParsing = true;
10391039
}
10401040

1041-
if (!m_oFeatureQueue.empty())
1041+
if (!this->m_oFeatureQueue.empty())
10421042
{
10431043
OGRFeature *poFeature = std::move(m_oFeatureQueue.front()).release();
10441044
m_oFeatureQueue.pop_front();

ogr/ogrsf_frmts/jml/ogrjmllayer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ OGRFeature *OGRJMLLayer::GetNextFeature()
419419

420420
std::vector<char> aBuf(PARSER_BUF_SIZE);
421421

422-
nFeatureTabLength = 0;
422+
this->nFeatureTabLength = 0;
423423
nFeatureTabIndex = 0;
424424

425425
nWithoutEventCounter = 0;
@@ -443,7 +443,7 @@ OGRFeature *OGRJMLLayer::GetNextFeature()
443443
bStopParsing = true;
444444
}
445445
nWithoutEventCounter++;
446-
} while (!nDone && !bStopParsing && nFeatureTabLength == 0 &&
446+
} while (!nDone && !bStopParsing && this->nFeatureTabLength == 0 &&
447447
nWithoutEventCounter < 10);
448448

449449
if (nWithoutEventCounter == 10)
@@ -453,7 +453,8 @@ OGRFeature *OGRJMLLayer::GetNextFeature()
453453
bStopParsing = true;
454454
}
455455

456-
return (nFeatureTabLength) ? ppoFeatureTab[nFeatureTabIndex++] : nullptr;
456+
return (this->nFeatureTabLength) ? ppoFeatureTab[nFeatureTabIndex++]
457+
: nullptr;
457458
}
458459

459460
static void XMLCALL startElementLoadSchemaCbk(void *pUserData,

port/cpl_path.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,10 +759,7 @@ std::string CPLFormFilenameSafe(const char *pszPath, const char *pszBasename,
759759
pszBasename = pszBasenameOri;
760760
nLenPath = nLenPathOri;
761761
if (pszAddedPathSep[0] == 0)
762-
pszAddedPathSep =
763-
pszPath[0] == '/'
764-
? "/"
765-
: VSIGetDirectorySeparator(pszPath);
762+
pszAddedPathSep = "/";
766763
}
767764
break;
768765
}

0 commit comments

Comments
 (0)