Buildfixes

This commit is contained in:
twinaphex 2018-03-29 15:46:39 +02:00
parent ca7c374303
commit 4347517604

View File

@ -73,21 +73,16 @@ char* get_temp_directory_alloc(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
#ifdef LEGACY_WIN32 #ifdef LEGACY_WIN32
DWORD pathLength; DWORD pathLength = GetTempPath(0, NULL) + 1;
char *path; char *path = (char*)malloc(pathLength * sizeof(char));
pathLength = GetTempPath(0, NULL) + 1;
path = (char*)malloc(pathLength * sizeof(char));
path[pathLength - 1] = 0; path[pathLength - 1] = 0;
GetTempPath(pathLength, path); GetTempPath(pathLength, path);
return path; return path;
#else #else
DWORD pathLength;
wchar_t *wideStr;
char *path; char *path;
DWORD pathLength = GetTempPathW(0, NULL) + 1;
pathLength = GetTempPathW(0, NULL) + 1; wchar_t *wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t));
wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t));
wideStr[pathLength - 1] = 0; wideStr[pathLength - 1] = 0;
GetTempPathW(pathLength, wideStr); GetTempPathW(pathLength, wideStr);
@ -96,8 +91,7 @@ char* get_temp_directory_alloc(void)
return path; return path;
#endif #endif
#else #else
char *path; char *path = strcpy_alloc_force(getenv("TMPDIR");
path = strcpy_alloc_force(getenv("TMPDIR");
return path; return path;
#endif #endif
} }
@ -177,9 +171,9 @@ void* read_file_data_alloc(const char *fileName, int *size)
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
#ifdef _WIN32 #ifdef _WIN32
fileSizeLong = _ftelli64(f); fileSizeLong = _ftelli64(f);
#else #else
fileSizeLong = ftello64(f); fileSizeLong = ftello64(f);
#endif #endif
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);