diff options
| author | jakob <jakob@memeware.net> | 2017-04-12 16:54:36 -0400 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-04-12 16:54:36 -0400 |
| commit | 07347dcaa361607a924178eff787177e8cca6d68 (patch) | |
| tree | 5109650cbaf0a8ff5a9dadad5ab912f1cf59911d /src/header.c | |
| parent | 411a40b5c077ca69e34c7016428eb9d856f8fe73 (diff) | |
Expanded tests for the command-line interface.
Diffstat (limited to 'src/header.c')
| -rw-r--r-- | src/header.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/header.c b/src/header.c index 6389817..82a181c 100644 --- a/src/header.c +++ b/src/header.c @@ -24,8 +24,18 @@ #include "header.h" #include "io.h" -static bool is_xp3(struct header *h); -static bool is_supported(struct header *h); + +/* Checks that the header contains the correct magic number. */ +static bool is_xp3(struct header *h) { + return !memcmp(h->magic, XP3_MAGIC, 11); +} + + +/* Checks that the archive's version is supported, and that it is marked + as compatible with the KiriKiriZ engine. */ +static bool is_supported(struct header *h) { + return h->version == 1 && h->flags & 0x80; +} /* Reads from the given stream into a newly allocated header structure. @@ -36,7 +46,7 @@ struct header *read_header(struct stream *s) { if (h == NULL) return NULL; /* The header structure can't be read into directly because of - potential alignment issues. */ + alignment issues. */ stream_read(h->magic, s, 11); stream_read(&h->info_offset, s, sizeof(uint64_t)); stream_read(&h->version, s, sizeof(uint32_t)); @@ -50,16 +60,3 @@ struct header *read_header(struct stream *s) { } return h; } - - -/* Checks that the header contains the correct magic number. */ -static bool is_xp3(struct header *h) { - return !memcmp(h->magic, XP3_MAGIC, 11); -} - - -/* Checks that the archive's version is supported, and that it is marked - as compatible with the KiriKiriZ engine. */ -static bool is_supported(struct header *h) { - return h->version == 1 && h->flags & 0x80; -} |