File tree Expand file tree Collapse file tree 1 file changed +1
-25
lines changed Expand file tree Collapse file tree 1 file changed +1
-25
lines changed Original file line number Diff line number Diff line change 1313//  limitations under the License.
1414
1515#include  " vfs_api.h" 
16- #include  < stdio_ext.h> 
1716
1817using  namespace  fs ; 
1918
20- #define  READ_SIZE_SWITCH  128     // swithc to read func when read size > 128bytes
21- 
2219FileImplPtr VFSImpl::open (const  char * fpath, const  char * mode, const  bool  create)
2320{
2421    if (!_mountpoint) {
@@ -377,28 +374,7 @@ size_t VFSFileImpl::read(uint8_t* buf, size_t size)
377374        return  0 ;
378375    }
379376
380-     // ERASE BYTEBUFFER and use read when size > READ_SIZE_SWITCH always
381-     if (size > READ_SIZE_SWITCH)
382-     {
383-         // check some data in buffer exists –> clear buffer and move pointer to deleted data
384-         size_t  bytesinbuf = __fpending (_f);
385-         if  (bytesinbuf && (bytesinbuf != 128 ))  // buffer lenght is 128 bytes
386-         {
387-             fpurge (_f);
388-             lseek (fileno (_f),(-128 +bytesinbuf),SEEK_CUR);
389-         }
390- 
391-         int  res = ::read (fileno (_f), buf, size);
392-         if  (res < 0 ) {
393-             //  an error occurred
394-             return  0 ;
395-         }
396-         return  res;
397-     }
398-     else 
399-     {
400-         return  fread (buf, 1 , size, _f);
401-     }
377+     return  fread (buf, 1 , size, _f);
402378}
403379
404380void  VFSFileImpl::flush ()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments