summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/pngo.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/pngo.c b/bin/pngo.c
index c7a37bd9..5ce62797 100644
--- a/bin/pngo.c
+++ b/bin/pngo.c
@@ -88,11 +88,6 @@ static struct Chunk readChunk(void) {
     return chunk;
 }
 
-static void skipChunk(struct Chunk chunk) {
-    int error = fseek(file, chunk.size + 4, SEEK_CUR);
-    if (error) err(EX_IOERR, "%s", path);
-}
-
 static void writeChunk(struct Chunk chunk) {
     chunk.size = htonl(chunk.size);
     writeExpect(&chunk, sizeof(chunk));
@@ -117,6 +112,12 @@ static void writeCrc(void) {
     writeExpect(&net, sizeof(net));
 }
 
+static void skipChunk(struct Chunk chunk) {
+    uint8_t discard[chunk.size];
+    readExpect(discard, sizeof(discard), "chunk data");
+    readCrc();
+}
+
 static struct PACKED {
     uint32_t width;
     uint32_t height;