X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=pak.c;h=c7974b51fb95da033777350de45a35f890e3af7a;hp=4bf7e5f423f4f96666b72009ec5f1f7763b062d9;hb=033cf7c7d397c3fdc23a1448b0068000219efef6;hpb=586a70ea1d7a4b6af842cc96bba790b695ecee06 diff --git a/pak.c b/pak.c index 4bf7e5f..c7974b5 100644 --- a/pak.c +++ b/pak.c @@ -24,6 +24,7 @@ #include #include "gmqcc.h" +#include "platform.h" /* * The PAK format uses a FOURCC concept for storing the magic ident within @@ -98,14 +99,14 @@ static void pak_tree_build(const char *entry) { memset(pathsplit, 0, 56); - util_strncpy(directory, entry, 56); + platform_strncpy(directory, entry, 56); for (itr = 0; (token = pak_tree_sep(&directory, "/")) != NULL; itr++) { elements[itr] = token; } for (jtr = 0; jtr < itr - 1; jtr++) { - util_strcat(pathsplit, elements[jtr]); - util_strcat(pathsplit, "/"); + platform_strcat(pathsplit, elements[jtr]); + platform_strcat(pathsplit, "/"); if (fs_dir_make(pathsplit)) { mem_d(pathsplit); @@ -124,7 +125,7 @@ static void pak_tree_build(const char *entry) { typedef struct { pak_directory_t *directories; pak_header_t header; - FILE *handle; + fs_file_t *handle; bool insert; } pak_file_t; @@ -266,7 +267,7 @@ static bool pak_extract_one(pak_file_t *pak, const char *file, const char *outdi pak_directory_t *dir = NULL; unsigned char *dat = NULL; char *local = NULL; - FILE *out = NULL; + fs_file_t *out = NULL; if (!pak_exists(pak, file, &dir)) { return false; @@ -304,7 +305,7 @@ static bool pak_extract_one(pak_file_t *pak, const char *file, const char *outdi mem_d(dat); return true; - + err: if (dat) mem_d(dat); if (out) fs_file_close(out); @@ -333,7 +334,7 @@ static bool pak_insert_one(pak_file_t *pak, const char *file) { pak_directory_t dir; unsigned char *dat; long len; - FILE *fp; + fs_file_t *fp; /* * We don't allow insertion on files that already exist within the @@ -366,7 +367,7 @@ static bool pak_insert_one(pak_file_t *pak, const char *file) { if (strlen(file) >= 56) goto err; - util_strncpy(dir.name, file, strlen(file)); + platform_strncpy(dir.name, file, strlen(file)); /* * Allocate some memory for loading in the data that will be @@ -396,7 +397,8 @@ err: * Like pak_insert_one, except this collects files in all directories * from a root directory, and inserts them all. */ -bool pak_insert_all(pak_file_t *pak, const char *dir) { +#if 0 +static bool pak_insert_all(pak_file_t *pak, const char *dir) { DIR *dp; struct dirent *dirp; @@ -416,6 +418,7 @@ bool pak_insert_all(pak_file_t *pak, const char *dir) { fs_dir_close(dp); return true; } +#endif /*!if 0 renable when ready to use */ static bool pak_close(pak_file_t *pak) { size_t itr;