x64: Fix readentirefile calls

This commit is contained in:
Ted John 2016-09-06 21:33:15 +01:00
parent d6a3b1e093
commit 220afe04d5
4 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ bool rct1_read_sc4(const char *path, rct1_s4 *s4)
size_t length, decodedLength; size_t length, decodedLength;
bool success; bool success;
if (!readentirefile(path, (void**)&buffer, (int*)&length)) { if (!readentirefile(path, (void**)&buffer, &length)) {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
return 0; return 0;
@ -57,7 +57,7 @@ bool rct1_read_sv4(const char *path, rct1_s4 *s4)
size_t length, decodedLength; size_t length, decodedLength;
bool success; bool success;
if (!readentirefile(path, (void**)&buffer, (int*)&length)) { if (!readentirefile(path, (void**)&buffer, &length)) {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
return 0; return 0;

View File

@ -142,10 +142,10 @@ void path_remove_extension(utf8 *path)
log_warning("No extension found. (path = %s)", 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; SDL_RWops *fp;
int fpLength; size_t fpLength;
void *fpBuffer; void *fpBuffer;
// Open file // Open file
@ -154,7 +154,7 @@ bool readentirefile(const utf8 *path, void **outBuffer, int *outLength)
return 0; return 0;
// Get length // Get length
fpLength = (int)SDL_RWsize(fp); fpLength = SDL_RWsize(fp);
// Read whole file into a buffer // Read whole file into a buffer
fpBuffer = malloc(fpLength); fpBuffer = malloc(fpLength);

View File

@ -34,7 +34,7 @@ const char *path_get_extension(const utf8 *path);
void path_set_extension(utf8 *path, const utf8 *newExtension); void path_set_extension(utf8 *path, const utf8 *newExtension);
void path_append_extension(utf8 *path, const utf8 *newExtension); void path_append_extension(utf8 *path, const utf8 *newExtension);
void path_remove_extension(utf8 *path); 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 bitscanforward(int source);
int bitcount(int source); int bitcount(int source);

View File

@ -92,7 +92,7 @@ static bool window_changelog_read_file();
static void window_changelog_dispose_file(); static void window_changelog_dispose_file();
static char *_changelogText = NULL; static char *_changelogText = NULL;
static long _changelogTextSize = 0; static size_t _changelogTextSize = 0;
static char **_changelogLines = NULL; static char **_changelogLines = NULL;
static int _changelogNumLines = 0; static int _changelogNumLines = 0;
static int _changelogLongestLineWidth = 0; static int _changelogLongestLineWidth = 0;
@ -208,7 +208,7 @@ static bool window_changelog_read_file()
window_changelog_dispose_file(); window_changelog_dispose_file();
utf8 path[MAX_PATH]; utf8 path[MAX_PATH];
sprintf(path, "%s%cchangelog.txt", gExePath, platform_get_path_separator()); 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"); log_error("Unable to read changelog.txt");
return false; return false;
} }