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/gifread.cpp

    r4 r17  
    1515
    1616struct {
    17         unsigned short int      Width;
    18         unsigned short int      Height;
    19         unsigned char   ColorMap[3][256];
    20         unsigned short int      BitPixel;
    21         unsigned short int      ColorResolution;
    22         unsigned short int      Background;
    23         unsigned short int      AspectRatio;
     17        uint16_t        Width;
     18        uint16_t        Height;
     19        uint8_t         ColorMap[3][256];
     20        uint16_t        BitPixel;
     21        uint16_t        ColorResolution;
     22        uint16_t        Background;
     23        uint16_t        AspectRatio;
    2424} GifScreen;
    2525
    2626struct {
    27   unsigned short int w,h;
    28   unsigned char color_info,background,reserved;
     27  uint16_t w,h;
     28  uint8_t color_info,background,reserved;
    2929} gif_screen;
    3030
    3131struct {
    32   unsigned short int xoff,yoff,w,h;
    33   unsigned char color_info;
     32  uint16_t xoff,yoff,w,h;
     33  uint8_t color_info;
    3434} gif_image;
    3535
     
    3737{
    3838  char buf[100],er;
    39   unsigned char sep;
     39  uint8_t sep;
    4040  unsigned int ncolors;
    4141  FILE *fp;
     
    5353      if (!strcmp("GIF87a",buf))
    5454      {
    55         fread((char *)&gif_screen.w,2,1,fp);
    56         gif_screen.w=int_to_local(gif_screen.w);
    57         fread((char *)&gif_screen.h,2,1,fp);
    58         gif_screen.h=int_to_local(gif_screen.h);
    59         fread((char *)&gif_screen.color_info,1,1,fp);
    60         fread((char *)&gif_screen.background,1,1,fp);
    61         if (fread((char *)&gif_screen.reserved,1,1,fp)==1)
     55        fread((uint8_t *)&gif_screen.w,2,1,fp);
     56        gif_screen.w=uint16_to_local(gif_screen.w);
     57        fread((uint8_t *)&gif_screen.h,2,1,fp);
     58        gif_screen.h=uint16_to_local(gif_screen.h);
     59        fread((uint8_t *)&gif_screen.color_info,1,1,fp);
     60        fread((uint8_t *)&gif_screen.background,1,1,fp);
     61        if (fread((uint8_t *)&gif_screen.reserved,1,1,fp)==1)
    6262        {
    6363          if (gif_screen.color_info&128)
     
    6969            if (pal)
    7070            { 
    71               if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
     71              if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
    7272            } else er=imMEMORY_ERROR;
    7373          }
     
    7575          { do
    7676            {
    77               if (fread((char *)&sep,1,1,fp)!=1)
     77              if (fread((uint8_t *)&sep,1,1,fp)!=1)
    7878                er=imREAD_ERROR;
    7979            } while (!er && sep!=',');
    80             fread((char *)&gif_image.xoff,2,1,fp);
    81             gif_image.xoff=int_to_local(gif_image.xoff);
    82             fread((char *)&gif_image.yoff,2,1,fp);
    83             gif_image.yoff=int_to_local(gif_image.yoff);
    84             fread((char *)&gif_image.w,2,1,fp);
    85             gif_image.w=int_to_local(gif_image.w);
    86             fread((char *)&gif_image.h,2,1,fp);
    87             gif_image.h=int_to_local(gif_image.h);
    88             if (!er && (fread((char *)&gif_image.color_info,1,1,fp)==1))
     80            fread((uint8_t *)&gif_image.xoff,2,1,fp);
     81            gif_image.xoff=uint16_to_local(gif_image.xoff);
     82            fread((uint8_t *)&gif_image.yoff,2,1,fp);
     83            gif_image.yoff=uint16_to_local(gif_image.yoff);
     84            fread((uint8_t *)&gif_image.w,2,1,fp);
     85            gif_image.w=uint16_to_local(gif_image.w);
     86            fread((uint8_t *)&gif_image.h,2,1,fp);
     87            gif_image.h=uint16_to_local(gif_image.h);
     88            if (!er && (fread((uint8_t *)&gif_image.color_info,1,1,fp)==1))
    8989            {
    9090              if (gif_image.color_info&128)
     
    9595                pal = new palette(ncolors);
    9696                if (pal)
    97                 { if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
     97                { if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
    9898                } else er=imMEMORY_ERROR;
    9999              }
Note: See TracChangeset for help on using the changeset viewer.