mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Run clang-format
This commit is contained in:
@@ -835,7 +835,8 @@ int main(int argc, char *argv[]) {
|
|||||||
} else {
|
} else {
|
||||||
process();
|
process();
|
||||||
}
|
}
|
||||||
} else if (!options.palettes.empty() && options.palSpecType == Options::EXPLICIT && !options.reverse()) {
|
} else if (!options.palettes.empty() && options.palSpecType == Options::EXPLICIT
|
||||||
|
&& !options.reverse()) {
|
||||||
processPalettes();
|
processPalettes();
|
||||||
} else {
|
} else {
|
||||||
fputs("FATAL: No input image specified\n", stderr);
|
fputs("FATAL: No input image specified\n", stderr);
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ void parseInlinePalSpec(char const * const rawArg) {
|
|||||||
*/
|
*/
|
||||||
template<size_t n>
|
template<size_t n>
|
||||||
[[gnu::warn_unused_result]] // Ignoring failure to match is a bad idea.
|
[[gnu::warn_unused_result]] // Ignoring failure to match is a bad idea.
|
||||||
static bool readMagic(std::filebuf &file, char const *magic) {
|
static bool
|
||||||
|
readMagic(std::filebuf &file, char const *magic) {
|
||||||
assume(strlen(magic) == n);
|
assume(strlen(magic) == n);
|
||||||
|
|
||||||
char magicBuf[n];
|
char magicBuf[n];
|
||||||
@@ -208,7 +209,8 @@ static T readLE(U const *bytes) {
|
|||||||
* @return true if a line was read.
|
* @return true if a line was read.
|
||||||
*/
|
*/
|
||||||
[[gnu::warn_unused_result]] // Ignoring EOF is a bad idea.
|
[[gnu::warn_unused_result]] // Ignoring EOF is a bad idea.
|
||||||
static bool readLine(std::filebuf &file, std::string &buffer) {
|
static bool
|
||||||
|
readLine(std::filebuf &file, std::string &buffer) {
|
||||||
// TODO: maybe this can be optimized to bulk reads?
|
// TODO: maybe this can be optimized to bulk reads?
|
||||||
for (;;) {
|
for (;;) {
|
||||||
auto c = file.sbumpc();
|
auto c = file.sbumpc();
|
||||||
@@ -227,12 +229,13 @@ static bool readLine(std::filebuf &file, std::string &buffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define requireLine(kind, file, buffer) do { \
|
#define requireLine(kind, file, buffer) \
|
||||||
if (!readLine(file, buffer)) { \
|
do { \
|
||||||
error(kind " palette file is shorter than expected"); \
|
if (!readLine(file, buffer)) { \
|
||||||
return; \
|
error(kind " palette file is shorter than expected"); \
|
||||||
} \
|
return; \
|
||||||
} while (0)
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parses the initial part of a string_view, advancing the "read index" as it does
|
* Parses the initial part of a string_view, advancing the "read index" as it does
|
||||||
@@ -375,7 +378,8 @@ static void parseGPLFile(std::filebuf &file) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Ignore anything following the three components
|
// Ignore anything following the three components
|
||||||
// (sometimes it's a comment, sometimes it's the color in CSS hex format, sometimes there's nothing...).
|
// (sometimes it's a comment, sometimes it's the color in CSS hex format, sometimes there's
|
||||||
|
// nothing...).
|
||||||
|
|
||||||
if (nbColors < maxNbColors) {
|
if (nbColors < maxNbColors) {
|
||||||
if (nbColors % options.nbColorsPerPal == 0) {
|
if (nbColors % options.nbColorsPerPal == 0) {
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ void reverse() {
|
|||||||
|
|
||||||
std::vector<std::array<std::optional<Rgba>, 4>> palettes{
|
std::vector<std::array<std::optional<Rgba>, 4>> palettes{
|
||||||
{Rgba(0xFFFFFFFF), Rgba(0xAAAAAAFF), Rgba(0x555555FF), Rgba(0x000000FF)}
|
{Rgba(0xFFFFFFFF), Rgba(0xAAAAAAFF), Rgba(0x555555FF), Rgba(0x000000FF)}
|
||||||
};
|
};
|
||||||
// If a palette file is used as input, it overrides the default colors.
|
// If a palette file is used as input, it overrides the default colors.
|
||||||
if (!options.palettes.empty()) {
|
if (!options.palettes.empty()) {
|
||||||
File file;
|
File file;
|
||||||
|
|||||||
Reference in New Issue
Block a user