Skip to content

Commit

Permalink
[vinapp] finish vinapp (frfr)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedropesserl committed Jun 24, 2023
1 parent 8fa3183 commit 95a0aae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion vinapp/TODO

This file was deleted.

4 changes: 4 additions & 0 deletions vinapp/src/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

static void extract(FILE *archive, struct File_info *dir,
size_t dirnmemb, char *member_name) {
size_t memb_name_size = strnlen(member_name, MAX_FNAME_LEN);
if (member_name[memb_name_size - 1] == '/')
member_name[memb_name_size - 1] = '\0';

char std_name[MAX_FNAME_LEN] = {0};
standardize_name(member_name, std_name);
size_t member_ord = get_ord(dir, dirnmemb, std_name);
Expand Down
4 changes: 2 additions & 2 deletions vinapp/src/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void insert(FILE *archive, struct File_info **dir,
}

if ((*dir)[member_ord-1].size > 0) {
uchar buffer[BUFFERSIZE];
uchar buffer[BUFFERSIZE] = {0};
size_t bytes_read;
fseek(archive, (*dir)[member_ord-1].pos, SEEK_SET);
do {
Expand Down Expand Up @@ -139,7 +139,7 @@ void update_archive(char *archive_path, int nmemb, char **membv) {
}

for (int i = 0; i < nmemb; i++) {
char std_name[MAX_FNAME_LEN];
char std_name[MAX_FNAME_LEN] = {0};
standardize_name(membv[i], std_name);
size_t member_ord = get_ord(dir, dirnmemb, std_name);
if (member_ord == 0) {
Expand Down
4 changes: 4 additions & 0 deletions vinapp/src/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

static void remove_trunc(FILE *archive, struct File_info **dir,
size_t *dirnmemb, char *member_name) {
size_t memb_name_size = strnlen(member_name, MAX_FNAME_LEN);
if (member_name[memb_name_size - 1] == '/')
member_name[memb_name_size - 1] = '\0';

char std_name[MAX_FNAME_LEN] = {0};
standardize_name(member_name, std_name);
size_t member_ord = get_ord(*dir, *dirnmemb, std_name);
Expand Down

0 comments on commit 95a0aae

Please sign in to comment.