Run clang-format

This commit is contained in:
ISSOtm
2024-07-26 22:51:52 +02:00
committed by Sylvie
parent dae4219acd
commit 98bca79df4
3 changed files with 16 additions and 11 deletions

View File

@@ -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);

View File

@@ -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) \
do { \
if (!readLine(file, buffer)) { \ if (!readLine(file, buffer)) { \
error(kind " palette file is shorter than expected"); \ error(kind " palette file is shorter than expected"); \
return; \ 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) {