Skip to content

Commit

Permalink
cppcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 4, 2025
1 parent 144e7d1 commit 0ff0ab5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
24 changes: 14 additions & 10 deletions frmts/msg/xritheaderparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,20 @@ XRITHeaderParser::XRITHeaderParser(std::ifstream &ifile)
{
unsigned char *buf =
(unsigned char *)std::malloc(totalHeaderLength);
std::memcpy(
buf, probeBuf,
probeSize); // save what we have already read when probing
ifile.read((char *)buf + probeSize,
totalHeaderLength -
probeSize); // read the rest of the header section
parseHeader(buf, totalHeaderLength);
std::free(buf);

m_isValid = true;
if (buf)
{
std::memcpy(
buf, probeBuf,
probeSize); // save what we have already read when probing
ifile.read(
(char *)buf + probeSize,
totalHeaderLength -
probeSize); // read the rest of the header section
parseHeader(buf, totalHeaderLength);
std::free(buf);

m_isValid = true;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions scripts/cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ for dirname in alg port gcore ogr frmts gnm apps fuzzers; do
-DPCIDSK_FRMT_UINT64="\"%llu\"" \
-DGNMGFIDFormat="\"%lld\"" \
-DGDAL_RELEASE_NAME="\"dummy\"" \
-DGDAL_RELEASE_NICKNAME="\"dummy\"" \
"-DBANDMAP_TYPE=int*" \
-DSQLITE_UTF8=1 \
-DSQLITE_DETERMINISTIC=0x000000800 \
Expand Down

0 comments on commit 0ff0ab5

Please sign in to comment.