Skip to content

Commit

Permalink
cppcheck: remove all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
embetrix committed Dec 19, 2024
1 parent 78f44f6 commit 8dab812
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bmap-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ bool isDeviceMounted(const std::string &device) {
}

void printBufferHex(const char *buffer, size_t size) {
#ifdef DEBUG
for (size_t i = 0; i < size; ++i) {
std::cout << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)(unsigned char)buffer[i];
if ((i + 1) % 16 == 0) {
Expand All @@ -134,6 +135,11 @@ void printBufferHex(const char *buffer, size_t size) {
}
}
std::cout << std::endl;
#else
(void)buffer;
(void)size;
return;
#endif
}

int BmapWriteImage(const std::string &imageFile, const bmap_t &bmap, const std::string &device) {
Expand Down Expand Up @@ -229,7 +235,7 @@ int BmapWriteImage(const std::string &imageFile, const bmap_t &bmap, const std::
err << "Computed Checksum: " << computedChecksum << std::endl;
err << "Expected Checksum: " << range.checksum;
//std::cerr << "Buffer content (hex):" << std::endl;
//printBufferHex(buffer.data(), outBytes);
printBufferHex(buffer.data(), outBytes);
throw std::string(err.str());
}

Expand Down Expand Up @@ -260,7 +266,7 @@ int BmapWriteImage(const std::string &imageFile, const bmap_t &bmap, const std::
return ret;
}

int main(int argc, char *argv[]) {
int main(int argc, const char *argv[]) {
if (argc < 4) {
std::cerr << "Usage: " << argv[0] << " <image-file> <bmap-file> <target-device>" << std::endl;
return 1;
Expand Down

0 comments on commit 8dab812

Please sign in to comment.