Add parsing support for Install files.#29
Conversation
ferronn-dev
left a comment
There was a problem hiding this comment.
this is a first pass on the data structures, I'll have more to say about the parsing code itself
|
|
||
| // Structure to hold the parsed install file information | ||
| typedef struct { | ||
| int hash_size; |
There was a problem hiding this comment.
everything else in tactless assumes a 16-byte hash; more consistent to just do the same. this field doesn't need to exist
| // Structure to hold the parsed install file information | ||
| typedef struct { | ||
| int hash_size; | ||
| int version; |
There was a problem hiding this comment.
this should just be asserted to some value; doesn't need to be here
| int hash_size; | ||
| int version; | ||
| int num_tags; | ||
| InstallTagEntry tags[MAX_TAGS]; |
There was a problem hiding this comment.
this should be dynamically allocated, and just declared InstallTagEntry *tags here
| int num_tags; | ||
| InstallTagEntry tags[MAX_TAGS]; | ||
| int num_entries; | ||
| InstallFileEntry files[MAX_FILES]; |
| return ret; | ||
| } | ||
|
|
||
| #define MAX_TAGS 128 |
There was a problem hiding this comment.
remove all three of these and use dynamic allocation instead
| #define MAX_FILE_NAME_LENGTH 255 | ||
|
|
||
| // Structure to hold an install tag entry | ||
| typedef struct { |
There was a problem hiding this comment.
remove the typedef, and use snake case: struct install_tag_entry {
| uint8_t *files; | ||
| } InstallTagEntry; | ||
|
|
||
| // Structure to hold an install file entry |
There was a problem hiding this comment.
same deal here: remove comment, remove typedef, snake case
| uint8_t *tags; | ||
| } InstallFileEntry; | ||
|
|
||
| // Structure to hold the parsed install file information |
There was a problem hiding this comment.
same here re comment, typedef, name
| InstallFileEntry files[MAX_FILES]; | ||
| } InstallFile; | ||
|
|
||
| void print_install_file(const InstallFile *install) { |
There was a problem hiding this comment.
see how the various _dump functions are set up, exposed in tactless.h, and invoked from main.c
| printf("\n"); | ||
| } | ||
|
|
||
| int parse_install_file(const uint8_t *data, size_t data_size, |
There was a problem hiding this comment.
rename it parse_install for consistency
No description provided.