Add a little more test coverage (#1805)

Format main.cpp files more consistently

Add `make format` to run clang-format on everything
This commit is contained in:
Rangi
2025-08-19 15:26:23 -04:00
committed by GitHub
parent f7167d8115
commit 0c4c25b2d2
10 changed files with 140 additions and 42 deletions

View File

@@ -941,9 +941,11 @@ bool sect_BinaryFile(std::string const &name, uint32_t startPos) {
fseek(file, startPos, SEEK_SET);
} else {
if (errno != ESPIPE) {
// LCOV_EXCL_START
error(
"Error determining size of `INCBIN` file \"%s\": %s", name.c_str(), strerror(errno)
);
// LCOV_EXCL_STOP
}
// The file isn't seekable, so we'll just skip bytes one at a time
while (startPos--) {
@@ -961,7 +963,9 @@ bool sect_BinaryFile(std::string const &name, uint32_t startPos) {
}
if (ferror(file)) {
// LCOV_EXCL_START
error("Error reading `INCBIN` file \"%s\": %s", name.c_str(), strerror(errno));
// LCOV_EXCL_STOP
}
return false;
}
@@ -1002,9 +1006,11 @@ bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t l
fseek(file, startPos, SEEK_SET);
} else {
if (errno != ESPIPE) {
// LCOV_EXCL_START
error(
"Error determining size of `INCBIN` file \"%s\": %s", name.c_str(), strerror(errno)
);
// LCOV_EXCL_STOP
}
// The file isn't seekable, so we'll just skip bytes one at a time
while (startPos--) {
@@ -1021,7 +1027,9 @@ bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t l
if (int byte = fgetc(file); byte != EOF) {
writeByte(byte);
} else if (ferror(file)) {
// LCOV_EXCL_START
error("Error reading `INCBIN` file \"%s\": %s", name.c_str(), strerror(errno));
// LCOV_EXCL_STOP
} else {
error(
"Premature end of `INCBIN` file \"%s\" (%" PRId32 " bytes left to read)",