Skip to content

Commit

Permalink
FIXUP fixed code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prot0man committed Jan 17, 2024
1 parent d519e89 commit 6e161da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,16 @@ static int zip_entry_finalize(struct zip_t *zip,
const ssize_t n) {

ssize_t i = 0;
mz_uint64 *local_header_ofs_array = (mz_uint64 *)calloc(n, sizeof(mz_uint64));
if (!local_header_ofs_array) {
return ZIP_EOOMEM;
}

if(n == 0) {
return 0;
}

mz_uint64 *local_header_ofs_array = (mz_uint64 *)calloc(n, sizeof(mz_uint64));
if (!local_header_ofs_array) {
return ZIP_EOOMEM;
}

for (i = 0; i < n; ++i) {
local_header_ofs_array[i] = entry_mark[i].m_local_header_ofs;
ssize_t index = zip_sort(local_header_ofs_array, i);
Expand Down
2 changes: 1 addition & 1 deletion test/test_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ MU_TEST(test_entries_delete_stream) {
zdata = (uint8_t *)malloc(zsize);
mu_check(zdata != NULL);

rc = fread(zdata, zsize, 1, fh);
rc = fread(zdata, sizeof(uint8_t), zsize, fh);
mu_check(rc >= 1);

fclose(fh);
Expand Down

0 comments on commit 6e161da

Please sign in to comment.