Ignore:
Timestamp:
Apr 28, 2011, 1:07:39 AM (10 years ago)
Author:
Sam Hocevar
Message:

imlib: get rid of fast path loading, it was no longer used. We also
delete the old cache file we put in the user's directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/specs.cpp

    r542 r544  
    6868static spec_directory spec_main_sd;
    6969
    70 static int fast_load_fd = -1;
    71 static int fast_load_mode = 0;
    72 
    7370void set_filename_prefix(char const *prefix)
    7471{
     
    280277}
    281278
    282 void fast_load_start_recording(char *filename)
    283 {
    284     fast_load_fd = ::open(filename,O_CREAT|O_RDWR,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
    285     fast_load_mode = 1;
    286 }
    287 
    288 void fast_load_stop_recording()
    289 {
    290     fast_load_mode = 0;
    291 }
    292 
    293 void fast_load_start_reloading(char *filename)
    294 {
    295     fast_load_fd = ::open(filename,O_RDONLY);
    296     fast_load_mode = 2;
    297 }
    298 
    299 void fast_load_stop_reloading()
    300 {
    301     fast_load_mode = 0;
    302 }
    303 
    304279jFILE::jFILE(FILE *file_pointer)                       // assumes fp is at begining of file
    305280{
     
    475450    if (fd == spec_main_fd)
    476451    {
    477         switch (fast_load_mode)
    478         {
    479         case 0:
    480             if (current_offset+start_offset != spec_main_offset)
    481                 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    482 
    483             len = ::read(fd,(char*)buf,count);
    484             break;
    485         case 1:
    486             if (current_offset+start_offset != spec_main_offset)
    487                 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    488 
    489             len = ::read(fd,(char*)buf,count);
    490             ::write(fast_load_fd,(char*)&len,sizeof(len));
    491             ::write(fast_load_fd,(char*)buf,len);
    492             break;
    493         case 2:
    494             ::read(fast_load_fd,(char*)&len,sizeof(len));
    495             len = ::read(fast_load_fd,(char*)buf,len);
    496             break;
    497         }
    498 
     452        if (current_offset+start_offset != spec_main_offset)
     453            spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
     454
     455        len = ::read(fd,(char*)buf,count);
    499456        spec_main_offset += len;
    500457    }
    501458    else
    502459    {
    503         switch (fast_load_mode)
    504         {
    505         case 0:
    506           len = ::read(fd,(char*)buf,count);
    507           break;
    508         case 1:
    509           len = ::read(fd,(char*)buf,count);
    510             ::write(fast_load_fd,(char*)&len,sizeof(len));
    511             ::write(fast_load_fd,(char*)buf,len);
    512           break;
    513         case 2:
    514             ::read(fast_load_fd,(char*)&len,sizeof(len));
    515             len = ::read(fast_load_fd,(char*)buf,len);
    516             if (count != len)
    517                 printf("short read! %ld:%ld\n",current_offset,len);
    518           break;
    519       }
     460      len = ::read(fd,(char*)buf,count);
    520461    }
    521462    current_offset += len;
     
    533474{
    534475  long ret;
    535 
    536   if (fast_load_mode == 2)
    537   {
    538     switch (whence)
    539     {
    540     case SEEK_SET :
    541       current_offset = start_offset+offset;
    542       break;
    543     case SEEK_END :
    544       current_offset = start_offset+file_length-offset;
    545       break;
    546     case SEEK_CUR :
    547       current_offset += offset;
    548       break;
    549     default:
    550       ret = -1;
    551       break;
    552     }
    553     return current_offset;
    554   }
    555476
    556477  switch (whence)
Note: See TracChangeset for help on using the changeset viewer.