mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +01:00
Update file_stream_transforms.h
This commit is contained in:
parent
9a0fde1d6d
commit
3b5b5e2309
@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (file_stream.h).
|
||||
* The following license statement only applies to this file (file_stream_transforms.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
@ -24,6 +24,7 @@
|
||||
#define __LIBRETRO_SDK_FILE_STREAM_TRANSFORMS_H
|
||||
|
||||
#include <streams/file_stream.h>
|
||||
#include <retro_inline.h>
|
||||
#include <string.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
@ -38,56 +39,51 @@ RETRO_BEGIN_DECLS
|
||||
#define fgets rfgets
|
||||
#define fwrite rfwrite
|
||||
|
||||
inline RFILE* rfopen(const char* path, char* mode)
|
||||
static INLINE RFILE* rfopen(const char *path, char *mode)
|
||||
{
|
||||
unsigned int retro_mode = RFILE_MODE_READ_TEXT;
|
||||
if (strstr(mode, "r"))
|
||||
{
|
||||
if (strstr(mode, "b"))
|
||||
{
|
||||
retro_mode = RFILE_MODE_READ;
|
||||
}
|
||||
}
|
||||
if (strstr(mode, "w"))
|
||||
{
|
||||
retro_mode = RFILE_MODE_WRITE;
|
||||
}
|
||||
if (strstr(mode, "+"))
|
||||
{
|
||||
retro_mode = RFILE_MODE_READ_WRITE;
|
||||
}
|
||||
unsigned int retro_mode = RFILE_MODE_READ_TEXT;
|
||||
if (strstr(mode, "r"))
|
||||
if (strstr(mode, "b"))
|
||||
retro_mode = RFILE_MODE_READ;
|
||||
|
||||
return filestream_open(path, retro_mode, -1);
|
||||
if (strstr(mode, "w"))
|
||||
retro_mode = RFILE_MODE_WRITE;
|
||||
if (strstr(mode, "+"))
|
||||
retro_mode = RFILE_MODE_READ_WRITE;
|
||||
|
||||
return filestream_open(path, retro_mode, -1);
|
||||
}
|
||||
|
||||
inline int rfclose(RFILE* stream)
|
||||
static INLINE int rfclose(RFILE* stream)
|
||||
{
|
||||
return filestream_close(stream);
|
||||
return filestream_close(stream);
|
||||
}
|
||||
|
||||
inline long rftell(RFILE* stream)
|
||||
static INLINE long rftell(RFILE* stream)
|
||||
{
|
||||
return filestream_tell(stream);
|
||||
return filestream_tell(stream);
|
||||
}
|
||||
|
||||
inline int rfseek(RFILE* stream, long offset, int origin)
|
||||
static INLINE int rfseek(RFILE* stream, long offset, int origin)
|
||||
{
|
||||
return filestream_seek(stream, offset, origin);
|
||||
return filestream_seek(stream, offset, origin);
|
||||
}
|
||||
|
||||
inline size_t rfread(void* buffer, size_t elementSize, size_t elementCount, RFILE* stream)
|
||||
static INLINE size_t rfread(void* buffer,
|
||||
size_t elementSize, size_t elementCount, RFILE* stream)
|
||||
{
|
||||
return filestream_read(stream, buffer, elementSize*elementCount);
|
||||
return filestream_read(stream, buffer, elementSize*elementCount);
|
||||
}
|
||||
|
||||
inline char* rfgets(char* buffer, int maxCount, FILE* stream)
|
||||
static INLINE char *rfgets(char *buffer, int maxCount, FILE* stream)
|
||||
{
|
||||
return filestream_gets(stream, buffer, maxCount);
|
||||
return filestream_gets(stream, buffer, maxCount);
|
||||
}
|
||||
|
||||
inline size_t rfwrite(void const* buffer, size_t elementSize, size_t elementCount, RFILE* stream)
|
||||
static INLINE size_t rfwrite(void const* buffer,
|
||||
size_t elementSize, size_t elementCount, RFILE* stream)
|
||||
{
|
||||
return filestream_write(stream, buffer, elementSize*elementCount);
|
||||
return filestream_write(stream, buffer, elementSize*elementCount);
|
||||
}
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user