diff --git a/src/rct1.c b/src/rct1.c index 4534c71e9d..11a5a9b007 100644 --- a/src/rct1.c +++ b/src/rct1.c @@ -27,7 +27,7 @@ bool rct1_read_sc4(const char *path, rct1_s4 *s4) size_t length, decodedLength; bool success; - if (!readentirefile(path, (void**)&buffer, (int*)&length)) { + if (!readentirefile(path, (void**)&buffer, &length)) { gErrorType = ERROR_TYPE_FILE_LOAD; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; return 0; @@ -57,7 +57,7 @@ bool rct1_read_sv4(const char *path, rct1_s4 *s4) size_t length, decodedLength; bool success; - if (!readentirefile(path, (void**)&buffer, (int*)&length)) { + if (!readentirefile(path, (void**)&buffer, &length)) { gErrorType = ERROR_TYPE_FILE_LOAD; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; return 0; diff --git a/src/util/util.c b/src/util/util.c index 95d5f721ef..b391200f20 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -142,10 +142,10 @@ void path_remove_extension(utf8 *path) log_warning("No extension found. (path = %s)", path); } -bool readentirefile(const utf8 *path, void **outBuffer, int *outLength) +bool readentirefile(const utf8 *path, void **outBuffer, size_t *outLength) { SDL_RWops *fp; - int fpLength; + size_t fpLength; void *fpBuffer; // Open file @@ -154,7 +154,7 @@ bool readentirefile(const utf8 *path, void **outBuffer, int *outLength) return 0; // Get length - fpLength = (int)SDL_RWsize(fp); + fpLength = SDL_RWsize(fp); // Read whole file into a buffer fpBuffer = malloc(fpLength); diff --git a/src/util/util.h b/src/util/util.h index 0819393ade..ee26b9c6e2 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -34,7 +34,7 @@ const char *path_get_extension(const utf8 *path); void path_set_extension(utf8 *path, const utf8 *newExtension); void path_append_extension(utf8 *path, const utf8 *newExtension); void path_remove_extension(utf8 *path); -bool readentirefile(const utf8 *path, void **outBuffer, int *outLength); +bool readentirefile(const utf8 *path, void **outBuffer, size_t *outLength); int bitscanforward(int source); int bitcount(int source); diff --git a/src/windows/changelog.c b/src/windows/changelog.c index b3914bb323..72e2dfe829 100644 --- a/src/windows/changelog.c +++ b/src/windows/changelog.c @@ -92,7 +92,7 @@ static bool window_changelog_read_file(); static void window_changelog_dispose_file(); static char *_changelogText = NULL; -static long _changelogTextSize = 0; +static size_t _changelogTextSize = 0; static char **_changelogLines = NULL; static int _changelogNumLines = 0; static int _changelogLongestLineWidth = 0; @@ -208,7 +208,7 @@ static bool window_changelog_read_file() window_changelog_dispose_file(); utf8 path[MAX_PATH]; sprintf(path, "%s%cchangelog.txt", gExePath, platform_get_path_separator()); - if (!readentirefile(path, (void**)&_changelogText, (int*)&_changelogTextSize)) { + if (!readentirefile(path, (void**)&_changelogText, &_changelogTextSize)) { log_error("Unable to read changelog.txt"); return false; }