mirror of https://github.com/OpenRCT2/OpenRCT2.git
x64: Fix readentirefile calls
This commit is contained in:
parent
d6a3b1e093
commit
220afe04d5
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue