* the directory entry, and the actual contents of the file
* to the PAK file itself.
*/
- if (fs_file_seek(fp, 0, SEEK_END) != 0 || ((len = fs_file_tell(fp)) < 0)) {
- fs_file_close(fp);
- return false;
- }
- fs_file_seek(fp, 0, SEEK_SET);
+ if (fs_file_seek(fp, 0, SEEK_END) != 0 || ((len = fs_file_tell(fp)) < 0))
+ goto err;
+ if (fs_file_seek(fp, 0, SEEK_SET) != 0)
+ goto err;
dir.len = len;
dir.pos = fs_file_tell(pak->handle);
* We're limited to 56 bytes for a file name string, that INCLUDES
* the directory and '/' seperators.
*/
- if (strlen(file) >= 56) {
- fs_file_close(fp);
- return false;
- }
+ if (strlen(file) >= 56)
+ goto err;
util_strncpy(dir.name, file, strlen(file));
* Allocate some memory for loading in the data that will be
* redirected into the PAK file.
*/
- if (!(dat = (unsigned char *)mem_a(dir.len))) {
- fs_file_close(fp);
- return false;
- }
+ if (!(dat = (unsigned char *)mem_a(dir.len)))
+ goto err;
fs_file_read (dat, dir.len, 1, fp);
fs_file_close(fp);
vec_push(pak->directories, dir);
return true;
+
+err:
+ fs_file_close(fp);
+ return false;
}
/*
* 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;
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;