mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Reduce more nesting depth, and fix an error message
This commit is contained in:
@@ -880,7 +880,11 @@ static void outputUnoptimizedTileData(
|
||||
|
||||
for (auto [tile, attr] : zip(png.visitAsTiles(), attrmap)) {
|
||||
// Do not emit fully-background tiles.
|
||||
if (!attr.isBackgroundTile()) {
|
||||
if (attr.isBackgroundTile()) {
|
||||
++tileIdx;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the tile is fully transparent, this defaults to palette 0.
|
||||
Palette const &palette = palettes[attr.getPalID(mappings)];
|
||||
|
||||
@@ -900,12 +904,10 @@ static void outputUnoptimizedTileData(
|
||||
|
||||
if (!empty && tileIdx >= nbKeptTiles) {
|
||||
warning(
|
||||
WARNING_TRIM_NONEMPTY,
|
||||
"Trimming a nonempty tile (configure with '-x/--trim-end'"
|
||||
WARNING_TRIM_NONEMPTY, "Trimming a nonempty tile (configure with '-x/--trim-end')"
|
||||
);
|
||||
break; // Don't repeat the warning for subsequent tiles
|
||||
}
|
||||
}
|
||||
++tileIdx;
|
||||
}
|
||||
assume(nbKeptTiles <= tileIdx && tileIdx <= nbTiles);
|
||||
|
||||
@@ -263,17 +263,16 @@ static void writeROM() {
|
||||
|
||||
static void writeSymName(std::string const &name, FILE *file) {
|
||||
for (char const *ptr = name.c_str(); *ptr != '\0';) {
|
||||
char c = *ptr;
|
||||
|
||||
if (continuesIdentifier(c)) {
|
||||
// Output legal ASCII characters as-is
|
||||
if (char c = *ptr; continuesIdentifier(c)) {
|
||||
putc(c, file);
|
||||
++ptr;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Output illegal characters using Unicode escapes ('\u' or '\U')
|
||||
// Decode the UTF-8 codepoint; or at least attempt to
|
||||
uint32_t state = UTF8_ACCEPT, codepoint;
|
||||
|
||||
do {
|
||||
decode(&state, &codepoint, *ptr);
|
||||
if (state == UTF8_REJECT) {
|
||||
@@ -288,10 +287,8 @@ static void writeSymName(std::string const &name, FILE *file) {
|
||||
}
|
||||
++ptr;
|
||||
} while (state != UTF8_ACCEPT);
|
||||
|
||||
fprintf(file, codepoint <= 0xFFFF ? "\\u%04" PRIx32 : "\\U%08" PRIx32, codepoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comparator function for `std::stable_sort` to sort symbols
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
warning: [-Wtrim-nonempty]
|
||||
Trimming a nonempty tile (configure with '-x/--trim-end'
|
||||
Trimming a nonempty tile (configure with '-x/--trim-end')
|
||||
|
||||
Reference in New Issue
Block a user