diff options
author | June McEnroe <june@causal.agency> | 2018-03-02 15:39:07 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-03-02 15:39:07 -0500 |
commit | a7e50497b32cbf66159fda3563042d96ca7a8167 (patch) | |
tree | e63c3b1456f36aac6ab26154f20447c672c3f2a5 | |
parent | Add verbose flag to pngo (diff) | |
download | src-a7e50497b32cbf66159fda3563042d96ca7a8167.tar.gz src-a7e50497b32cbf66159fda3563042d96ca7a8167.zip |
Skip chunks by reading in pngo
Pipes.
Diffstat (limited to '')
-rw-r--r-- | bin/pngo.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/pngo.c b/bin/pngo.c index 8ee93d6e..34908f15 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; |