nuclear@13: #include "goat3d.h" nuclear@13: #include "chunk.h" nuclear@13: nuclear@13: ChunkHeader chunk_header(int id) nuclear@13: { nuclear@13: ChunkHeader hdr; nuclear@13: hdr.id = id; nuclear@13: hdr.size = sizeof hdr; nuclear@13: return hdr; nuclear@13: } nuclear@13: nuclear@13: bool write_chunk_header(const ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@13: io->seek(-hdr->size, SEEK_CUR, io->cls); nuclear@13: if(io->write(hdr, sizeof *hdr, io->cls) < (ssize_t)sizeof *hdr) { nuclear@13: return false; nuclear@13: } nuclear@13: return true; nuclear@13: } nuclear@13: nuclear@13: bool read_chunk_header(ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@13: if(io->read(hdr, sizeof *hdr, io->cls) < (ssize_t)sizeof *hdr) { nuclear@13: return false; nuclear@13: } nuclear@13: return true; nuclear@13: } nuclear@13: nuclear@13: void skip_chunk(const ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@13: io->seek(hdr->size - sizeof *hdr, SEEK_CUR, io->cls); nuclear@13: }