Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup/reorganize header field constants #19

Open
thilo-schmitt opened this issue Mar 19, 2023 · 0 comments
Open

Cleanup/reorganize header field constants #19

thilo-schmitt opened this issue Mar 19, 2023 · 0 comments

Comments

@thilo-schmitt
Copy link
Owner

We now have a huge list of constatns (constexprs, I guess) used for describing the offset and length of header fields. This is not too pleasant to read. We might be able to remodel/reorganize that into something more descriptive and less loose-coupled-lists style.

For example, maybe something like the following?

enum class header_field_name {
  v7_ustar_name,
  //...
  ustar_magic,
  //...
};
struct header_field_descriptor {
  unsigned offset;
  unsigned length;
};
const std::map<header_field_name, header_field_descriptor> tar_headers = {
  {header_field_name::v7_ustar_name, {0u, 100u}},
  //...
  {header_field_name::ustar_magic, {257u, 6u}},
  //...
};
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

No branches or pull requests

1 participant