summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjakob <jakob@memeware.net>2017-05-14 11:20:43 -0400
committerjakob <jakob@memeware.net>2017-05-14 11:20:43 -0400
commit41a7566c121a865b460649390a75473ac71eff1f (patch)
tree5b0dd520290e52cf879808ca69135617963e9d3c /src
parent0f89d85ba8514fb36eacfe3a19b7f460b3547b24 (diff)
Fixed issue with dump_table
Diffstat (limited to 'src')
-rw-r--r--src/table.c5
-rw-r--r--src/table.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/table.c b/src/table.c
index 7bf6c2a..849780d 100644
--- a/src/table.c
+++ b/src/table.c
@@ -243,7 +243,8 @@ static void dump_segm(struct stream *s, struct table_entry *cur) {
/* Dumps the File entry for `cur` into the table at `s` and returns the
number of bytes written. */
static uint64_t dump_file(struct stream *s, struct table_entry *cur) {
- uint32_t magic = FILE_MAGIC;
+ uint32_t magic = FILE_MAGIC;
+ uint64_t bytes_written = 28 * cur->segment_count + 48;
stream_write(s, &magic, sizeof(uint32_t));
stream_write(s, &bytes_written, sizeof(uint64_t));
@@ -254,7 +255,7 @@ static uint64_t dump_file(struct stream *s, struct table_entry *cur) {
stream_seek(s, -bytes_written, SEEK_CUR);
stream_write(s, &bytes_written, sizeof(uint64_t));
stream_seek(s, bytes_written, SEEK_CUR);
- return 28 * cur->segment_count + 48;
+ return bytes_written;
}
diff --git a/src/table.h b/src/table.h
index 53012f7..e36759c 100644
--- a/src/table.h
+++ b/src/table.h
@@ -76,7 +76,7 @@ void entry_free(struct table_entry *cur);
/* Dumps the XP3 table specified by `root` into `s` and returns the
number of bytes written. */
-void dump_table(struct stream *s, struct table_entry *root);
+uint64_t dump_table(struct stream *s, struct table_entry *root);
/* Inserts the file specified by `path` into the table linked list
specified by `root`. */