Ignore:
Timestamp:
Nov 10, 2005, 9:41:13 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • absolute shitloads of 64 bit fixes.
File:
1 edited

Legend:

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

    r2 r17  
    1111// images.  All images should be sized so they will fit on an mdl screen
    1212// but no checking of that is done hhere.
    13 void write_mdl(image **images, short total_images, palette *pal,char *fn,
    14                 short firstpage, short images_per_page)
     13void write_mdl(image **images, int16_t total_images, palette *pal,char *fn,
     14                int16_t firstpage, int16_t images_per_page)
    1515{
    1616  FILE *fp;
    1717  char buf[18];
    18   unsigned short xy[2],x;
     18  uint16_t xy[2],x;
    1919  char name[13],page;
    2020  unsigned char *c;
    21   short i;
     21  int16_t i;
    2222  palette *np;
    2323  clear_errors();
     
    4343      memset(buf,0,6);            // each image has 6 bytes of reserved 0
    4444      fwrite(buf,6,1,fp);
    45       xy[0]=int_to_intel(i%100+20); xy[1]=int_to_intel(30);  // the x and y position on the screen
     45      xy[0]=uint16_to_intel(i%100+20); xy[1]=uint16_to_intel(30);  // the x and y position on the screen
    4646      fwrite(xy,4,1,fp);
    4747      sprintf(name,"JC%-10d",i);  // set the name of the image
     
    5151
    5252      fwrite(&page,1,1,fp);         // put all of the image on the first page
    53       xy[0]=int_to_intel(images[i]->width()*images[i]->height()+4);  // calc the size of the image
     53      xy[0]=uint16_to_intel(images[i]->width()*images[i]->height()+4);  // calc the size of the image
    5454   
    5555      fwrite(xy,2,1,fp);
    56       xy[0]=int_to_intel(images[i]->width());
     56      xy[0]=uint16_to_intel(images[i]->width());
    5757      fwrite(xy,2,1,fp);
    58       xy[0]=int_to_intel(images[i]->height());
     58      xy[0]=uint16_to_intel(images[i]->height());
    5959      fwrite(xy,2,1,fp);
    60       for (x=0;x<(unsigned short)images[i]->height();x++)   // write all the scan_lines for the
     60      for (x=0;x<(uint16_t)images[i]->height();x++)   // write all the scan_lines for the
    6161      { c=images[i]->scan_line(x);            // image
    6262        fwrite(c,images[i]->width(),1,fp);
     
    6767}
    6868
    69 short mdl_total_images(char *fn)
     69int16_t mdl_total_images(char *fn)
    7070{
    7171  char buf[800];
    72   unsigned short xy[2],t;
     72  uint16_t xy[2],t;
    7373  FILE *fp;
    7474  fp=fopen(fn,"rb");
     
    9292    {
    9393      fread(xy,2,1,fp);
    94       xy[0]=int_to_local(xy[0]);
     94      xy[0]=uint16_to_local(xy[0]);
    9595      fseek(fp,xy[0],SEEK_CUR);
    9696      t++;
     
    104104// and a palette that is read form the file
    105105// to load image numbers 4 through 9 let start =4, end=9
    106 image **read_mdl(char *fn, palette *&pal, short startn, short endn, short &total)
     106image **read_mdl(char *fn, palette *&pal, int16_t startn, int16_t endn, int16_t &total)
    107107{
    108108  FILE *fp;
    109109  image **im;
    110110  char buf[50];
    111   unsigned short xy[2],i,j;
     111  uint16_t xy[2],i,j;
    112112  clear_errors();
    113113  make_block(sizeof(FILE));
     
    147147          set_error(imFILE_CORRUPTED);
    148148        fread(xy,2,1,fp);
    149         xy[0]=int_to_local(xy[0]);
     149        xy[0]=uint16_to_local(xy[0]);
    150150        fseek(fp,xy[0],SEEK_CUR);
    151151        startn--; if (endn>0) endn--;
     
    161161          else
    162162          {
    163             j=int_to_local(j);
     163            j=uint16_to_local(j);
    164164            j-=4;
    165165            xy[0]=5; xy[1]=5;
    166166            if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED);
    167167            make_block(sizeof(image));
    168             xy[0]=int_to_local(xy[0]);
    169             xy[1]=int_to_local(xy[1]);
     168            xy[0]=uint16_to_local(xy[0]);
     169            xy[1]=uint16_to_local(xy[1]);
    170170            im[startn]=new image(xy[0],xy[1]);
    171171            total++;
Note: See TracChangeset for help on using the changeset viewer.