(360) Fixed most compile errors for 360

This commit is contained in:
TwinAphex51224 2012-01-05 15:11:55 +01:00
parent 8320d0a0e9
commit 4812b632c3

25
file.c
View File

@ -830,10 +830,15 @@ char **dir_list_new(const char *dir, const char *ext)
char **dir_list = NULL;
#ifdef _WIN32
#if defined(_WIN32) && !defined(_XBOX)
WIN32_FIND_DATAW ffd;
wchar_t wchar_buf[PATH_MAX];
#else
LPWIN32_FIND_DATA ffd;
LPWSTR wchar_buf;
#endif
HANDLE hFind = INVALID_HANDLE_VALUE;
wchar_t wchar_buf[PATH_MAX];
char utf8_buf[PATH_MAX];
if (strlcpy(utf8_buf, dir, sizeof(utf8_buf)) >= sizeof(utf8_buf))
@ -850,7 +855,11 @@ char **dir_list_new(const char *dir, const char *ext)
if (MultiByteToWideChar(CP_UTF8, 0, utf8_buf, -1, wchar_buf, PATH_MAX) == 0)
goto error;
#ifdef _XBOX
hFind = FindFirstFile((LPCSTR)wchar_buf, ffd);
#else
hFind = FindFirstFileW(wchar_buf, &ffd);
#endif
if (hFind == INVALID_HANDLE_VALUE)
goto error;
#else
@ -874,9 +883,17 @@ char **dir_list_new(const char *dir, const char *ext)
{
// Not a perfect search of course, but hopefully good enough in practice.
#ifdef _WIN32
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#ifdef _XBOX
if (ffd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#else
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#endif
continue;
#ifdef _XBOX
if (WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)ffd->cFileName, -1, utf8_buf, PATH_MAX, NULL, NULL) == 0)
#else
if (WideCharToMultiByte(CP_UTF8, 0, ffd.cFileName, -1, utf8_buf, PATH_MAX, NULL, NULL) == 0)
#endif
continue;
if (ext && !strstr(utf8_buf, ext))
continue;
@ -909,8 +926,10 @@ char **dir_list_new(const char *dir, const char *ext)
memset(dir_list + cur_ptr, 0, (cur_size - cur_ptr) * sizeof(char*));
}
}
#ifdef _WIN32
#if defined(_WIN32) && !defined(_XBOX)
while (FindNextFileW(hFind, &ffd) != 0);
#else
while (FindNextFile(hFind, ffd) != 0);
#endif
#ifdef _WIN32