diff --git a/build/embed-asset-path.sh b/build/embed-asset-path.sh index 520f527..cf7005c 100644 --- a/build/embed-asset-path.sh +++ b/build/embed-asset-path.sh @@ -67,7 +67,7 @@ cat <> src/assets.c // vv ${name} vv snprintf(incpath,511,"%s/%s",CJIT->tmpdir,"${name}"); -if(CJIT->fresh) res = muntargz_to_path(CJIT->tmpdir,(char*)&${varname},${varname}_len); +if(CJIT->fresh) res = muntargz_to_path(CJIT->tmpdir,(const uint8_t*)&${varname},${varname}_len); if(res!=0) { _err("Error extracting %s",incpath); return(false); } tcc_add_include_path(CJIT->TCC, incpath); // ^^ ${name} ^^ diff --git a/src/cjit.h b/src/cjit.h index 702c76e..3658027 100644 --- a/src/cjit.h +++ b/src/cjit.h @@ -46,9 +46,9 @@ struct CJITState { typedef struct CJITState CJITState; extern CJITState* cjit_new(); - -bool cjit_compile_file(CJITState *cjit, const char *_path); -bool cjit_add_file(CJITState *cjit, const char *path); +extern bool cjit_setup(CJITState *cjit); +extern bool cjit_compile_file(CJITState *cjit, const char *_path); +extern bool cjit_add_file(CJITState *cjit, const char *path); extern int cjit_exec(CJITState *cjit, int argc, char **argv); diff --git a/src/file.c b/src/file.c index 09b8432..7a793c4 100644 --- a/src/file.c +++ b/src/file.c @@ -245,9 +245,8 @@ static char *full_content = NULL; static int file_load_ftw(const char *pathname, const struct stat *sbuf, int type, struct FTW *ftwb) { - FILE *fd; - char *content = NULL; unsigned int len; + char *content = NULL; if (type == FTW_F) { size_t pathlen = strlen(pathname); if (pathname[pathlen-1] == 'c' && @@ -276,8 +275,6 @@ static int file_load_ftw(const char *pathname, char *dir_load(const char *path) { struct stat sb; - FILE *fd; - char *content = NULL; if (stat(path, &sb) != 0) { _err("Error: %s",path); diff --git a/src/main.c b/src/main.c index f3ff884..b730118 100644 --- a/src/main.c +++ b/src/main.c @@ -180,7 +180,8 @@ int main(int argc, char **argv) { cjit_free(CJIT); unsigned int len = 0; _err("Extract contents of: %s",opt.arg); - char *targz = file_load(opt.arg, &len); + const uint8_t *targz = (const uint8_t*) + file_load(opt.arg, &len); if(!targz) exit(1); if(!len) exit(1); muntargz_to_path(".",targz,len); diff --git a/src/muntar.c b/src/muntar.c index cb84ddb..3a484c1 100644 --- a/src/muntar.c +++ b/src/muntar.c @@ -113,11 +113,11 @@ static int raw_to_header(mtar_header_t *h, const mtar_raw_header_t *rh) h->devminor = (uint32_t) decodeTarOctal(rh->devminor, sizeof(rh->devminor)); h->type = (uint32_t) rh->type; - strncpy(h->name, rh->name, sizeof(rh->name)); + strncpy(h->name, rh->name, sizeof(h->name)); h->name[ sizeof(h->name) - 1 ] = 0; - strncpy(h->linkname, rh->linkname, sizeof(rh->linkname)); + strncpy(h->linkname, rh->linkname, sizeof(h->linkname)); h->linkname[ sizeof(h->linkname) - 1 ] = 0; - strncpy(h->path, rh->path, sizeof(rh->path)); + strncpy(h->path, rh->path, sizeof(h->path)); h->path[ sizeof(h->path) - 1 ] = 0; return MTAR_ESUCCESS;