diff --git a/src/asm/charmap.cpp b/src/asm/charmap.cpp index aae73a74..ab53e00d 100644 --- a/src/asm/charmap.cpp +++ b/src/asm/charmap.cpp @@ -72,7 +72,7 @@ void charmap_New(std::string const &name, std::string const *baseName) { Charmap &charmap = charmapList.emplace_back(); if (baseIdx != (size_t)-1) { - charmap.nodes = charmapList[baseIdx].nodes; // Copies `charmapList[baseIdx].nodes` + charmap.nodes = charmapList[baseIdx].nodes; // Copies `charmapList[baseIdx].nodes` charmap.mappings = charmapList[baseIdx].mappings; // Copies `charmapList[baseIdx].mappings` } else { charmap.nodes.emplace_back(); // Zero-init the root node diff --git a/src/asm/main.cpp b/src/asm/main.cpp index 5738d48d..e3ad9e54 100644 --- a/src/asm/main.cpp +++ b/src/asm/main.cpp @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) { : !strcasecmp(feature, "equs") ? STATE_EQUS : !strcasecmp(feature, "char") ? STATE_CHAR : !strcasecmp(feature, "macro") ? STATE_MACRO - : NB_STATE_FEATURES; + : NB_STATE_FEATURES; if (value == NB_STATE_FEATURES) { errx("Invalid feature for option 's': \"%s\"", feature); } else if (std::find(RANGE(features), value) != features.end()) { diff --git a/src/asm/section.cpp b/src/asm/section.cpp index 4dfb7c3b..96ce3104 100644 --- a/src/asm/section.cpp +++ b/src/asm/section.cpp @@ -76,11 +76,11 @@ void sect_CheckSizes() { for (Section const § : sectionList) { if (uint32_t maxSize = sectionTypeInfo[sect.type].size; sect.size > maxSize) error( - "Section '%s' grew too big (max size = 0x%" PRIX32 " bytes, reached 0x%" PRIX32 - ").\n", - sect.name.c_str(), - maxSize, - sect.size + "Section '%s' grew too big (max size = 0x%" PRIX32 " bytes, reached 0x%" PRIX32 + ").\n", + sect.name.c_str(), + maxSize, + sect.size ); } } @@ -837,8 +837,7 @@ void sect_BinaryFile(std::string const &name, int32_t startPos) { while (startPos--) { if (fgetc(file) == EOF) { error( - "Specified start position is greater than length of file '%s'\n", - name.c_str() + "Specified start position is greater than length of file '%s'\n", name.c_str() ); return; } @@ -908,8 +907,7 @@ void sect_BinaryFileSlice(std::string const &name, int32_t startPos, int32_t len while (startPos--) { if (fgetc(file) == EOF) { error( - "Specified start position is greater than length of file '%s'\n", - name.c_str() + "Specified start position is greater than length of file '%s'\n", name.c_str() ); return; } diff --git a/src/gfx/process.cpp b/src/gfx/process.cpp index b8088e98..aa6c2835 100644 --- a/src/gfx/process.cpp +++ b/src/gfx/process.cpp @@ -750,7 +750,7 @@ public: if (options.allowMirroringX) { // Count the line itself as mirrorred horizontally; vertical mirroring is already // taken care of because the symmetric line will be XOR'd the same way. - // (...this reduces the hash's efficiency, but seems benign with most real-world data.) + // (This reduces the hash's efficiency, but seems benign with most real-world data.) _hash ^= flipTable[bitplanes >> 8] << 8 | flipTable[bitplanes & 0xFF]; } } diff --git a/src/link/assign.cpp b/src/link/assign.cpp index 924330f8..9a2e4edc 100644 --- a/src/link/assign.cpp +++ b/src/link/assign.cpp @@ -183,8 +183,7 @@ static ssize_t getPlacement(Section const §ion, MemoryLocation &location) { location.bank = scrambleROMX + 1; else return -1; - } else if (scrambleWRAMX && section.type == SECTTYPE_WRAMX - && location.bank <= scrambleWRAMX) { + } else if (scrambleWRAMX && section.type == SECTTYPE_WRAMX && location.bank <= scrambleWRAMX) { if (location.bank > typeInfo.firstBank) location.bank--; else if (scrambleWRAMX < typeInfo.lastBank) @@ -237,8 +236,9 @@ static void placeSection(Section §ion) { assignSection(section, location); // Update the free space + uint16_t sectionEnd = section.org + section.size; bool noLeftSpace = freeSpace.address == section.org; - bool noRightSpace = freeSpace.address + freeSpace.size == section.org + section.size; + bool noRightSpace = freeSpace.address + freeSpace.size == sectionEnd; if (noLeftSpace && noRightSpace) { // The free space is entirely deleted bankMem.erase(bankMem.begin() + spaceIdx); @@ -247,12 +247,11 @@ static void placeSection(Section §ion) { // Append the new space after the original one bankMem.insert( bankMem.begin() + spaceIdx + 1, - {.address = (uint16_t)(section.org + section.size), - .size = (uint16_t)(freeSpace.address + freeSpace.size - section.org - section.size) - } + {.address = sectionEnd, + .size = (uint16_t)(freeSpace.address + freeSpace.size - sectionEnd)} ); - // **`freeSpace` cannot be reused from this point on**, because `bankMem.insert` - // invalidates all references to itself! + // **`freeSpace` cannot be reused from this point on, because `bankMem.insert` + // invalidates all references to itself!** // Resize the original space (address is unmodified) bankMem[spaceIdx].size = section.org - bankMem[spaceIdx].address; diff --git a/src/link/object.cpp b/src/link/object.cpp index 2960328d..76ac310f 100644 --- a/src/link/object.cpp +++ b/src/link/object.cpp @@ -625,7 +625,8 @@ void obj_ReadFile(char const *fileName, unsigned int fileID) { Label &label = fileSymbols[i].data.get