static STREAMFILE *open_stdio(STDIOSTREAMFILE *streamFile,const char * const filename,size_t buffersize) { int newfd; FILE *newfile; STREAMFILE *newstreamFile; if (!filename) return NULL; // Below code is disabled just for Android, it won't work, use the normal way to open // if same name, duplicate the file pointer we already have open /* if (!strcmp(streamFile->name,filename)) { if (((newfd = dup(fileno(streamFile->infile))) >= 0) && (newfile = fdopen( newfd, "rb" ))) { newstreamFile = open_stdio_streamfile_buffer_by_FILE(newfile,filename,buffersize); if (newstreamFile) { return newstreamFile; } // failure, close it and try the default path (which will probably fail a second time) fclose(newfile); } } */ // a normal open, open a new file return open_stdio_streamfile_buffer(filename,buffersize); }
static STREAMFILE *open_stdio(STDIOSTREAMFILE *streamFile,const char * const filename,size_t buffersize) { int newfd; FILE *newfile; STREAMFILE *newstreamFile; if (!filename) return NULL; #if !defined (__ANDROID__) // if same name, duplicate the file pointer we already have open if (!strcmp(streamFile->name,filename)) { if (((newfd = dup(fileno(streamFile->infile))) >= 0) && (newfile = fdopen( newfd, "rb" ))) { newstreamFile = open_stdio_streamfile_buffer_by_file(newfile,filename,buffersize); if (newstreamFile) { return newstreamFile; } // failure, close it and try the default path (which will probably fail a second time) fclose(newfile); } } #endif // a normal open, open a new file return open_stdio_streamfile_buffer(filename,buffersize); }
STREAMFILE * open_stdio_streamfile(const char * filename) { return open_stdio_streamfile_buffer(filename,STREAMFILE_DEFAULT_BUFFER_SIZE); }