summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/pngo.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/bin/pngo.c b/bin/pngo.c
index 5ce62797..c34ec7d1 100644
--- a/bin/pngo.c
+++ b/bin/pngo.c
@@ -70,10 +70,6 @@ struct PACKED Chunk {
     char type[4];
 };
 
-static bool ancillary(struct Chunk chunk) {
-    return chunk.type[0] & 0x20;
-}
-
 static const char *typeStr(struct Chunk chunk) {
     static char buf[5];
     memcpy(buf, chunk.type, 4);
@@ -113,6 +109,9 @@ static void writeCrc(void) {
 }
 
 static void skipChunk(struct Chunk chunk) {
+    if (!(chunk.type[0] & 0x20)) {
+        errx(EX_CONFIG, "%s: unsupported critical chunk %s", path, typeStr(chunk));
+    }
     uint8_t discard[chunk.size];
     readExpect(discard, sizeof(discard), "chunk data");
     readCrc();
@@ -263,16 +262,8 @@ static void readPalette(void) {
     struct Chunk chunk;
     for (;;) {
         chunk = readChunk();
-        if (0 == memcmp(chunk.type, "PLTE", 4)) {
-            break;
-        } else if (ancillary(chunk)) {
-            skipChunk(chunk);
-        } else {
-            errx(
-                EX_DATAERR, "%s: expected PLTE chunk, found %s",
-                path, typeStr(chunk)
-            );
-        }
+        if (0 == memcmp(chunk.type, "PLTE", 4)) break;
+        skipChunk(chunk);
     }
     if (chunk.size % 3) {
         errx(EX_DATAERR, "%s: PLTE size %u not divisible by 3", path, chunk.size);
@@ -322,13 +313,8 @@ static void readData(void) {
 
         } else if (0 == memcmp(chunk.type, "IEND", 4)) {
             errx(EX_DATAERR, "%s: missing IDAT chunk", path);
-        } else if (ancillary(chunk)) {
-            skipChunk(chunk);
         } else {
-            errx(
-                EX_CONFIG, "%s: unsupported critical chunk %s",
-                path, typeStr(chunk)
-            );
+            skipChunk(chunk);
         }
     }
 
st in promptJune McEnroe 2013-10-31Wow look reorganized zsh configJune McEnroe 2013-10-30Show hostname in prompt over SSHJune McEnroe 2013-10-30Only load chruby if it existsJune McEnroe 2013-10-27Add auto-title stuff to zshJune McEnroe 2013-10-26Add gvim alias to silence stderrJune McEnroe 2013-10-26Add home.programble.me functionJune McEnroe 2013-10-14Remove unused configsJune McEnroe 2013-10-14Add therefore, because, cards compose sequencesJune McEnroe 2013-10-14Global git ignore .swo filesJune McEnroe 2013-10-14Add Heroku to zshJune McEnroe 2013-09-23Add gst git stash aliasJune McEnroe 2013-09-06Disable some options in terminalsJune McEnroe 2013-09-05Only set colorscheme for gvimJune McEnroe 2013-09-05Remove pacman stuffJune McEnroe 2013-09-05Only alias hub if it existsJune McEnroe 2013-09-05chruby to ruby-2.0.0June McEnroe 2013-08-17Add vim-ragtagJune McEnroe 2013-08-14Add nvmJune McEnroe 2013-07-09Add title commandJune McEnroe 2013-06-09Use default client keysJune McEnroe 2013-06-09Run games in separate X serverJune McEnroe 2013-06-08Add game wrapper to kill/restart unclutterJune McEnroe 2013-06-08Update base16-vimJune McEnroe 2013-06-08Add git configJune McEnroe