Fix some build errors with MSVC 2003/2005 cores

This commit is contained in:
twinaphex 2018-03-28 16:22:35 +02:00
parent bb86387986
commit 167b977c4d
7 changed files with 16 additions and 11 deletions

View File

@ -2372,8 +2372,15 @@ static bool frontend_unix_check_for_path_changes(path_change_data_t *change_data
{
unsigned j;
/* A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers writes. It is not common for a file system to flush the buffers when the stream is closed.
* So we manually fsync() here to flush the data to disk, to make sure that the new data is immediately available when the file is re-read.
/* A successful close does not guarantee that the
* data has been successfully saved to disk,
* as the kernel defers writes. It is
* not common for a file system to flush
* the buffers when the stream is closed.
*
* So we manually fsync() here to flush the data
* to disk, to make sure that the new data is
* immediately available when the file is re-read.
*/
for (j = 0; j < inotify_data->wd_list->count; j++)
{
@ -2381,7 +2388,7 @@ static bool frontend_unix_check_for_path_changes(path_change_data_t *change_data
{
/* found the right file, now sync it */
const char *path = inotify_data->path_list->elems[j].data;
FILE *fp = fopen_utf8(path, "rb");
FILE *fp = (FILE*)fopen_utf8(path, "rb");
RARCH_LOG("file change detected: %s\n", path);

View File

@ -25,7 +25,6 @@
#include <retro_common.h>
#include <stdio.h>
#include <stdarg.h>
#if _MSC_VER < 1800

View File

@ -1,5 +1,6 @@
#include <compat/fopen_utf8.h>
#include <encodings/utf.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX)
@ -11,7 +12,7 @@
#ifdef _WIN32
#undef fopen
FILE* fopen_utf8(const char * filename, const char * mode)
void *fopen_utf8(const char * filename, const char * mode)
{
#if defined(_XBOX)
return fopen(filename, mode);

View File

@ -862,7 +862,7 @@ bool config_file_write(config_file_t *conf, const char *path)
if (!string_is_empty(path))
{
void* buf = NULL;
FILE *file = fopen_utf8(path, "wb");
FILE *file = (FILE*)fopen_utf8(path, "wb");
if (!file)
return false;

View File

@ -1,13 +1,11 @@
#ifndef __FOPEN_UTF8_H
#define __FOPEN_UTF8_H
#include <stdio.h>
#ifdef _WIN32
/* defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */
/* TODO: enable */
/* #define fopen (use fopen_utf8 instead) */
FILE* fopen_utf8(const char * filename, const char * mode);
void *fopen_utf8(const char * filename, const char * mode);
#else
#define fopen_utf8 fopen
#endif

View File

@ -264,7 +264,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
{
FILE *fp = fopen_utf8(path, mode_str);
FILE *fp = (FILE*)fopen_utf8(path, mode_str);
if (!fp)
goto error;

View File

@ -101,7 +101,7 @@ void retro_main_log_file_init(const char *path)
if (path == NULL)
return;
log_file_fp = fopen_utf8(path, "wb");
log_file_fp = (FILE*)fopen_utf8(path, "wb");
log_file_initialized = true;
/* TODO: this is only useful for a few platforms, find which and add ifdef */