Clean code

This commit is contained in:
atxr 2024-02-06 20:18:33 +01:00
parent fe7ca3c37a
commit 3636d3fa0d
3 changed files with 11 additions and 4 deletions

View file

@ -1,6 +1,9 @@
#include "libmineziper.h" #include "libmineziper.h"
bool detect_overlaps(char* filename) {} bool detect_overlaps(char* filename)
{
return true;
}
int get_uncompressed_size(zip* in) int get_uncompressed_size(zip* in)
{ {

View file

@ -1,6 +1,9 @@
#include "libmineziper_zip.h" #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "libmineziper_zip.h"
void get_eocd(raw* raw, zip* out) void get_eocd(raw* raw, zip* out)
{ {
if (raw->size < START_EOCD_SEARCH) if (raw->size < START_EOCD_SEARCH)
@ -11,7 +14,7 @@ void get_eocd(raw* raw, zip* out)
{ {
if (strcmp(se, EOCD_SIG) == 0) if (strcmp(se, EOCD_SIG) == 0)
{ {
out->eocd = se; out->eocd = (EOCD*) se;
out->cdh = (CDH**) malloc(out->eocd->number_of_entries * sizeof(CDH*)); out->cdh = (CDH**) malloc(out->eocd->number_of_entries * sizeof(CDH*));
break; break;
} }
@ -30,7 +33,7 @@ void get_cdh(raw* raw, zip* out)
out->cd = raw->buf + out->eocd->off_cdh; out->cd = raw->buf + out->eocd->off_cdh;
CDH* cdh = out->cd; CDH* cdh = (CDH*) out->cd;
for (int i = 0; i < out->eocd->number_of_entries; i++) for (int i = 0; i < out->eocd->number_of_entries; i++)
{ {
out->cdh[i] = cdh; out->cdh[i] = cdh;

View file

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "libmineziper_zip.h" #include "libmineziper_zip.h"
#define BUF_SIZE 0xfffff #define BUF_SIZE 0xfffff