Create RFILE_MODE_READ_TEXT

This commit is contained in:
twinaphex 2016-06-03 03:14:42 +02:00
parent d9ba04e470
commit 2b33c731d0
5 changed files with 17 additions and 3 deletions

View File

@ -411,7 +411,7 @@ bool video_shader_resolve_parameters(config_file_t *conf,
for (i = 0; i < shader->passes; i++)
{
char line[4096] = {0};
RFILE *file = filestream_open(shader->pass[i].source.path, RFILE_MODE_READ, -1);
RFILE *file = filestream_open(shader->pass[i].source.path, RFILE_MODE_READ_TEXT, -1);
if (!file)
continue;

View File

@ -291,7 +291,7 @@ static unsigned char check_arm_cpu_feature(const char* feature)
{
char line[1024];
unsigned char status = 0;
RFILE *fp = filestream_open("/proc/cpuinfo", RFILE_MODE_READ, -1);
RFILE *fp = filestream_open("/proc/cpuinfo", RFILE_MODE_READ_TEXT, -1);
if (!fp)
return 0;

View File

@ -38,6 +38,7 @@ typedef struct RFILE RFILE;
enum
{
RFILE_MODE_READ = 0,
RFILE_MODE_READ_TEXT,
RFILE_MODE_WRITE,
RFILE_MODE_READ_WRITE,

View File

@ -129,6 +129,19 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
switch (mode & 0xff)
{
case RFILE_MODE_READ_TEXT:
#if defined(VITA) || defined(PSP)
mode_int = 0777;
flags = PSP_O_RDONLY;
#else
#if defined(HAVE_BUFFERED_IO)
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
mode_str = "r";
#endif
/* No "else" here */
flags = O_RDONLY;
#endif
break;
case RFILE_MODE_READ:
#if defined(VITA) || defined(PSP)
mode_int = 0777;

View File

@ -379,7 +379,7 @@ static bool playlist_read_file(
char buf[PLAYLIST_ENTRIES][1024] = {{0}};
playlist_entry_t *entry = NULL;
char *last = NULL;
RFILE *file = filestream_open(path, RFILE_MODE_READ, -1);
RFILE *file = filestream_open(path, RFILE_MODE_READ_TEXT, -1);
/* If playlist file does not exist,
* create an empty playlist instead.