Skip to content

Fix issues reported by cppcheck 2.14.0 #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions contrib/Shape_PointInPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ loopDir LoopDirection(DPoint2d *vertices, int vertsize)

DPoint2d CreatePointInPoly(SHPObject *psShape, int quality)
{
int i, j, k, end, vert, pointpos;
double part, dx, xmin, xmax, ymin, ymax, y, x3, x4, y3, y4, len, maxlen = 0;
int i, j, k, end, vert;
double part, dx, xmin, xmax, ymin, ymax, x3, x4, y3, y4, len, maxlen = 0;
DPoint2d *vertices;
loopDir direction;
IntersectPoint mp1, mp2, point1, point2, points[MAXINTERSECTIONPOINTS];
Expand All @@ -86,8 +86,8 @@ DPoint2d CreatePointInPoly(SHPObject *psShape, int quality)
dx = xmax - xmin;
for (i = 0; i < quality; i++)
{
y = ymin + part * (i + 1);
pointpos = 0;
const double y = ymin + part * (i + 1);
int pointpos = 0;
for (j = 0; j < psShape->nParts; j++)
{
if (j == psShape->nParts - 1)
Expand Down Expand Up @@ -196,7 +196,6 @@ int main(int argc, char *argv[])

int i, nEntities, quality;
SHPHandle hSHP;
SHPObject *psShape;
DPoint2d pt;
quality = atoi(argv[2]);
hSHP = SHPOpen(argv[1], "rb");
Expand All @@ -205,7 +204,7 @@ int main(int argc, char *argv[])
printf("PointInPoly v1.0, by Marko Podgorsek\n----------------\n");
for (i = 0; i < nEntities; i++)
{
psShape = SHPReadObject(hSHP, i);
SHPObject *psShape = SHPReadObject(hSHP, i);
if (psShape->nSHPType == SHPT_POLYGON)
{
pt = CreatePointInPoly(psShape, quality);
Expand Down
2 changes: 1 addition & 1 deletion contrib/dbfcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int main(int argc, char **argv)
if (verbose)
{
const int ncRecords = DBFGetRecordCount(cDBF) - nRecords;
printf(" %u record%s appended\n\n", ncRecords,
printf(" %d record%s appended\n\n", ncRecords,
ncRecords == 1 ? "" : "s");
}
DBFClose(hDBF);
Expand Down
2 changes: 1 addition & 1 deletion contrib/shpsort.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static void copy_related(const char *inName, const char *outName,
}

#ifdef DEBUG
static void PrintDataStruct(struct DataStruct *data)
static void PrintDataStruct(const struct DataStruct *data)
{
for (int i = 0; i < nShapes; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion dbfdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int argc, char **argv)
bool bHeader = false;
bool bRaw = false;
bool bMultiLine = false;
char *pszFilename = NULL;
const char *pszFilename = NULL;

for (int i = 1; i < argc; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion dbfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszFilename, const char *pszAccess,

for (int iField = 0; iField < nFields; iField++)
{
unsigned char *pabyFInfo = pabyBuf + iField * XBASE_FLDHDR_SZ;
const unsigned char *pabyFInfo = pabyBuf + iField * XBASE_FLDHDR_SZ;
if (pabyFInfo[0] == HEADER_RECORD_TERMINATOR)
{
psDBF->nFields = iField;
Expand Down