summaryrefslogtreecommitdiff
path: root/src/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/header.c')
-rw-r--r--src/header.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/header.c b/src/header.c
index 86f5e25..11dc654 100644
--- a/src/header.c
+++ b/src/header.c
@@ -39,6 +39,22 @@ static bool is_supported(struct header *h) {
}
+/* Generates an XP3 header structure readable by Nekopara. */
+struct header *create_header(void) {
+ struct header *h = malloc(sizeof(struct header));
+ if (h == NULL)
+ return NULL;
+
+ memcpy(h->magic, XP3_MAGIC, 11);
+ h->info_offset = 0x17;
+ h->version = 1;
+ h->flags = 0x80;
+ h->table_size = 0;
+ h->table_offset = 0;
+ return h;
+}
+
+
/* Reads from the given stream into a newly allocated header structure.
NULL is returned if the header contains an invalid magic number, or
if the archive's version is not supported. */
@@ -63,22 +79,6 @@ struct header *read_header(struct stream *s) {
}
-/* Generates an XP3 header structure readable by Nekopara. */
-struct header *create_header(void) {
- struct header *h = malloc(sizeof(struct header));
- if (h == NULL)
- return NULL;
-
- memcpy(h->magic, XP3_MAGIC, 11);
- h->info_offset = 0x17;
- h->version = 1;
- h->flags = 0x80;
- h->table_size = 0;
- h->table_offset = 0;
- return h;
-}
-
-
/* Dumps the XP3 header specified by `h` into `fp`. */
void dump_header(FILE *fp, struct header *h) {
fwrite(h->magic, 11, 1, fp);