From fc412391758ecfec2046092b5bf9bc642a3e9e13 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 20 Mar 2022 14:43:54 +0900 Subject: [PATCH] Remove include/file.h It was an outdated duplicate of system4/file.h. --- include/file.h | 29 ----------------------------- src/hll/File.c | 6 ++---- src/hll/MsgSkip.c | 2 +- src/resume.c | 2 +- src/system4.c | 1 - src/video.c | 2 +- src/vm.c | 1 - 7 files changed, 5 insertions(+), 38 deletions(-) delete mode 100644 include/file.h diff --git a/include/file.h b/include/file.h deleted file mode 100644 index ba212f4..0000000 --- a/include/file.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2019 Nunuhara Cabbage - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef SYSTEM4_FILE_H -#define SYSTEM4_FILE_H - -#include -#include -#include - -FILE *file_open_utf8(const char *path, const char *mode); -void *file_read(const char *path, size_t *len_out); -bool file_exists(const char *path); -int mkdir_p(const char *path); - -#endif /* SYSTEM4_FILE_H */ diff --git a/src/hll/File.c b/src/hll/File.c index c1bae8e..bc91993 100644 --- a/src/hll/File.c +++ b/src/hll/File.c @@ -22,10 +22,10 @@ #include #include "system4.h" +#include "system4/file.h" #include "system4/string.h" #include "hll.h" -#include "file.h" #include "savedata.h" #include "vm/heap.h" #include "vm/page.h" @@ -33,7 +33,6 @@ static FILE *current_file = NULL; static char *file_contents = NULL; -static size_t file_size = 0; static size_t file_cursor = 0; static int File_Open(struct string *filename, int type) @@ -72,7 +71,6 @@ static int File_Close(void) if (file_contents) free(file_contents); file_contents = NULL; - file_size = 0; file_cursor = 0; return r; } @@ -91,7 +89,7 @@ static int File_Read(struct page **_page) // read file inton memory if needed if (!file_contents) { fseek(current_file, 0, SEEK_END); - file_size = ftell(current_file); + size_t file_size = ftell(current_file); fseek(current_file, 0, SEEK_SET); file_contents = xmalloc(file_size + 1); diff --git a/src/hll/MsgSkip.c b/src/hll/MsgSkip.c index ec5b778..5833df9 100644 --- a/src/hll/MsgSkip.c +++ b/src/hll/MsgSkip.c @@ -21,10 +21,10 @@ #include "system4.h" #include "system4/ain.h" +#include "system4/file.h" #include "system4/string.h" #include "system4/utfsjis.h" -#include "file.h" #include "vm.h" #include "xsystem4.h" diff --git a/src/resume.c b/src/resume.c index 93fe24d..db2f510 100644 --- a/src/resume.c +++ b/src/resume.c @@ -23,9 +23,9 @@ #include "cJSON.h" #include "system4.h" +#include "system4/file.h" #include "system4/string.h" -#include "file.h" #include "savedata.h" #include "vm.h" #include "vm/heap.h" diff --git a/src/system4.c b/src/system4.c index 48f58f9..b82784a 100644 --- a/src/system4.c +++ b/src/system4.c @@ -36,7 +36,6 @@ #include "xsystem4.h" #include "asset_manager.h" #include "debugger.h" -#include "file.h" #include "gfx/gfx.h" #include "little_endian.h" #include "vm.h" diff --git a/src/video.c b/src/video.c index 2b335d9..65b136d 100644 --- a/src/video.c +++ b/src/video.c @@ -24,11 +24,11 @@ #include "system4.h" #include "system4/cg.h" +#include "system4/file.h" #include "system4/utfsjis.h" #include "gfx/gfx.h" #include "gfx/private.h" -#include "file.h" #include "xsystem4.h" struct sdl_private sdl; diff --git a/src/vm.c b/src/vm.c index bc7b25b..66eabc9 100644 --- a/src/vm.c +++ b/src/vm.c @@ -32,7 +32,6 @@ #include "system4/utfsjis.h" #include "debugger.h" -#include "file.h" #include "little_endian.h" #include "savedata.h" #include "vm.h"