mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
use LEGACY_WIN32 ifdef for filestream also
This commit is contained in:
parent
bd06668075
commit
0d06a48546
@ -61,6 +61,15 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
/* Assume W-functions do not work below VC2005 and Xbox platforms */
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX)
|
||||
|
||||
#ifndef LEGACY_WIN32
|
||||
#define LEGACY_WIN32
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <streams/file_stream.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <memmap.h>
|
||||
@ -78,7 +87,7 @@ struct RFILE
|
||||
|
||||
#define HAVE_BUFFERED_IO 1
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1400) || defined(_XBOX) || !defined(_WIN32)
|
||||
#if !defined(_WIN32) || defined(LEGACY_WIN32)
|
||||
#define MODE_STR_READ "r"
|
||||
#define MODE_STR_READ_UNBUF "rb"
|
||||
#define MODE_STR_WRITE_UNBUF "wb"
|
||||
@ -145,7 +154,7 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
|
||||
int flags = 0;
|
||||
int mode_int = 0;
|
||||
#if defined(HAVE_BUFFERED_IO)
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1400) || defined(_XBOX) || !defined(_WIN32)
|
||||
#if !defined(_WIN32) || defined(LEGACY_WIN32)
|
||||
const char *mode_str = NULL;
|
||||
#else
|
||||
const wchar_t *mode_str = NULL;
|
||||
@ -245,14 +254,14 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
|
||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0 && mode_str)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX)
|
||||
(void)path_local;
|
||||
(void)path_wide;
|
||||
#if defined(LEGACY_WIN32)
|
||||
path_local = utf8_to_local_string_alloc(path);
|
||||
stream->fp = fopen(path_local, mode_str);
|
||||
if (path_local)
|
||||
free(path_local);
|
||||
#else
|
||||
(void)path_local;
|
||||
path_wide = utf8_to_utf16_string_alloc(path);
|
||||
stream->fp = _wfopen(path_wide, mode_str);
|
||||
if (path_wide)
|
||||
@ -269,7 +278,7 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
|
||||
{
|
||||
/* FIXME: HAVE_BUFFERED_IO is always 1, but if it is ever changed, open() needs to be changed to _wopen() for WIndows. */
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX)
|
||||
#if defined(LEGACY_WIN32)
|
||||
(void)path_wide;
|
||||
path_local = utf8_to_local_string_alloc(path);
|
||||
stream->fd = open(path_local, flags, mode_int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user