Skip to content

Commit

Permalink
Add number of image idxs written to the SKAP in the header section (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed Jun 9, 2024
1 parent 53b6913 commit 9b35f95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tools/skap/include/skap_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ typedef struct {
char signature[4];
u8 fmt_ver;
u64 build_ver;
usz idx_image_count;
} skap_header;

skap_header skap_header_create(void);
skap_header skap_header_create(usz idx_image_count);

u8 skap_header_append(FILE *fd, skap_header *h);
2 changes: 1 addition & 1 deletion tools/skap/src/skap.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main(void) {
SetTraceLogLevel(LOG_WARNING);
skap_idx_image_loadall(imgs, img_paths, IMG_COUNT);
FILE *fd = skap_file_create();
skap_header header = skap_header_create();
skap_header header = skap_header_create(IMG_COUNT);
if (!skap_header_append(fd, &header)) skap_return_defer(1);
for (usz i = 0; i < IMG_COUNT; ++i) {
img_idxs[i] = skap_idx_image_create(img_paths[i], &imgs[i]);
Expand Down
5 changes: 3 additions & 2 deletions tools/skap/src/skap_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ static u64 compute_build_ver(void) {
return build_ver;
}

skap_header skap_header_create(void) {
skap_header skap_header_create(usz idx_image_count) {
return (skap_header) {
.signature = { 'S', 'K', 'A', 'P' },
.fmt_ver = 1,
.build_ver = compute_build_ver()
.build_ver = compute_build_ver(),
.idx_image_count = idx_image_count
};
}

Expand Down

0 comments on commit 9b35f95

Please sign in to comment.