Skip to content

Add parsing support for Install files.#29

Open
ChrisKader wants to merge 1 commit into
wowless:mainfrom
ChrisKader:main
Open

Add parsing support for Install files.#29
ChrisKader wants to merge 1 commit into
wowless:mainfrom
ChrisKader:main

Conversation

@ChrisKader

Copy link
Copy Markdown

No description provided.

@ferronn-dev ferronn-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a first pass on the data structures, I'll have more to say about the parsing code itself

Comment thread tactless.c

// Structure to hold the parsed install file information
typedef struct {
int hash_size;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything else in tactless assumes a 16-byte hash; more consistent to just do the same. this field doesn't need to exist

Comment thread tactless.c
// Structure to hold the parsed install file information
typedef struct {
int hash_size;
int version;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should just be asserted to some value; doesn't need to be here

Comment thread tactless.c
int hash_size;
int version;
int num_tags;
InstallTagEntry tags[MAX_TAGS];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be dynamically allocated, and just declared InstallTagEntry *tags here

Comment thread tactless.c
int num_tags;
InstallTagEntry tags[MAX_TAGS];
int num_entries;
InstallFileEntry files[MAX_FILES];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment thread tactless.c
return ret;
}

#define MAX_TAGS 128

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all three of these and use dynamic allocation instead

Comment thread tactless.c
#define MAX_FILE_NAME_LENGTH 255

// Structure to hold an install tag entry
typedef struct {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the typedef, and use snake case: struct install_tag_entry {

Comment thread tactless.c
uint8_t *files;
} InstallTagEntry;

// Structure to hold an install file entry

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same deal here: remove comment, remove typedef, snake case

Comment thread tactless.c
uint8_t *tags;
} InstallFileEntry;

// Structure to hold the parsed install file information

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here re comment, typedef, name

Comment thread tactless.c
InstallFileEntry files[MAX_FILES];
} InstallFile;

void print_install_file(const InstallFile *install) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see how the various _dump functions are set up, exposed in tactless.h, and invoked from main.c

Comment thread tactless.c
printf("\n");
}

int parse_install_file(const uint8_t *data, size_t data_size,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename it parse_install for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants