Ignore:
Timestamp:
Nov 10, 2005, 9:41:13 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • absolute shitloads of 64 bit fixes.
Location:
abuse/trunk/src/imlib
Files:
27 edited

Legend:

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

    r2 r17  
    172172{
    173173  fp->seek(e->offset,0);
    174   fp->read_short();
     174  fp->read_uint16();
    175175  int colors=32;
    176176  color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded");
     
    187187{
    188188  int colors=32;
    189   fp->write_short(colors);
     189  fp->write_uint16(colors);
    190190  return fp->write(color_table,colors*colors*colors)==colors*colors*colors;
    191191}
     
    220220  screen->add_dirty(x,y,x+xl-1,y+yl-1);
    221221
    222   uchar *pg1=screen->scan_line(y),*source,*dest;
    223   uchar *pg2=im->scan_line(y1);
     222  uint8_t *pg1=screen->scan_line(y),*source,*dest;
     223  uint8_t *pg2=im->scan_line(y1);
    224224  int i;
    225225  for (int j=0;j<yl;j++)       
  • 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              }
  • abuse/trunk/src/imlib/glread.cpp

    r2 r17  
    99{
    1010  image *im,*sub;
    11   unsigned short length,y;
    12   unsigned char size,first,width,height,gsize,last;
     11  uint16_t length,y;
     12  uint8_t size,first,width,height,gsize,last;
    1313  FILE *fp;
    1414  fp=fopen(fn,"rb");
    1515  if (!fp) return NULL;
    16   fread(&length,1,2,fp);  length=int_to_local(length);
     16  fread(&length,1,2,fp);  length=uint16_to_local(length);
    1717  fread(&size,1,1,fp);
    1818  fread(&first,1,1,fp);
     
    4545  image *im;
    4646  char x[4],bpp;
    47   unsigned char *sl=NULL,esc,c,n,marker,vmode;
    48   unsigned short w,h,len,bufsize,blocks,sn,esize,edesc;
     47  uint8_t *sl=NULL,esc,c,n,marker,vmode;
     48  uint16_t w,h,len,bufsize,blocks,sn,esize,edesc;
    4949  int xx,yy;
    5050  FILE *fp;
     
    5555  fread(&w,1,2,fp);
    5656  fread(&h,1,2,fp);
    57   w=int_to_local(w);  h=int_to_local(h);
     57  w=uint16_to_local(w);  h=uint16_to_local(h);
    5858  fread(x,1,4,fp);
    5959  fread(&bpp,1,1,fp);
     
    6666  fread(&vmode,1,1,fp);
    6767  fread(&edesc,1,2,fp);
    68   edesc=int_to_local(edesc);
     68  edesc=uint16_to_local(edesc);
    6969  fread(&esize,1,2,fp);
    70   esize=int_to_local(esize);
     70  esize=uint16_to_local(esize);
    7171  if (esize==768 && !pal)
    7272  { pal=new palette(1<<bpp);
     
    7777    fseek(fp,esize,SEEK_CUR);
    7878  fread(&blocks,1,2,fp);
    79   blocks=int_to_local(blocks);
     79  blocks=uint16_to_local(blocks);
    8080
    8181  yy=h; xx=w;
     
    8484  {
    8585    fread(&bufsize,1,2,fp);
    86     bufsize=int_to_local(bufsize);
     86    bufsize=uint16_to_local(bufsize);
    8787    fread(&len,1,2,fp);
    88     len=int_to_local(len);
     88    len=uint16_to_local(len);
    8989    fread(&esc,1,1,fp);
    9090    while (yy>=0 && len)
     
    113113        {
    114114          fread(&sn,1,2,fp);
    115           sn=int_to_local(sn);
     115          sn=uint16_to_local(sn);
    116116          fread(&c,1,1,fp);
    117117          while (sn-- && yy>=0 && len)
  • abuse/trunk/src/imlib/image.cpp

    r2 r17  
    1212#include <stdlib.h>
    1313
    14 extern unsigned char current_background;
     14extern uint8_t current_background;
    1515char *imerr_messages[]={"No error",
    1616                        "Error occured while reading",
     
    2323                       
    2424                         
    25 short imerror=0;
    26 short swpfile_num=0;
    27 
    28 short current_error()
     25int16_t imerror=0;
     26int16_t swpfile_num=0;
     27
     28int16_t current_error()
    2929{ return imerror; }
    3030
     
    4848}
    4949
    50 void set_error(short x)
     50void set_error(int16_t x)
    5151{ imerror=x; }
    5252
    53 short last_error()
    54 {
    55   short ec;
     53int16_t last_error()
     54{
     55  int16_t ec;
    5656  ec=imerror;
    5757  imerror=0;
     
    6262
    6363
    64 image_descriptor::image_descriptor(short length, short height,
     64image_descriptor::image_descriptor(int16_t length, int16_t height,
    6565                                   int keep_dirties, int static_memory)
    6666
     
    7272}
    7373
    74 void image::change_size(short new_width, short new_height, unsigned char *page)
     74void image::change_size(int16_t new_width, int16_t new_height, uint8_t *page)
    7575{
    7676  delete_page();
     
    9797}
    9898
    99 unsigned char image::pixel(short x, short y)
     99uint8_t image::pixel(int16_t x, int16_t y)
    100100{
    101101  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
     
    104104}
    105105
    106 void image::putpixel(short x, short y, char color)
     106void image::putpixel(int16_t x, int16_t y, char color)
    107107{
    108108  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
     
    116116
    117117
    118 image::image(short width, short height, unsigned char *page_buffer, short create_descriptor)
     118image::image(int16_t width, int16_t height, uint8_t *page_buffer, int16_t create_descriptor)
    119119{
    120120  w=width;
     
    132132image::image(spec_entry *e, bFILE *fp)
    133133{
    134   short i;
     134  int16_t i;
    135135  fp->seek(e->offset,0);
    136   w=fp->read_short();
    137   h=fp->read_short();
     136  w=fp->read_uint16();
     137  h=fp->read_uint16();
    138138  special=NULL;
    139139  make_page(w,h,NULL);
     
    145145image::image(bFILE *fp)
    146146{
    147   short i;
    148   w=fp->read_short();
    149   h=fp->read_short();
     147  int16_t i;
     148  w=fp->read_uint16();
     149  h=fp->read_uint16();
    150150  special=NULL;
    151151  make_page(w,h,NULL);
     
    172172void image_init()
    173173{
    174   unsigned char bt[2];
    175   unsigned short wrd,*up;
     174  uint8_t bt[2];
     175  uint16_t wrd,*up;
    176176  bt[0]=1;
    177177  bt[1]=0;
    178   up=(unsigned short *)bt;
    179   wrd=int_to_intel(*up);
     178  up=(uint16_t *)bt;
     179  wrd=uint16_to_intel(*up);
    180180  if (wrd!=0x01)
    181181  { printf("Compiled under wrong ENDING-nes, edit system.h and try again\n");
     
    187187
    188188
    189 long image::total_pixels(unsigned char background)
    190 {
    191   short i,j;
    192   long co;
    193   unsigned char *c;
     189int32_t image::total_pixels(uint8_t background)
     190{
     191  int16_t i,j;
     192  int32_t co;
     193  uint8_t *c;
    194194  for (co=0,i=height()-1;i>=0;i--)
    195195  { c=scan_line(i);
     
    200200}
    201201
    202 void image::clear(short color)
    203 {
    204   short i;
     202void image::clear(int16_t color)
     203{
     204  int16_t i;
    205205  if (color==-1) color=current_background;
    206206  if (special)
     
    220220{
    221221  image *im;
    222   unsigned char *c,*dat;
     222  uint8_t *c,*dat;
    223223  int i;
    224   dat=(unsigned char *)jmalloc(width(),"image copy");
     224  dat=(uint8_t *)jmalloc(width(),"image copy");
    225225  im=new image(width(),height());
    226226  for (i=height()-1;i>=0;i--)
     
    236236
    237237
    238 void image::line(short x1, short y1,short x2, short y2, unsigned char color)
    239 {
    240   short i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
     238void image::line(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
     239{
     240  int16_t i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
    241241  unsigned dcy,dcx;
    242242  // check to make sure that both endpoint are on the screen
    243243
    244   short cx1,cy1,cx2,cy2;
     244  int16_t cx1,cy1,cx2,cy2;
    245245
    246246  // check to see if the line is completly clipped off
     
    378378
    379379
    380 void image::put_image(image *screen, short x, short y, char transparent)
    381 {
    382   short i,j,xl,yl;
    383   unsigned char *pg1,*pg2,*source,*dest;
     380void image::put_image(image *screen, int16_t x, int16_t y, char transparent)
     381{
     382  int16_t i,j,xl,yl;
     383  uint8_t *pg1,*pg2,*source,*dest;
    384384  if (screen->special)  // the screen is clipped then we onl want to put
    385385                    // part of the image
     
    417417}
    418418
    419 void image::fill_image(image *screen, short x1, short y1, short x2, short y2, short allign)
    420 {
    421   short i,j,w,xx,start,xl,starty;
    422   unsigned char *pg1,*pg2;
     419void image::fill_image(image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t allign)
     420{
     421  int16_t i,j,w,xx,start,xl,starty;
     422  uint8_t *pg1,*pg2;
    423423  CHECK(x1<=x2 && y1<=y2);  // we should have gotten this
    424424
     
    467467
    468468
    469 void image::put_part(image *screen, short x, short y,
    470                 short x1, short y1, short x2, short y2, char transparent)
    471 {
    472   short xl,yl,j,i;
    473   short cx1,cy1,cx2,cy2;
    474   unsigned char *pg1,*pg2,*source,*dest;
     469void image::put_part(image *screen, int16_t x, int16_t y,
     470                int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
     471{
     472  int16_t xl,yl,j,i;
     473  int16_t cx1,cy1,cx2,cy2;
     474  uint8_t *pg1,*pg2,*source,*dest;
    475475  CHECK(x1<=x2 && y1<=y2);
    476476
     
    533533}
    534534
    535 void image::put_part_xrev(image *screen, short x, short y,
    536                 short x1, short y1, short x2, short y2, char transparent)
    537 {
    538   short xl,yl,j,i;
    539   short cx1,cy1,cx2,cy2;
    540   unsigned char *pg1,*pg2,*source,*dest;
     535void image::put_part_xrev(image *screen, int16_t x, int16_t y,
     536                int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
     537{
     538  int16_t xl,yl,j,i;
     539  int16_t cx1,cy1,cx2,cy2;
     540  uint8_t *pg1,*pg2,*source,*dest;
    541541  CHECK(x1<=x2 && y1<=y2);
    542542
     
    596596
    597597
    598 void image::put_part_masked(image *screen, image *mask, short x, short y,
    599                 short maskx, short masky,
    600                 short x1, short y1, short x2, short y2)
    601 {
    602   short xl,yl,j,i,ml,mh;
    603   short cx1,cy1,cx2,cy2;
    604   unsigned char *pg1,*pg2,*pg3;
     598void image::put_part_masked(image *screen, image *mask, int16_t x, int16_t y,
     599                int16_t maskx, int16_t masky,
     600                int16_t x1, int16_t y1, int16_t x2, int16_t y2)
     601{
     602  int16_t xl,yl,j,i,ml,mh;
     603  int16_t cx1,cy1,cx2,cy2;
     604  uint8_t *pg1,*pg2,*pg3;
    605605  CHECK(x1<=x2 && y1<=y2);
    606606
     
    658658
    659659
    660 unsigned char image::brightest_color(palette *pal)
    661 { unsigned char *p,r,g,b,bri;
    662   short i,j;
    663   long brv;
     660uint8_t image::brightest_color(palette *pal)
     661{ uint8_t *p,r,g,b,bri;
     662  int16_t i,j;
     663  int32_t brv;
    664664  brv=0; bri=0;
    665665  for (j=0;j<h;j++)
     
    668668    for (i=0;i<w;i++)
    669669    { pal->get(p[i],r,g,b);
    670       if ((long)r*(long)g*(long)b>brv)
    671       { brv=(long)r*(long)g*(long)b;
     670      if ((int32_t)r*(int32_t)g*(int32_t)b>brv)
     671      { brv=(int32_t)r*(int32_t)g*(int32_t)b;
    672672        bri=p[i];
    673673      }
     
    677677}
    678678
    679 unsigned char image::darkest_color(palette *pal, short noblack)
    680 { unsigned char *p,r,g,b,bri;
    681   short i,j;
    682   long brv,x;
    683   brv=(long)258*(long)258*(long)258; bri=0;
     679uint8_t image::darkest_color(palette *pal, int16_t noblack)
     680{ uint8_t *p,r,g,b,bri;
     681  int16_t i,j;
     682  int32_t brv,x;
     683  brv=(int32_t)258*(int32_t)258*(int32_t)258; bri=0;
    684684  for (j=0;j<h;j++)
    685685  {
     
    687687    for (i=0;i<w;i++)
    688688    { pal->get(p[i],r,g,b);
    689       x=(long)r*(long)g*(long)b;
     689      x=(int32_t)r*(int32_t)g*(int32_t)b;
    690690      if (x<brv && (x || !noblack))
    691691      { brv=x;
     
    697697}
    698698
    699 void image::rectangle(short x1, short y1,short x2, short y2, unsigned char color)
     699void image::rectangle(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
    700700{
    701701  line(x1,y1,x2,y1,color);
     
    705705}
    706706
    707 void image::set_clip(short x1, short y1, short x2, short y2)
     707void image::set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
    708708{
    709709  // If the image does not already have an Image descriptor, allocate one.
     
    718718}
    719719
    720 void image::get_clip (short &x1, short &y1, short &x2, short &y2)
     720void image::get_clip (int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
    721721{
    722722  if (special)
     
    726726}
    727727
    728 void image::in_clip  (short x1, short y1, short x2, short y2)
     728void image::in_clip  (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
    729729{
    730730  if (special)
     
    747747{
    748748  dirty_rect *p,*q;
    749   short x1,y1,x2,y2,nn;
     749  int16_t x1,y1,x2,y2,nn;
    750750  x1=6000; y1=6000;
    751751  x2=0; y2=0;
     
    769769void image_descriptor::delete_dirty(int x1, int y1, int x2, int y2)
    770770{
    771   short i,ax1,ay1,ax2,ay2;
     771  int16_t i,ax1,ay1,ax2,ay2;
    772772  dirty_rect *p,*next;
    773773  if (keep_dirt)
     
    869869void image_descriptor::add_dirty(int x1, int y1, int x2, int y2)
    870870{
    871   short i;
     871  int16_t i;
    872872  dirty_rect *p;
    873873  if (keep_dirt)
     
    941941}
    942942
    943 void image::bar      (short x1, short y1, short x2, short y2, unsigned char color)
    944 {
    945   short y;
     943void image::bar      (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
     944{
     945  int16_t y;
    946946  if (x1>x2 || y1>y2) return ;
    947947  if (special)
     
    964964}
    965965
    966 void image::xor_bar  (short x1, short y1, short x2, short y2, unsigned char color)
    967 {
    968   short y,x;
     966void image::xor_bar  (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
     967{
     968  int16_t y,x;
    969969  if (x1>x2 || y1>y2) return ;
    970970  if (special)
     
    983983    return ;
    984984
    985   unsigned char *sl=scan_line(y1)+x1;
     985  uint8_t *sl=scan_line(y1)+x1;
    986986  for (y=y1;y<=y2;y++)
    987987  {
    988     unsigned char *s=sl;
     988    uint8_t *s=sl;
    989989    for (x=x1;x<=x2;x++,s++)
    990990      *s=(*s)^color;
     
    996996
    997997
    998 void image::unpack_scanline(short line, char bitsperpixel)
    999 {
    1000   short x;
    1001   unsigned char *sl,*ex,mask,bt,sh;
    1002   ex=(unsigned char *)jmalloc(width(),"image::unpacked scanline");
     998void image::unpack_scanline(int16_t line, char bitsperpixel)
     999{
     1000  int16_t x;
     1001  uint8_t *sl,*ex,mask,bt,sh;
     1002  ex=(uint8_t *)jmalloc(width(),"image::unpacked scanline");
    10031003  sl=scan_line(line);
    10041004  memcpy(ex,sl,width());
     
    10181018void image::dither(palette *pal)
    10191019{
    1020   short x,y,i,j;
    1021   unsigned char dt_matrix[]={0,  136,24, 170,
     1020  int16_t x,y,i,j;
     1021  uint8_t dt_matrix[]={0,  136,24, 170,
    10221022                   68, 204,102,238,
    10231023                   51, 187, 17,153,
    10241024                   119,255, 85,221};
    10251025
    1026   unsigned char *sl;
     1026  uint8_t *sl;
    10271027  for (y=height()-1;y>=0;y--)
    10281028  {
     
    10491049}
    10501050
    1051 void image::resize(short new_width, short new_height)
     1051void image::resize(int16_t new_width, int16_t new_height)
    10521052{
    10531053  int old_width=width(),old_height=height();
    1054   unsigned char *im=(unsigned char *)jmalloc(width()*height(),"image::resized");
     1054  uint8_t *im=(uint8_t *)jmalloc(width()*height(),"image::resized");
    10551055  memcpy(im,scan_line(0),width()*height());
    10561056
     
    10601060  h=new_height;
    10611061
    1062   unsigned char *sl1,*sl2;
    1063   short y,y2,x2;
     1062  uint8_t *sl1,*sl2;
     1063  int16_t y,y2,x2;
    10641064  double yc,xc,yd,xd;
    10651065
     
    10801080}
    10811081
    1082 void image::scroll(short x1, short y1, short x2, short y2, short xd, short yd)
    1083 {
    1084   short cx1,cy1,cx2,cy2;
     1082void image::scroll(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd)
     1083{
     1084  int16_t cx1,cy1,cx2,cy2;
    10851085  CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<width() && y2<height());
    10861086  if (special)
     
    10891089    x1=max(x1,cx1); y1=max(cy1,y1); x2=min(x2,cx2); y2=min(y2,cy2);
    10901090  }
    1091   short xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
    1092   unsigned char *src,*dst;
     1091  int16_t xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
     1092  uint8_t *src,*dst;
    10931093  if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; }
    10941094  if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; }
     
    11071107
    11081108
    1109 image *image::create_smooth(short smoothness)
    1110 {
    1111   short i,j,k,l,t,d;
     1109image *image::create_smooth(int16_t smoothness)
     1110{
     1111  int16_t i,j,k,l,t,d;
    11121112  image *im;
    11131113  CHECK(smoothness>=0);
     
    11291129}
    11301130
    1131 void image::wiget_bar(short x1, short y1, short x2, short y2,
    1132         unsigned char light, unsigned char med, unsigned char dark)
     1131void image::wiget_bar(int16_t x1, int16_t y1, int16_t x2, int16_t y2,
     1132        uint8_t light, uint8_t med, uint8_t dark)
    11331133{
    11341134  line(x1,y1,x2,y1,light);
     
    11421142{
    11431143public :
    1144   short x,y;
     1144  int16_t x,y;
    11451145  fill_rec *last;
    1146   fill_rec(short X, short Y, fill_rec *Last)
     1146  fill_rec(int16_t X, int16_t Y, fill_rec *Last)
    11471147  { x=X; y=Y; last=Last; }
    11481148} ;
    11491149
    1150 void image::flood_fill(short x, short y, unsigned char color)
    1151 {
    1152   unsigned char *sl,*above,*below;
     1150void image::flood_fill(int16_t x, int16_t y, uint8_t color)
     1151{
     1152  uint8_t *sl,*above,*below;
    11531153  fill_rec *recs=NULL,*r;
    1154   unsigned char fcolor;
     1154  uint8_t fcolor;
    11551155  sl=scan_line(y);
    11561156  fcolor=sl[x];
     
    12311231#define LED_L 5
    12321232#define LED_H 5
    1233 void image::burn_led(short x, short y, long num, short color, short scale)
     1233void image::burn_led(int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale)
    12341234{
    12351235  char st[100];
    1236   short ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
    1237   short ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
    1238 
    1239   short dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,
     1236  int16_t ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
     1237  int16_t ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
     1238
     1239  int16_t dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,
    12401240             2+64+1+8+16,64+32+1+8+16,2+4+8,1+2+4+8+16+32+64,64+2+4+1+8,1};
    1241   short xx,yy,zz;
    1242   sprintf(st,"%8ld",num);
     1241  int16_t xx,yy,zz;
     1242  sprintf(st,"%8ld",(long int)num);
    12431243  for (xx=0;xx<8;xx++)
    12441244  {
     
    12581258}
    12591259
    1260 unsigned char dither_matrix[]={0,  136,24, 170,
     1260uint8_t dither_matrix[]={0,  136,24, 170,
    12611261                     68, 204,102,238,
    12621262                     51, 187, 17,153,
    12631263                     119,255, 85,221};
    12641264
    1265 image *image::copy_part_dithered (short x1, short y1, short x2, short y2)
    1266 {
    1267   short x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
     1265image *image::copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
     1266{
     1267  int16_t x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
    12681268  image *ret;
    1269   unsigned char *sl1,*sl2;
     1269  uint8_t *sl1,*sl2;
    12701270  get_clip(cx1,cy1,cx2,cy2);
    12711271  if (y1<cy1) y1=cy1;
     
    13041304void image::flip_x()
    13051305{
    1306   unsigned char *rev=(unsigned char *)jmalloc(width(),"image tmp::flipped_x"),*sl;
     1306  uint8_t *rev=(uint8_t *)jmalloc(width(),"image tmp::flipped_x"),*sl;
    13071307  CONDITION(rev,"memory allocation");
    13081308  int y,x,i;
     
    13181318void image::flip_y()
    13191319{
    1320   unsigned char *rev=(unsigned char *)jmalloc(width(),"image::flipped_y"),*sl;
     1320  uint8_t *rev=(uint8_t *)jmalloc(width(),"image::flipped_y"),*sl;
    13211321  CONDITION(rev,"memory allocation");
    13221322  int y;
     
    13291329}
    13301330
    1331 void image::make_color(unsigned char color)
    1332 {
    1333   unsigned char *sl;
     1331void image::make_color(uint8_t color)
     1332{
     1333  uint8_t *sl;
    13341334  int y,x;
    13351335  for (y=0;y<height();y++)
  • abuse/trunk/src/imlib/include/image.hpp

    r2 r17  
    1919#define imMAX_ERROR            7
    2020
    21 short current_error();
     21int16_t current_error();
    2222void clear_errors();
    23 void set_error(short x);
    24 short last_error();
     23void set_error(int16_t x);
     24int16_t last_error();
    2525void make_block(size_t size);
    2626void image_init();
     
    3030typedef struct image_color_t
    3131{
    32         unsigned short r;
    33         unsigned short g;
    34         unsigned short b;
     32        uint16_t r;
     33        uint16_t g;
     34        uint16_t b;
    3535} image_color;
    3636
     
    4141{
    4242public :
    43   short dx1,dy1,dx2,dy2;
    44   dirty_rect(short x1, short y1, short x2, short y2)
     43  int16_t dx1,dy1,dx2,dy2;
     44  dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
    4545  { dx1=x1; dy1=y1; dx2=x2; dy2=y2;
    4646    if (x2<x1 || y2<y1)
    4747      printf("add inccorect dirty\n");
    4848  }
    49   virtual short compare(void *n1, short field)
     49  virtual int16_t compare(void *n1, int16_t field)
    5050  { return ((dirty_rect *)n1)->dy1>dy1; }
    5151} ;
     
    5353class image_descriptor
    5454{
    55   short l,h;
    56   short clipx1, clipy1, clipx2, clipy2;
     55  int16_t l,h;
     56  int16_t clipx1, clipy1, clipx2, clipy2;
    5757public : 
    58   unsigned char keep_dirt,
    59                 static_mem;      // if this flag is set then don't free memory on exit
     58  uint8_t keep_dirt,
     59          static_mem;      // if this flag is set then don't free memory on exit
    6060 
    6161  linked_list dirties;
    6262  void *extended_descriptor;              // type depends on current system
    6363
    64   image_descriptor(short length, short height,
     64  image_descriptor(int16_t length, int16_t height,
    6565                  int keep_dirties=1, int static_memory=0);
    66   short bound_x1(short x1)  { return x1<clipx1 ? clipx1 : x1; }
    67   short bound_y1(short y1)  { return y1<clipy1 ? clipy1 : y1; }
    68   short bound_x2(short x2)  { return x2>clipx2 ? clipx2 : x2; }
    69   short bound_y2(short y2)  { return y2>clipy2 ? clipy2 : y2; }
    70   short x1_clip() { return clipx1; }
    71   short y1_clip() { return clipy1; }
    72   short x2_clip() { return clipx2; }
    73   short y2_clip() { return clipy2; }
    74   void dirty_area(short x1, short y1, short x2, short y2) { ;}
    75   void clean_area(short x1, short y1, short x2, short y2) { ; }
     66  int16_t bound_x1(int16_t x1)  { return x1<clipx1 ? clipx1 : x1; }
     67  int16_t bound_y1(int16_t y1)  { return y1<clipy1 ? clipy1 : y1; }
     68  int16_t bound_x2(int16_t x2)  { return x2>clipx2 ? clipx2 : x2; }
     69  int16_t bound_y2(int16_t y2)  { return y2>clipy2 ? clipy2 : y2; }
     70  int16_t x1_clip() { return clipx1; }
     71  int16_t y1_clip() { return clipy1; }
     72  int16_t x2_clip() { return clipx2; }
     73  int16_t y2_clip() { return clipy2; }
     74  void dirty_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ;}
     75  void clean_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ; }
    7676  void clear_dirties();
    77   short get_dirty_area(short &x1, short &y1, short &x2, short &y2) { return 0; }
    78   void get_clip(short &x1, short &y1, short &x2, short &y2)
     77  int16_t get_dirty_area(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) { return 0; }
     78  void get_clip(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
    7979    { x1=clipx1; y1=clipy1; x2=clipx2; y2=clipy2; }
    80   void set_clip(short x1, short y1, short x2, short y2)
     80  void set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
    8181    { if (x2<x1) x2=x1;
    8282      if (y2<y1) y2=y1;
     
    8989  void add_dirty(int x1, int y1, int x2, int y2);
    9090  void delete_dirty(int x1, int y1, int x2, int y2);
    91   void resize(short length, short height)
     91  void resize(int16_t length, int16_t height)
    9292   { l=length; h=height; clipx1=0; clipy1=0; clipx2=l-1; clipy2=h-1; }
    9393} ;
     
    9595class image : public linked_node
    9696{
    97   unsigned char *data;
    98   short w,h;
    99   void make_page(short width, short height, unsigned char *page_buffer);
     97  uint8_t *data;
     98  int16_t w,h;
     99  void make_page(int16_t width, int16_t height, uint8_t *page_buffer);
    100100  void delete_page();
    101101public :
     
    103103  image(spec_entry *e, bFILE *fp);
    104104  image(bFILE *fp);
    105   image(short width, short height,                 // required
    106         unsigned char *page_buffer=NULL,
    107         short create_descriptor=0);        // 0=no, 1=yes, 2=yes & keep dirties
    108   unsigned char  pixel              (short x, short y);
    109   void           putpixel           (short x, short y, char color);
    110   unsigned char *scan_line          (short y) { return data+y*w; }
    111   unsigned char *next_line          (short lasty, unsigned char *last_scan)
     105  image(int16_t width, int16_t height,                 // required
     106        uint8_t *page_buffer=NULL,
     107        int16_t create_descriptor=0);        // 0=no, 1=yes, 2=yes & keep dirties
     108  uint8_t  pixel              (int16_t x, int16_t y);
     109  void     putpixel           (int16_t x, int16_t y, char color);
     110  uint8_t *scan_line          (int16_t y) { return data+y*w; }
     111  uint8_t *next_line          (int16_t lasty, uint8_t *last_scan)
    112112                                    { return last_scan+w; }         
    113   long           total_pixels       (unsigned char background=0);
    114   image         *copy               ();    // makes a copy of an image
    115   void           clear              (short color=-1);  // -1 is background color
    116   void           to_24bit           (palette &pal);
    117   short          width              () { return (short)w; }
    118   short          height             () { return (short)h; }
    119   void           scroll             (short x1, short y1, short x2, short y2, short xd, short yd);
    120   void           fill_image         (image *screen, short x1, short y1, short x2, short y2,
    121                                      short allign=1);
    122   void           put_image          (image *screen, short x, short y, char transparent=0);
    123   void           put_part           (image *screen, short x, short y, short x1, short y1,
    124                                      short x2, short y2, char transparent=0);
    125   void           put_part_xrev      (image *screen, short x, short y, short x1, short y1,
    126                                      short x2, short y2, char transparent=0);
    127   void           put_part_masked    (image *screen, image *mask, short x, short y,
    128                                      short maskx, short masky, short x1, short y1, short x2, short y2);
    129   image         *copy_part_dithered (short x1, short y1, short x2, short y2);
    130   void           bar                (short x1, short y1, short x2, short y2, unsigned char color);
    131   void           xor_bar            (short x1, short y1, short x2, short y2, unsigned char color);
    132   void           wiget_bar          (short x1, short y1, short x2, short y2,
    133                                      unsigned char light, unsigned char med, unsigned char dark);
    134   void           line               (short x1, short y1, short x2, short y2, unsigned char color);
    135   void           rectangle          (short x1, short y1, short x2, short y2, unsigned char color);
    136   void           burn_led           (short x, short y, long num, short color, short scale=1);
    137   void           set_clip           (short x1, short y1, short x2, short y2);
    138   void           get_clip           (short &x1,short &y1,short &x2,short &y2);
    139   void           in_clip            (short x1, short y1, short x2, short y2);
     113  int32_t  total_pixels       (uint8_t background=0);
     114  image    *copy               ();    // makes a copy of an image
     115  void     clear              (int16_t color=-1);  // -1 is background color
     116  void     to_24bit           (palette &pal);
     117  int16_t  width              () { return (int16_t)w; }
     118  int16_t  height             () { return (int16_t)h; }
     119  void     scroll             (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd);
     120  void     fill_image         (image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
     121                              int16_t allign=1);
     122  void     put_image          (image *screen, int16_t x, int16_t y, char transparent=0);
     123  void     put_part           (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1,
     124                                     int16_t x2, int16_t y2, char transparent=0);
     125  void     put_part_xrev      (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1,
     126                                     int16_t x2, int16_t y2, char transparent=0);
     127  void     put_part_masked    (image *screen, image *mask, int16_t x, int16_t y,
     128                                     int16_t maskx, int16_t masky, int16_t x1, int16_t y1, int16_t x2, int16_t y2);
     129  image    *copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
     130  void     bar                (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
     131  void     xor_bar            (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
     132  void     wiget_bar          (int16_t x1, int16_t y1, int16_t x2, int16_t y2,
     133                                     uint8_t light, uint8_t med, uint8_t dark);
     134  void     line               (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
     135  void     rectangle          (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
     136  void     burn_led           (int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale=1);
     137  void     set_clip           (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
     138  void     get_clip           (int16_t &x1,int16_t &y1,int16_t &x2,int16_t &y2);
     139  void     in_clip            (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
    140140
    141   void           dirt_off           () { if (special && special->keep_dirt) special->keep_dirt=0; }
    142   void           dirt_on            () { if (special) special->keep_dirt=1; }
     141  void     dirt_off           () { if (special && special->keep_dirt) special->keep_dirt=0; }
     142  void     dirt_on            () { if (special) special->keep_dirt=1; }
    143143
    144   void           add_dirty          (int x1, int y1, int x2, int y2)
     144  void     add_dirty          (int x1, int y1, int x2, int y2)
    145145                                    { if (special) special->add_dirty(x1,y1,x2,y2); }
    146   void           delete_dirty       (int x1, int y1, int x2, int y2)
     146  void     delete_dirty       (int x1, int y1, int x2, int y2)
    147147                                    { if (special) special->delete_dirty(x1,y1,x2,y2); }
    148   void           clear_dirties      () { if (special) special->clear_dirties(); }
    149   void           dither             (palette *pal); // use a b&w palette!
    150   void           resize             (short new_width, short new_height);
    151   void           change_size        (short new_width, short new_height, unsigned char *page=NULL);
    152   void           flood_fill         (short x, short y, unsigned char color);
    153   image         *create_smooth      (short smoothness=1); // 0 no smoothness
    154   void           unpack_scanline    (short line, char bitsperpixel=1);
    155   unsigned char  brightest_color    (palette *pal);
    156   void           flip_x             ();
    157   void           flip_y             ();
    158   void           make_color         (unsigned char color);
    159   unsigned char  darkest_color      (palette *pal, short noblack=0);
     148  void     clear_dirties      () { if (special) special->clear_dirties(); }
     149  void     dither             (palette *pal); // use a b&w palette!
     150  void     resize             (int16_t new_width, int16_t new_height);
     151  void     change_size        (int16_t new_width, int16_t new_height, uint8_t *page=NULL);
     152  void     flood_fill         (int16_t x, int16_t y, uint8_t color);
     153  image    *create_smooth     (int16_t smoothness=1); // 0 no smoothness
     154  void     unpack_scanline    (int16_t line, char bitsperpixel=1);
     155  uint8_t  brightest_color    (palette *pal);
     156  void     flip_x             ();
     157  void     flip_y             ();
     158  void     make_color         (uint8_t color);
     159  uint8_t  darkest_color      (palette *pal, int16_t noblack=0);
    160160
    161161  ~image();
  • abuse/trunk/src/imlib/include/jmalloc.hpp

    r2 r17  
    88enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE};
    99extern int alloc_space;
    10 void *jmalloc(long size, char *what_for);
    11 void *jrealloc(void *ptr, long size, char *what_for);
     10void *jmalloc(int32_t size, char *what_for);
     11void *jrealloc(void *ptr, int32_t size, char *what_for);
    1212void jfree(void *ptr);
    1313void mem_report(char *filename);
    14 void jmalloc_init(long min_size);
     14void jmalloc_init(int32_t min_size);
    1515void jmalloc_uninit();
    16 long j_allocated();
    17 long j_available();
     16int32_t j_allocated();
     17int32_t j_available();
    1818extern void free_up_memory();
    1919#else
  • abuse/trunk/src/imlib/include/jwindow.hpp

    r2 r17  
    6969struct jwindow_properties
    7070{
    71   uchar moveable,
    72         hidden;
    73  
     71  uint8_t moveable,
     72          hidden;
    7473} ;
    7574
  • abuse/trunk/src/imlib/include/macs.hpp

    r2 r17  
    2424#endif
    2525
    26 #define uchar  unsigned char
    27 #define schar  signed char
     26//#define uchar  unsigned char
     27//#define schar  signed char
    2828//#define ushort unsigned short
    29 typedef unsigned short int ushort;
    30 #define sshort signed short
     29//typedef unsigned short int ushort;
     30//#define sshort signed short
    3131//#define ulong  unsigned long
    32 typedef unsigned long int ulong;
     32//typedef unsigned long int ulong;
    3333
    3434#endif
  • abuse/trunk/src/imlib/include/packet.hpp

    r2 r17  
    55{
    66  public :
    7   uchar *buf;
    8   long buf_size,ro,wo,rend;
     7  uint8_t *buf;
     8  int32_t buf_size,ro,wo,rend;
    99  int pre_size;
    1010  void make_bigger(int max);
     
    1212  int get_read_position() { return ro; }
    1313  void set_read_position(int x) { ro=x; }
    14   int read(uchar *buffer, int size);
    15   int write(uchar *buffer, int size);
     14  int read(uint8_t *buffer, int size);
     15  int write(uint8_t *buffer, int size);
    1616  int eop() { return ro>=rend; }
    1717  void reset();
    1818  packet(int prefix_size=2);
    1919  void get_string(char *st, int len);
    20   int advance(long offset);
     20  int advance(int32_t offset);
    2121
    22   void write_long(ulong x);      // writes can't fail...
    23   void write_short(ushort x);
    24   void write_byte(uchar x);
     22  void write_uint32(uint32_t x);      // writes can't fail...
     23  void write_uint16(uint16_t x);
     24  void write_uint8(uint8_t x);
    2525  void insert_into(packet &pk);
    2626  int size() { return rend-pre_size; }
  • abuse/trunk/src/imlib/include/scroller.hpp

    r2 r17  
    5151  protected :
    5252  int r,c,m,last_sel,cur_sel;
    53   uchar *select;
     53  uint8_t *select;
    5454  public :
    5555  spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next);
  • abuse/trunk/src/imlib/include/specs.hpp

    r7 r17  
    9797
    9898  // these read and writes, allways read/write Intel endian-ness
    99   uint16_t read_short();
    100   uint32_t read_long();
    101   uint8_t read_byte();
     99  uint16_t read_uint16();
     100  uint32_t read_uint32();
     101  uint8_t read_uint8();
    102102  double read_double();
    103   void write_short(uint16_t x);
    104   void write_long(uint32_t x);
    105   void write_byte(uint8_t x);
     103  void write_uint16(uint16_t x);
     104  void write_uint32(uint32_t x);
     105  void write_uint8(uint8_t x);
    106106  void write_double(double x);
    107107  void set_read_buffer_size(long size);
     
    194194                         char *link_filename=NULL);*/
    195195
    196 uint16_t read_short(FILE *fp);
    197 uint32_t read_long(FILE *fp);
    198 uint32_t read_other_long(FILE *fp);
    199 uint16_t read_other_short(FILE *fp);
    200 uint8_t read_byte(FILE *fp);
    201 
    202 void write_short(FILE *fp, uint16_t x);
    203 void write_long(FILE *fp, uint32_t x);
    204 void write_other_short(FILE *fp, uint16_t x);
    205 void write_other_long(FILE *fp, uint32_t x);
    206 void write_byte(FILE *fp, uint8_t x);
     196uint16_t read_uint16(FILE *fp);
     197uint32_t read_uint32(FILE *fp);
     198uint32_t read_other_uint32(FILE *fp);
     199uint16_t read_other_uint16(FILE *fp);
     200uint8_t read_uint8(FILE *fp);
     201
     202void write_uint16(FILE *fp, uint16_t x);
     203void write_uint32(FILE *fp, uint32_t x);
     204void write_other_uint16(FILE *fp, uint16_t x);
     205void write_other_uint32(FILE *fp, uint32_t x);
     206void write_uint8(FILE *fp, uint8_t x);
    207207
    208208void set_spec_main_file(char *filename, int Search_order);
  • abuse/trunk/src/imlib/include/system.h

    r7 r17  
    3030
    3131
    32 #define short_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
    33 #define long_swap(x) \
     32#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
     33#define uint32_swap(x) \
    3434   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
    3535   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
     
    3737#if defined BIG_ENDIANS
    3838#define LONG int32_t
    39 #define int_to_intel(x) short_swap(x)
    40 #define int_to_local(x) int_to_intel(x)
    41 #define big_long_to_local(x) (x)
    42 #define big_short_to_local(x) (x)
    43 #define long_to_intel(x) long_swap(x)
    44 #define long_to_local(x) long_to_intel(x)
     39#define uint16_to_intel(x) uint16_swap(x)
     40#define uint16_to_local(x) uint16_to_intel(x)
     41#define big_uint32_to_local(x) (x)
     42#define big_uint16_to_local(x) (x)
     43#define uint32_to_intel(x) uint32_swap(x)
     44#define uint32_to_local(x) uint32_to_intel(x)
    4545#else
    4646#define LONG int32_t
    47 #define int_to_intel(x) (x)
    48 #define int_to_local(x) (x)
    49 #define long_to_local(x) (x)
    50 #define long_to_intel(x) (x)
    51 #define big_long_to_local(x) long_swap(x)
    52 #define big_short_to_local(x) short_swap(x)
     47#define uint16_to_intel(x) (x)
     48#define uint16_to_local(x) (x)
     49#define uint32_to_local(x) (x)
     50#define uint32_to_intel(x) (x)
     51#define big_uint32_to_local(x) uint32_swap(x)
     52#define big_uint16_to_local(x) uint16_swap(x)
    5353#endif
    5454
    55 #define bltl(x) big_long_to_local(x)
    56 #define bstl(x) big_short_to_local(x)
    57 #define lltl(x) long_to_intel(x)
    58 #define lstl(x) int_to_intel(x)
     55#define bltl(x) big_uint32_to_local(x)
     56#define bstl(x) big_uint16_to_local(x)
     57#define lltl(x) uint32_to_intel(x)
     58#define lstl(x) uint16_to_intel(x)
    5959
    6060#endif
  • abuse/trunk/src/imlib/include/timage.hpp

    r2 r17  
    2828  // if screen x & y offset already calculated save a mul
    2929  // and no clipping, but fast use this
    30   void put_image_offseted(image *screen, uchar *s_off);   
     30  void put_image_offseted(image *screen, uint8_t *s_off);   
    3131  void put_image_filled(image *screen, int x, int y,
    32                         uchar fill_color);
     32                        uint8_t fill_color);
    3333  void put_fade(image *screen, int x, int y,
    3434                           int frame_on, int total_frames,
     
    3636  void put_fade_tint(image *screen, int x, int y,
    3737                     int frame_on, int total_frames,
    38                      uchar *tint,
     38                     uint8_t *tint,
    3939                     color_filter *f, palette *pal);
    4040  void put_color(image *screen, int x, int y, int color);
  • abuse/trunk/src/imlib/jmalloc.cpp

    r8 r17  
    1313
    1414#include "jmalloc.hpp"
    15 #define uchar unsigned char
    1615#define JM_SMALL_SIZE 128      // above 128 bytes is considered to be a big block and no hashing is done
    1716int alloc_space=ALLOC_SPACE_STATIC;
     
    2928struct memory_node
    3029{
    31   long size;
     30  int32_t size;
    3231#ifdef MEM_CHECK
    3332  char *name;                     // name is allocated on regular heap
     
    4039struct small_block
    4140
    42   unsigned long size;             // size of blocks...
     41  uint32_t size;             // size of blocks...
    4342  uint32_t alloc_list;            // bit field saying weither each block is allocated or not.
    4443  small_block *next;              // next small block of same size
     
    5453  public :
    5554
    56   long block_size;                             // size of this memory_block
     55  int32_t block_size;                             // size of this memory_block
    5756  small_block *sblocks[JM_SMALL_SIZE];
    5857  small_block *cblocks[JM_SMALL_SIZE];
     
    6160  memory_node *sfirst,*slast,
    6261              *cfirst;
    63   unsigned char block_type;
    64 
    65   void init(void *block, long Block_size, uchar type);
    66   void *static_alloc(long size, char *name);
    67   void *cache_alloc(long size, char *name);
     62  uint8_t block_type;
     63
     64  void init(void *block, int32_t Block_size, uint8_t type);
     65  void *static_alloc(int32_t size, char *name);
     66  void *cache_alloc(int32_t size, char *name);
    6867  void static_free(void *ptr);
    6968  void cache_free(void *ptr);
    70   long available();
    71   long allocated();
    72   long pointer_size(void *ptr);
     69  int32_t available();
     70  int32_t allocated();
     71  int32_t pointer_size(void *ptr);
    7372  void report(FILE *fp);
    7473  void inspect();
     
    9089int block_manager::valid_static_ptr(void *ptr)
    9190{
    92   void *next=(void *)(*(((long *)ptr)-1));
     91  void *next=(void *)(*(((int32_t *)ptr)-1));
    9392  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
    9493  {
     
    111110int block_manager::valid_cache_ptr(void *ptr)
    112111{
    113   void *next=(void *)(*(((long *)ptr)-1));
     112  void *next=(void *)(*(((int32_t *)ptr)-1));
    114113  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
    115114  {
     
    274273}
    275274
    276 long block_manager::pointer_size(void *ptr)
     275int32_t block_manager::pointer_size(void *ptr)
    277276{
    278277  void *next=(void *)(*(((intptr_t *)ptr)-1));
     
    282281}
    283282
    284 long block_manager::available()
    285 {
    286   long size=0;
     283int32_t block_manager::available()
     284{
     285  int32_t size=0;
    287286  memory_node *f;
    288287  for (f=sfirst;f;f=f->next)
     
    294293}
    295294
    296 long block_manager::allocated()
    297 {
    298   long size=0;
     295int32_t block_manager::allocated()
     296{
     297  int32_t size=0;
    299298  memory_node *f;
    300299  for (f=sfirst;f;f=f->next)
     
    306305}
    307306
    308 void block_manager::init(void *block, long Block_size, uchar type)
     307void block_manager::init(void *block, int32_t Block_size, uint8_t type)
    309308{
    310309  block_size=Block_size;
     
    326325}
    327326
    328 void *block_manager::static_alloc(long size, char *name)
     327void *block_manager::static_alloc(int32_t size, char *name)
    329328{
    330329  if (size<JM_SMALL_SIZE)
     
    345344        break_mem_fun();
    346345#endif     
    347       long *addr=(long *)(((char *)s)+sizeof(small_block));
    348       *addr=(long)s;
     346      intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
     347      *addr=(intptr_t)s;
    349348      return (void *)(addr+1);  // return first block
    350349    } else
     
    360359          s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
    361360#endif           
    362           *((long *)addr)=(long)s;
     361          *((intptr_t *)addr)=(intptr_t)s;
    363362
    364363#ifdef MEM_CHECK
     
    406405
    407406
    408 void *block_manager::cache_alloc(long size, char *name)
     407void *block_manager::cache_alloc(int32_t size, char *name)
    409408{
    410409  if (size<JM_SMALL_SIZE)
     
    424423
    425424#endif     
    426       long *addr=(long *)(((char *)s)+sizeof(small_block));
    427       *addr=(long)s;
     425      intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
     426      *addr=(intptr_t)s;
    428427#ifdef MEM_CHECK
    429428      if ((intptr_t)s==break_mem_point)
     
    445444            break_mem_fun();
    446445#endif           
    447           *((long *)addr)=(long)s;
     446          *((intptr_t *)addr)=(intptr_t)s;
    448447          return (void *)(addr+4);
    449448        }
     
    461460  if (!s) // no current cache space for object, see if we can enlarge the cache space
    462461  {
    463     long size_avail=-slast->size;
     462    int32_t size_avail=-slast->size;
    464463    size_avail-=sizeof(memory_node);
    465464
     
    491490  {
    492491    memory_node *p=s;    // store this position
    493     long psize=s->size-size-sizeof(memory_node);
     492    int32_t psize=s->size-size-sizeof(memory_node);
    494493    s=(memory_node *)(((char *)s)+psize+sizeof(memory_node));
    495494    p->size=-psize;
     
    515514{
    516515  // see if this was a small_block allocation
    517   void *next=(void *)(*(((long *)ptr)-1));
     516  void *next=(void *)(*(((int32_t *)ptr)-1));
    518517  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
    519518  {
     
    598597{
    599598  // see if this was a small_block allocation
    600   void *next=(void *)(*(((long *)ptr)-1));
     599  void *next=(void *)(*(((int32_t *)ptr)-1));
    601600  if (next && next<ptr)  // small allocation
    602601  {
     
    696695                                   "    - add memory to your system\n";
    697696
    698 void jmalloc_init(long min_size)
     697void jmalloc_init(int32_t min_size)
    699698{
    700699  fprintf(stderr,"Disabling memory manager, using libc instead\n");
     
    709708
    710709#ifdef __POWERPC__
    711     long size=jmalloc_max_size-0x10000;
     710    int32_t size=jmalloc_max_size-0x10000;
    712711    for (mem=NULL;!mem && size>0x10000;)
    713712    {
     
    718717    mem = malloc(size);
    719718#else
    720     long size=jmalloc_max_size;
     719    int32_t size=jmalloc_max_size;
    721720    for (mem=NULL;!mem && size>0x4000;)
    722721    {
     
    768767
    769768
    770 long j_available()
    771 {
    772   long size=0;
     769int32_t j_available()
     770{
     771  int32_t size=0;
    773772  for (int i=0;i<bmanage_total;i++)
    774773    size+=bmanage[i].available();
     
    776775}
    777776
    778 long j_allocated()
    779 {
    780   long size=0;
     777int32_t j_allocated()
     778{
     779  int32_t size=0;
    781780  for (int i=0;i<bmanage_total;i++)
    782781    size+=bmanage[i].allocated();
     
    785784
    786785
    787 void *jmalloc(long size, char *name)
     786void *jmalloc(int32_t size, char *name)
    788787
    789788  if (!bmanage_total)
     
    838837
    839838
    840 void *jrealloc(void *ptr, long size, char *name)
     839void *jrealloc(void *ptr, int32_t size, char *name)
    841840
    842841  if (!ptr) return jmalloc(size,name);
     
    845844  if (size==0) { jfree(ptr); return NULL; }
    846845
    847   long old_size=0;
     846  int32_t old_size=0;
    848847  for (int i=0;i<bmanage_total;i++)
    849848    if (ptr>=(void *)bmanage[i].sfirst &&
     
    912911
    913912
    914 long small_ptr_size(void *ptr)
    915 {
    916   return ((small_block *)(((long *)ptr)[-1]))->size;
     913int32_t small_ptr_size(void *ptr)
     914{
     915  return ((small_block *)(((int32_t *)ptr)[-1]))->size;
    917916}
    918917
  • abuse/trunk/src/imlib/lbmread.cpp

    r4 r17  
    2020  else
    2121  {
    22     long size=read_other_long(fp);
     22    int32_t size=read_other_uint32(fp);
    2323    fread(type,1,4,fp);   
    2424    if (memcmp(type,"PBM ",4))
     
    3030    else
    3131    {
    32       long ssize;   
     32      int32_t ssize;   
    3333      char stype[4];
    34       short w=0,h=0,x,y,tcolor,pagew,pageh;
     34      int16_t w=0,h=0,x,y,tcolor,pagew,pageh;
    3535      char planes,masking,compr=0,padl,xa,ya;
    3636     
     
    3838      {
    3939        fread(stype,1,4,fp);
    40         ssize=read_other_long(fp);
     40        ssize=read_other_uint32(fp);
    4141        if (ssize &1) ssize++;            // specs say all chunks are padded by 2
    4242        if (!memcmp(stype,"BMHD",4))
    4343        {
    44           w=read_other_short(fp);
    45           h=read_other_short(fp);
    46           x=read_other_short(fp);
    47           y=read_other_short(fp);
     44          w=read_other_uint16(fp);
     45          h=read_other_uint16(fp);
     46          x=read_other_uint16(fp);
     47          y=read_other_uint16(fp);
    4848          planes=fgetc(fp);
    4949          masking=fgetc(fp);
    5050          compr=fgetc(fp);
    5151          padl=fgetc(fp);
    52           tcolor=read_other_short(fp);
     52          tcolor=read_other_uint16(fp);
    5353          xa=fgetc(fp);
    5454          ya=fgetc(fp);
    55           pagew=read_other_short(fp);
    56           pageh=read_other_short(fp);
     55          pagew=read_other_uint16(fp);
     56          pageh=read_other_uint16(fp);
    5757        } else if (!memcmp(stype,"CMAP",4))
    5858        {
  • 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++;
  • abuse/trunk/src/imlib/morph.cpp

    r2 r17  
    355355    for (i=0;i<total;i++)
    356356    {
    357       ((morph_point16 *)p+i)->x1=fp->read_short();
    358       ((morph_point16 *)p+i)->y1=fp->read_short();
    359       ((morph_point16 *)p+i)->x2=fp->read_short();
    360       ((morph_point16 *)p+i)->y2=fp->read_short();
     357      ((morph_point16 *)p+i)->x1=fp->read_uint16();
     358      ((morph_point16 *)p+i)->y1=fp->read_uint16();
     359      ((morph_point16 *)p+i)->x2=fp->read_uint16();
     360      ((morph_point16 *)p+i)->y2=fp->read_uint16();
    361361      fp->read( &((morph_point16 *)p+i)->start_color,1);
    362362      fp->read( &((morph_point16 *)p+i)->end_color,1);
     
    365365    small=0;
    366366  }
    367   w[0]=fp->read_short();
    368   h[0]=fp->read_short(); 
    369   w[1]=fp->read_short();
    370   h[1]=fp->read_short();
     367  w[0]=fp->read_uint16();
     368  h[0]=fp->read_uint16(); 
     369  w[1]=fp->read_uint16();
     370  h[1]=fp->read_uint16();
    371371}
    372372
     
    678678
    679679 
    680   fp->write_long(total); 
     680  fp->write_uint32(total); 
    681681  if (small)
    682682  {
     
    691691  {
    692692    for (i=0;i<total;i++)
    693     { fp->write_short(((morph_point16 *)p+i)->x1);
    694       fp->write_short(((morph_point16 *)p+i)->y1);
    695       fp->write_short(((morph_point16 *)p+i)->x2);
    696       fp->write_short(((morph_point16 *)p+i)->y2);
     693    { fp->write_uint16(((morph_point16 *)p+i)->x1);
     694      fp->write_uint16(((morph_point16 *)p+i)->y1);
     695      fp->write_uint16(((morph_point16 *)p+i)->x2);
     696      fp->write_uint16(((morph_point16 *)p+i)->y2);
    697697      fp->write( &((morph_point16 *)p+i)->start_color,1);
    698698      fp->write( &((morph_point16 *)p+i)->end_color,1);
    699699    }
    700700  }
    701   fp->write_short(w[0]);
    702   fp->write_short(h[0]);
    703   fp->write_short(w[1]);
    704   fp->write_short(h[1]);
     701  fp->write_uint16(w[0]);
     702  fp->write_uint16(h[0]);
     703  fp->write_uint16(w[1]);
     704  fp->write_uint16(h[1]);
    705705  return 1;
    706706}
     
    877877  int i;
    878878 
    879   patches=fp->read_short();
     879  patches=fp->read_uint16();
    880880  pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
    881881 
    882882  for (i=0;i<patches;i++)
    883883  {
    884     pats[i].patches=fp->read_short();
     884    pats[i].patches=fp->read_uint16();
    885885    if (pats[i].patches)
    886886    {     
  • abuse/trunk/src/imlib/packet.cpp

    r2 r17  
    55
    66
    7 int packet::advance(long offset)
     7int packet::advance(int32_t offset)
    88{
    99  ro+=offset;
     
    1111}
    1212
    13 void packet::write_long(ulong x)
     13void packet::write_uint32(uint32_t x)
    1414{
    1515  x=lltl(x);
    16   write((uchar *)&x,4);
     16  write((uint8_t *)&x,4);
    1717}
    1818
    19 void packet::write_short(ushort x)
     19void packet::write_uint16(uint16_t x)
    2020{
    2121  x=lstl(x);
    22   write((uchar *)&x,2);
     22  write((uint8_t *)&x,2);
    2323}
    2424
    25 void packet::write_byte(uchar x)
     25void packet::write_uint8(uint8_t x)
    2626{
    2727  write(&x,1);
     
    4141
    4242  buf_size=1000;
    43   buf=(uchar *)jmalloc(buf_size,"packet buffer");
     43  buf=(uint8_t *)jmalloc(buf_size,"packet buffer");
    4444  reset();
    4545
     
    7272  {
    7373    buf_size=max;
    74     buf=(uchar *)jrealloc(buf,max,"packet buffer");
     74    buf=(uint8_t *)jrealloc(buf,max,"packet buffer");
    7575  }
    7676}
    7777
    78 int packet::read(uchar *buffer, int size)
     78int packet::read(uint8_t *buffer, int size)
    7979{
    8080  if (size>rend-ro)
     
    9090
    9191
    92 int packet::write(uchar *buffer, int size)
     92int packet::write(uint8_t *buffer, int size)
    9393{
    9494  if (size>buf_size-wo)
  • abuse/trunk/src/imlib/palette.cpp

    r15 r17  
    1212palette::palette(bFILE *fp)
    1313{
    14   ncolors=fp->read_short();
     14  ncolors=fp->read_uint16();
    1515  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
    1616  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
     
    2323{
    2424  fp->seek(e->offset,0);
    25   ncolors=fp->read_short();
     25  ncolors=fp->read_uint16();
    2626  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
    2727  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
     
    3838int palette::write(bFILE *fp)
    3939{
    40   fp->write_short(ncolors);
     40  fp->write_uint16(ncolors);
    4141  return fp->write(pal,sizeof(color)*ncolors)==ncolors;
    4242}
  • abuse/trunk/src/imlib/pcxread.cpp

    r2 r17  
    1818  if (!fread(&PCX_header.encoding,1,1,fp)) return 0; 
    1919  if (!fread(&PCX_header.bits_per_pixel,1,1,fp)) return 0; 
    20   PCX_header.xmin=read_short(fp);
    21   PCX_header.ymin=read_short(fp); 
    22   PCX_header.xmax=read_short(fp);
    23   PCX_header.ymax=read_short(fp);
    24   PCX_header.hres=read_short(fp);
    25   PCX_header.vres=read_short(fp);
     20  PCX_header.xmin=read_uint16(fp);
     21  PCX_header.ymin=read_uint16(fp); 
     22  PCX_header.xmax=read_uint16(fp);
     23  PCX_header.ymax=read_uint16(fp);
     24  PCX_header.hres=read_uint16(fp);
     25  PCX_header.vres=read_uint16(fp);
    2626  if (!fread(PCX_header.palette,1,48,fp)) return 0;
    2727  if (!fread(&PCX_header.reserved,1,1,fp)) return 0;
    2828  if (!fread(&PCX_header.color_planes,1,1,fp)) return 0;
    29   PCX_header.bytes_per_line=read_short(fp);
    30   PCX_header.palette_type=read_short(fp);
     29  PCX_header.bytes_per_line=read_uint16(fp);
     30  PCX_header.palette_type=read_uint16(fp);
    3131  if (!fread(PCX_header.filter,1,58,fp)) return 0;
    3232  return 1;
     
    3939  if (!fwrite(&PCX_header.encoding,1,1,fp)) return 0; 
    4040  if (!fwrite(&PCX_header.bits_per_pixel,1,1,fp)) return 0; 
    41   write_short(fp,PCX_header.xmin);
    42   write_short(fp,PCX_header.ymin); 
    43   write_short(fp,PCX_header.xmax);
    44   write_short(fp,PCX_header.ymax);
    45   write_short(fp,PCX_header.hres);
    46   write_short(fp,PCX_header.vres);
     41  write_uint16(fp,PCX_header.xmin);
     42  write_uint16(fp,PCX_header.ymin); 
     43  write_uint16(fp,PCX_header.xmax);
     44  write_uint16(fp,PCX_header.ymax);
     45  write_uint16(fp,PCX_header.hres);
     46  write_uint16(fp,PCX_header.vres);
    4747  if (!fwrite(PCX_header.palette,1,48,fp)) return 0;
    4848  if (!fwrite(&PCX_header.reserved,1,1,fp)) return 0;
    4949  if (!fwrite(&PCX_header.color_planes,1,1,fp)) return 0;
    50   write_short(fp,PCX_header.bytes_per_line);
    51   write_short(fp,PCX_header.palette_type);
     50  write_uint16(fp,PCX_header.bytes_per_line);
     51  write_uint16(fp,PCX_header.palette_type);
    5252  if (!fwrite(PCX_header.filter,1,58,fp)) return 0;
    5353  return 1;
  • abuse/trunk/src/imlib/readwav.cpp

    r2 r17  
    3838{
    3939  fp->read(&chunk.id,4);
    40   chunk.size=fp->read_long();
     40  chunk.size=fp->read_uint32();
    4141  fp->read(&chunk.type,4); 
    4242}
     
    4545{
    4646  fp->read(&tag.id,4);
    47   tag.size=fp->read_long();
     47  tag.size=fp->read_uint32();
    4848}
    4949
    5050void read_wav_format(wav_format &fmt, bFILE *fp)
    5151{
    52   fmt.fmt_tag=fp->read_short();
    53   fmt.channels=fp->read_short();
    54   fmt.samplesps=fp->read_long();
    55   fmt.avg_bytesps=fp->read_long(); 
    56   fmt.align=fp->read_short(); 
     52  fmt.fmt_tag=fp->read_uint16();
     53  fmt.channels=fp->read_uint16();
     54  fmt.samplesps=fp->read_uint32();
     55  fmt.avg_bytesps=fp->read_uint32(); 
     56  fmt.align=fp->read_uint16(); 
    5757}
    5858
     
    6161{
    6262  read_wav_format(pcm.wf,fp);
    63   pcm.bitsps=fp->read_short(); 
     63  pcm.bitsps=fp->read_uint16(); 
    6464}
    6565
     
    7878  /***************  Write the chunk ***************************/
    7979  fp->write((void *)"RIFF",4); 
    80   fp->write_long(data_size+36);
     80  fp->write_uint32(data_size+36);
    8181  fp->write((void *)"WAVE",4);
    8282
     
    8484  /************** Write the tag *******************************/
    8585  fp->write((void *)"fmt ",4);
    86   fp->write_long(16);
     86  fp->write_uint32(16);
    8787 
    8888 
    8989  /************** Write PCM ***********************************/
    90   fp->write_short(1);          // format_tag
    91   fp->write_short(1);          // mono recording
    92   fp->write_long(sample_rate);
    93   fp->write_long(sample_rate);   // average bytes per sec
    94   fp->write_short(1);    // allignment? Don't know what this does?
    95   fp->write_short(8);    // 8 bits per sample
     90  fp->write_uint16(1);          // format_tag
     91  fp->write_uint16(1);          // mono recording
     92  fp->write_uint32(sample_rate);
     93  fp->write_uint32(sample_rate);   // average bytes per sec
     94  fp->write_uint16(1);    // allignment? Don't know what this does?
     95  fp->write_uint16(8);    // 8 bits per sample
    9696 
    9797  /************* Write data tag ******************************/
    9898  fp->write((void *)"data",4);
    99   fp->write_long(data_size);
     99  fp->write_uint32(data_size);
    100100
    101101  /************ Now write sample data ************************/
  • abuse/trunk/src/imlib/readxwd.cpp

    r2 r17  
    106106
    107107
    108 int bs_int(int s);
    109 long bs_long(long s);
    110 short bs_short(short s );
     108int32_t bs_int32(int32_t s);
     109int16_t bs_int16(int16_t s );
    111110
    112111
     
    325324
    326325
    327 short bs_short(short s )
     326short bs_int16(short s )
    328327{
    329328  short ss;
     
    338337}
    339338
    340 int bs_int(int i )
    341 {
    342   int ii;
    343   unsigned char *bp, t;
     339int32_t bs_int32(int32_t l )
     340{
     341  int32_t ii;
     342  uint8_t *bp, t;
    344343
    345344  ii = i;
    346   bp = (unsigned char *) &ii;
     345  bp = (uint8_t *) &ii;
    347346  t = bp[0];
    348347  bp[0] = bp[3];
     
    352351  bp[2] = t;
    353352  return ii;
    354 }
    355 
    356 long bs_long(long l )
    357 {
    358   return bs_int( l );
    359353}
    360354
     
    374368  FILE *fp;
    375369  int i,bytes;
    376   unsigned char pal_quad[4];
     370  uint8_t pal_quad[4];
    377371//  fp=fopen("d:\\windows\\256color.bmp","rb");
    378372//  fread(&bmp,1,sizeof(bmp),fp);
     
    411405{
    412406  image *ni;
    413   unsigned char *sl1,*sl2;
     407  uint8_t *sl1,*sl2;
    414408  int i,x;
    415   unsigned char r,g,b;
     409  uint8_t r,g,b;
    416410  printf("Creating image size (%d, %d)\n",im->width()*3,im->height());
    417411  ni=new image(im->width()*3,im->height());
     
    429423}
    430424
    431 unsigned char addb(int n1, int n2)
     425uint8_t addb(int n1, int n2)
    432426{ int n3;
    433427  n3=n1+n2;
     
    441435{
    442436  image *i24;
    443   unsigned char min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
     437  uint8_t min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
    444438  int i,j,x,y,delta;
    445439  (void *)ad=pal->addr();
     
    523517  image *im,*i24;
    524518  palette *pal;
    525   unsigned char *sl;
     519  uint8_t *sl;
    526520  FILE *fp;
    527521  char def_name[10],*dev_name,*fname=NULL;
    528   unsigned char cp[500],mp[500],yp[500],kp[500];
     522  uint8_t cp[500],mp[500],yp[500],kp[500];
    529523  strcpy(def_name,"\\dev\\lp");  // set the default output device to /dev/lp
    530524                // since we are in vpix, however we will use the backslash
  • abuse/trunk/src/imlib/scroller.cpp

    r4 r17  
    44
    55
    6 unsigned char hs_left_arrow[10*8]={
     6uint8_t hs_left_arrow[10*8]={
    77    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
    88    0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
     
    1313
    1414
    15 unsigned char hs_right_arrow[10*8]={
     15uint8_t hs_right_arrow[10*8]={
    1616    0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
    1717    0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
     
    2222
    2323
    24 unsigned char vs_up_arrow[8*10]={
     24uint8_t vs_up_arrow[8*10]={
    2525    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0,
    2626    0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2,
     
    3131
    3232
    33 unsigned char vs_down_arrow[8*10]={
     33uint8_t vs_down_arrow[8*10]={
    3434    0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0,
    3535    0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 2,
     
    3939    0, 0, 0, 0, 0};
    4040
    41 void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, unsigned char *buf)
     41void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, uint8_t *buf)
    4242{
    4343  short cx1,cy1,cx2,cy2;
    4444  screen->get_clip(cx1,cy1,cx2,cy2);
    45   unsigned char remap[3];
     45  uint8_t remap[3];
    4646  remap[0]=wm->medium_color();
    4747  remap[1]=wm->bright_color();
     
    5252    if (y>=cy1 && y<=cy2)
    5353    {
    54       unsigned char *sl=screen->scan_line(y)+x;
     54      uint8_t *sl=screen->scan_line(y)+x;
    5555      for (int xc=icw,xo=x;xc;xc--,xo++,sl++,buf++)
    5656      {
     
    8888int scroller::bw() { if (vert) return 12; else return 14; }
    8989
    90 unsigned char *scroller::b1()
     90uint8_t *scroller::b1()
    9191{
    9292  if (vert) return vs_up_arrow;
     
    9494}
    9595
    96 unsigned char *scroller::b2()
     96uint8_t *scroller::b2()
    9797{
    9898  if (vert) return vs_down_arrow;
     
    553553  if (m)
    554554  {
    555     select=(uchar *)jmalloc((t+7)/8,"selection bit array");
     555    select=(uint8_t *)jmalloc((t+7)/8,"selection bit array");
    556556    memset(select,0,(t+7)/8);
    557557  } else cur_sel=0;
  • abuse/trunk/src/imlib/specs.cpp

    r7 r17  
    595595
    596596
    597 uint8_t bFILE::read_byte()
     597uint8_t bFILE::read_uint8()
    598598{ uint8_t x;
    599599  read(&x,1);
     
    601601}
    602602
    603 uint16_t bFILE::read_short()
     603uint16_t bFILE::read_uint16()
    604604{
    605605  uint16_t x;
    606606  read(&x,2);
    607   return int_to_local(x);
    608 }
    609 
    610 
    611 uint32_t bFILE::read_long()
     607  return uint16_to_local(x);
     608}
     609
     610
     611uint32_t bFILE::read_uint32()
    612612{
    613613  uint32_t x;
    614614  read(&x,4);
    615   return long_to_local(x);
    616 }
    617 
    618 void bFILE::write_byte(uint8_t x)
     615  return uint32_to_local(x);
     616}
     617
     618void bFILE::write_uint8(uint8_t x)
    619619{
    620620  write(&x,1);
    621621}
    622622
    623 void bFILE::write_short(uint16_t x)
     623void bFILE::write_uint16(uint16_t x)
    624624{
    625   x=int_to_local(x);
     625  x=uint16_to_local(x);
    626626  write(&x,2);
    627627}
    628628
    629629
    630 void bFILE::write_long(uint32_t x)
    631 {
    632   x=long_to_local(x);
     630void bFILE::write_uint32(uint32_t x)
     631{
     632  x=uint32_to_local(x);
    633633  write(&x,4);
    634634}
     
    637637{
    638638  double a;
    639   write_long((long)(modf(x,&a)*(double)(1<<32-1)));
    640   write_long((long)a);
     639  write_uint32((long)(modf(x,&a)*(double)(1<<32-1)));
     640  write_uint32((long)a);
    641641}
    642642
     
    644644{
    645645  long a,b;
    646   a=read_long();
    647   b=read_long();
     646  a=read_uint32();
     647  b=read_uint32();
    648648  return (double)b+a/(double)(1<<32-1);
    649649}
     
    762762  if (!strcmp(buf,SPEC_SIGNATURE))
    763763  {   
    764     total=fp->read_short();   
     764    total=fp->read_uint16();   
    765765    entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries");
    766766    long start=fp->tell();
     
    793793      fp->read(&flags,1);
    794794
    795       se->size=fp->read_long();
    796       se->offset=fp->read_long();
     795      se->size=fp->read_uint32();
     796      se->offset=fp->read_uint32();
    797797      dp+=((sizeof(spec_entry)+len)+3)&(~3);
    798798    }
     
    880880
    881881  if (fp->write(sig,sizeof(sig))!=sizeof(sig))    return 0;
    882   fp->write_short(total);
     882  fp->write_uint16(total);
    883883
    884884
     
    891891    if (fp->write(&flags,1)!=1)                     return 0;
    892892
    893     data_size=long_to_intel((*e)->size);
     893    data_size=uint32_to_intel((*e)->size);
    894894    if (fp->write((char *)&data_size,4)!=4)              return 0;
    895     offset=long_to_intel((*e)->offset);
     895    offset=uint32_to_intel((*e)->offset);
    896896    if (fp->write((char *)&offset,4)!=4)                  return 0;
    897897
     
    913913}
    914914
    915 uint16_t read_short(FILE *fp)
     915uint16_t read_uint16(FILE *fp)
    916916{
    917917  uint16_t x;
    918918  fread(&x,1,2,fp);
    919   return int_to_local(x);
    920 }
    921 
    922 uint32_t read_long(FILE *fp)
     919  return uint16_to_local(x);
     920}
     921
     922uint32_t read_uint32(FILE *fp)
    923923{
    924924  uint32_t x;
    925925  fread(&x,1,4,fp);
    926   return long_to_local(x);
    927 }
    928 void write_short(FILE *fp, uint16_t x)
    929 {
    930   x=int_to_local(x);
     926  return uint32_to_local(x);
     927}
     928void write_uint16(FILE *fp, uint16_t x)
     929{
     930  x=uint16_to_local(x);
    931931  fwrite(&x,1,2,fp);
    932932}
    933933
    934 void write_long(FILE *fp, uint32_t x)
    935 {
    936   x=long_to_local(x);
     934void write_uint32(FILE *fp, uint32_t x)
     935{
     936  x=uint32_to_local(x);
    937937  fwrite(&x,1,4,fp);
    938938}
    939939
    940 uint8_t read_byte(FILE *fp) { return fgetc(fp)&0xff; }
    941 void write_byte(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }
    942 
    943 uint32_t read_other_long(FILE *fp)
     940uint8_t read_uint8(FILE *fp) { return fgetc(fp)&0xff; }
     941void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }
     942
     943uint32_t read_other_int32(FILE *fp)
    944944{
    945945  uint32_t x;
    946946  fread(&x,1,4,fp);
    947   return big_long_to_local(x);
    948 }
    949 
    950 uint16_t read_other_short(FILE *fp)
     947  return big_uint32_to_local(x);
     948}
     949
     950uint16_t read_other_uint16(FILE *fp)
    951951{
    952952  uint16_t x;
    953953  fread(&x,1,2,fp);
    954   return big_short_to_local(x);
    955 }
    956 
    957 
    958 void write_other_short(FILE *fp, uint16_t x)
    959 {
    960   x=big_short_to_local(x);
     954  return big_uint16_to_local(x);
     955}
     956
     957
     958void write_other_uint16(FILE *fp, uint16_t x)
     959{
     960  x=big_uint16_to_local(x);
    961961  fwrite(&x,1,2,fp);
    962962}
    963963
    964 void write_other_long(FILE *fp, uint32_t x)
    965 {
    966   x=big_long_to_local(x);
     964void write_other_int32(FILE *fp, uint32_t x)
     965{
     966  x=big_uint32_to_local(x);
    967967  fwrite(&x,1,4,fp);
    968968}
  • abuse/trunk/src/imlib/targa.cpp

    r4 r17  
    1414  }
    1515 
    16   unsigned char id,color_map,im_type;
     16  uint8_t id,color_map,im_type;
    1717
    18   id=fp->read_byte();
    19   color_map=fp->read_byte();
    20   im_type=fp->read_byte();
     18  id=fp->read_uint8();
     19  color_map=fp->read_uint8();
     20  im_type=fp->read_uint8();
    2121
    2222  if (color_map!=0)
     
    3232  }
    3333
    34   fp->read_short();
    35   fp->read_short();
    36   fp->read_byte();
     34  fp->read_uint16();
     35  fp->read_uint16();
     36  fp->read_uint8();
    3737
    38   fp->read_short();
    39   fp->read_short();
     38  fp->read_uint16();
     39  fp->read_uint16();
    4040
    4141
    42   int w=fp->read_short();
    43   int h=fp->read_short();
    44   unsigned char bpp=fp->read_byte();
    45   unsigned char im_des=fp->read_byte();
     42  int w=fp->read_uint16();
     43  int h=fp->read_uint16();
     44  uint8_t bpp=fp->read_uint8();
     45  uint8_t im_des=fp->read_uint8();
    4646
    4747  if (bpp!=32)
     
    5454
    5555  int x,y;
    56   unsigned char ctrl;
    57   unsigned char bgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0;
     56  uint8_t ctrl;
     57  uint8_t bgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0;
    5858 
    5959 
     
    6868      for (x=0;x<w;)
    6969      {
    70         ctrl=fp->read_byte();
     70        ctrl=fp->read_uint8();
    7171        if (ctrl&0x80)
    7272        {
  • abuse/trunk/src/imlib/timage.cpp

    r2 r17  
    33void trans_image::make_color(int c)
    44{
    5   unsigned char *dp=data;
     5  uint8_t *dp=data;
    66  int y,x;
    77  for (y=0;y<h;y++)
     
    2525{
    2626  image *im=new image(w,h);
    27   unsigned char *d=im->scan_line(0),*dp=data,*dline;
     27  uint8_t *d=im->scan_line(0),*dp=data,*dline;
    2828  int y,x;
    2929  for (y=0;y<h;y++)
     
    5454{
    5555  int size=0,x,y;
    56   unsigned char *sl,*datap,*marker;
     56  uint8_t *sl,*datap,*marker;
    5757  w=im->width();
    5858  h=im->height();
     
    8484  char st[80];
    8585  sprintf(st,"trans_image::data (%s)",name);
    86   data=(unsigned char *)jmalloc(size,st);
     86  data=(uint8_t *)jmalloc(size,st);
    8787#else
    88   data=(unsigned char *)jmalloc(size,"");
     88  data=(uint8_t *)jmalloc(size,"");
    8989#endif
    9090  int ww=im->width(),hh=im->height();
     
    125125void trans_image::put_scan_line(image *screen, int x, int y, int line)   // always transparent   
    126126{
    127   short x1,y1,x2,y2;
     127  int16_t x1,y1,x2,y2;
    128128  screen->get_clip(x1,y1,x2,y2);
    129129  if (y+line<y1 || y+line>y2 || x>x2 || x+w-1<x1)            // clipped off completely?
    130130    return;
    131131
    132   unsigned char *datap=data;
     132  uint8_t *datap=data;
    133133  int ix; 
    134134  while (line)            // skip scan line data until we get to the line of interest
     
    151151 
    152152  // now slam this list of runs to the screen
    153   unsigned char *screen_line=screen->scan_line(y)+x;
     153  uint8_t *screen_line=screen->scan_line(y)+x;
    154154   
    155155  for (ix=0;ix<w;)             
     
    202202
    203203
    204 inline unsigned char *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2,
     204inline uint8_t *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2,
    205205                                   int x, int &y, int &ysteps)
    206206{
     
    209209    return NULL;
    210210
    211   register unsigned char *datap=data; 
     211  register uint8_t *datap=data; 
    212212
    213213
     
    245245
    246246void trans_image::put_image_filled(image *screen, int x, int y,
    247                                    uchar fill_color)
    248 {
    249  short x1,y1,x2,y2;
     247                                   uint8_t fill_color)
     248{
     249 int16_t x1,y1,x2,y2;
    250250  int chop_length,ysteps;
    251251
    252252  screen->get_clip(x1,y1,x2,y2);
    253   register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
     253  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
    254254  if (!datap) return ;     // if clip_y says nothing to draw, return
    255255 
     
    316316}
    317317
    318 void trans_image::put_image_offseted(image *screen, uchar *s_off)   // if screen x & y offset already calculated save a mul
     318void trans_image::put_image_offseted(image *screen, uint8_t *s_off)   // if screen x & y offset already calculated save a mul
    319319{
    320320  int ix,ysteps=height();
    321321  int screen_skip=screen->width()-w;
    322   uchar skip,*datap=data;
     322  uint8_t skip,*datap=data;
    323323  for (;ysteps;ysteps--)
    324324  {
     
    353353void trans_image::put_image(image *screen, int x, int y)
    354354{
    355   short x1,y1,x2,y2;
     355  int16_t x1,y1,x2,y2;
    356356  int chop_length,ysteps;
    357357
    358358  screen->get_clip(x1,y1,x2,y2);
    359   register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
     359  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
    360360  if (!datap) return ;     // if clip_y says nothing to draw, return
    361361 
     
    414414}
    415415
    416 void trans_image::put_remaped(image *screen, int x, int y, unsigned char *remap)
    417 {
    418   short x1,y1,x2,y2;
     416void trans_image::put_remaped(image *screen, int x, int y, uint8_t *remap)
     417{
     418  int16_t x1,y1,x2,y2;
    419419  int chop_length,ysteps;
    420420
    421421  screen->get_clip(x1,y1,x2,y2);
    422   register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
     422  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
    423423  if (!datap) return ;     // if clip_y says nothing to draw, return
    424424 
     
    470470              counter=slam_length;
    471471
    472             register unsigned char *sl=screen_line+ix,*sl2=datap;
     472            register uint8_t *sl=screen_line+ix,*sl2=datap;
    473473            ix+=slam_length;       
    474474            datap+=slam_length;
     
    490490
    491491
    492 void trans_image::put_double_remaped(image *screen, int x, int y, unsigned char *remap, unsigned char *remap2)
    493 {
    494   short x1,y1,x2,y2;
     492void trans_image::put_double_remaped(image *screen, int x, int y, uint8_t *remap, uint8_t *remap2)
     493{
     494  int16_t x1,y1,x2,y2;
    495495  int chop_length,ysteps;
    496496
    497497  screen->get_clip(x1,y1,x2,y2);
    498   register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
     498  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
    499499  if (!datap) return ;     // if clip_y says nothing to draw, return
    500500 
     
    546546              counter=slam_length;
    547547
    548             register unsigned char *sl=screen_line+ix,*sl2=datap;
     548            register uint8_t *sl=screen_line+ix,*sl2=datap;
    549549            ix+=slam_length;       
    550550            datap+=slam_length;
     
    570570                           color_filter *f, palette *pal)
    571571{
    572   short x1,y1,x2,y2;
     572  int16_t x1,y1,x2,y2;
    573573  int ix,slam_length,chop_length,ysteps;
    574574
    575575  screen->get_clip(x1,y1,x2,y2);
    576   unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
     576  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
    577577                *screen_line;
    578578  if (!datap) return ;
    579579
    580   unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
     580  uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
    581581                *caddr1,*caddr2,r_dest,g_dest,b_dest;
    582582
     
    659659void trans_image::put_fade_tint(image *screen, int x, int y,
    660660                                int frame_on, int total_frames,
    661                                 uchar *tint,
     661                                uint8_t *tint,
    662662                                color_filter *f, palette *pal)
    663663{
    664   short x1,y1,x2,y2;
     664  int16_t x1,y1,x2,y2;
    665665  int ix,slam_length,chop_length,ysteps;
    666666
    667667  screen->get_clip(x1,y1,x2,y2);
    668   unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
     668  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
    669669                *screen_line;
    670670  if (!datap) return ;
    671671
    672   unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
     672  uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
    673673                *caddr1,*caddr2,r_dest,g_dest,b_dest;
    674674
     
    753753void trans_image::put_color(image *screen, int x, int y, int color)
    754754{
    755   short x1,y1,x2,y2;
     755  int16_t x1,y1,x2,y2;
    756756  int ix,slam_length,chop_length,ysteps;
    757757 
    758758  screen->get_clip(x1,y1,x2,y2);
    759   unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
     759  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
    760760                *screen_line;
    761761  if (!datap) return ;
     
    819819
    820820{
    821   short x1,y1,x2,y2;
     821  int16_t x1,y1,x2,y2;
    822822  int ix,slam_length,chop_length,ysteps;
    823   unsigned char *paddr=(unsigned char *)pal->addr(); 
     823  uint8_t *paddr=(uint8_t *)pal->addr(); 
    824824 
    825825  screen->get_clip(x1,y1,x2,y2);
    826   unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
     826  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
    827827                *blend_line,*screen_line;
    828828  if (!datap) return ;
     
    876876            else chop_length=slam_length;
    877877
    878             unsigned char *screen_run=screen_line+x+ix,
     878            uint8_t *screen_run=screen_line+x+ix,
    879879                          *blend_run=blend_line+x+ix-blendx,
    880880                          *caddr1,*caddr2,r_dest,g_dest,b_dest;     
     
    918918void trans_image::put_predator(image *screen, int x, int y)
    919919{
    920   short x1,y1,x2,y2;
     920  int16_t x1,y1,x2,y2;
    921921  int chop_length,ysteps;
    922922
    923923  screen->get_clip(x1,y1,x2,y2);
    924   register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
     924  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
    925925  if (!datap) return ;     // if clip_y says nothing to draw, return
    926926
     
    10021002int trans_image::size()
    10031003{
    1004   uchar *d=data;
     1004  uint8_t *d=data;
    10051005  int t=0;
    10061006  for (int y=0;y<h;y++)
  • abuse/trunk/src/imlib/xwdread.cpp

    r4 r17  
    123123int bit_order, byte_swap;
    124124char buf[4];
    125 unsigned char *byteP;
    126 unsigned short *shortP;
    127 unsigned long *longP;
    128 
    129 
    130 int bs_int(int s);
    131 long bs_long(long s);
    132 short bs_short(short s );
     125uint8_t *byteP;
     126uint16_t *shortP;
     127uint32_t *longP;
     128
     129
     130uint32_t bs_uint32(uint32_t s);
     131uint16_t bs_uint16(uint16_t s );
    133132
    134133
     
    136135{
    137136  /* Assume X11 headers are larger than X10 ones. */
    138   unsigned char header[sizeof(X11WDFileHeader)];
     137  uint8_t header[sizeof(X11WDFileHeader)];
    139138  image *im;
    140139  X11WDFileHeader *h11P;
     
    142141  unsigned int i;
    143142  int dummy1, dummy2, dummy3;
    144   unsigned  short minred, maxred;
     143  uint16_t minred, maxred;
    145144  X11XColor x11col;
    146145
     
    275274  pixel_mask = ( 1 << bits_per_pixel ) - 1;
    276275
    277   byteP = (unsigned char *) buf;
    278   shortP = (unsigned short *) buf;
    279   longP = (unsigned long *) buf;
     276  byteP = (uint8_t *) buf;
     277  shortP = (uint16_t *) buf;
     278  longP = (uint32_t *) buf;
    280279  return im;
    281280}
     
    284283{
    285284  int i,j;
    286   unsigned char *sl;
     285  uint8_t *sl;
    287286#if BYTE_ORDER!=BIG_ENDIAN
    288287  printf("little guys\n");
     
    314313            break;
    315314
    316           case 16: *shortP=short_swap(*shortP); break;
    317 
    318           case 32: *longP=long_swap(*longP); break;
     315          case 16: *shortP=uint16_swap(*shortP); break;
     316
     317          case 32: *longP=uint32_swap(*longP); break;
    319318
    320319          default:
     
    357356
    358357
    359 short bs_short(short s )
    360 {
    361   short ss;
    362   unsigned char *bp, t;
     358uint16_t bs_uint16(uint16_t s )
     359{
     360  uint16_t ss;
     361  uint8_t *bp, t;
    363362
    364363  ss = s;
    365   bp = (unsigned char *) &ss;
     364  bp = (uint8_t *) &ss;
    366365  t = bp[0];
    367366  bp[0] = bp[1];
     
    370369}
    371370
    372 int bs_int(int i )
    373 {
    374   int ii;
    375   unsigned char *bp, t;
    376 
    377   ii = i;
    378   bp = (unsigned char *) &ii;
     371uint32_t bs_uint32(uint32_t l )
     372{
     373  uint32_t ii;
     374  uint8_t *bp, t;
     375
     376  ii = l;
     377  bp = (uint8_t *) &ii;
    379378  t = bp[0];
    380379  bp[0] = bp[3];
     
    386385}
    387386
    388 long bs_long(long l )
    389 {
    390   return bs_int( l );
    391 }
    392 
    393387struct BMP_header
    394388{
    395389  char id[2];
    396390  long filesize;
    397   short reserved[2];
     391  int16_t reserved[2];
    398392  long headersize,infosize,width,height;
    399   short biplanes,bits;
     393  int16_t biplanes,bits;
    400394  long bicompression, bisizeimage, bixpelspermeter, biypelspermeter,
    401395       biclrused,biclrimportant;
     
    405399{
    406400  if (!fread(&bmp.id,1,2,fp)) return 0;         // 2 0
    407   bmp.filesize=read_long(fp);                   // 4 4
     401  bmp.filesize=read_uint32(fp);                   // 4 4
    408402  if (!fread(bmp.reserved,1,4,fp)) return 0;    // 4 8
    409   bmp.headersize=read_long(fp);                 // 4 12
    410   bmp.infosize=read_long(fp);                   // 4 16
    411   bmp.width=read_long(fp);                      // 4 20
    412   bmp.height=read_long(fp);                     // 4 24
    413   bmp.biplanes=read_short(fp);                  // 2 26
    414   bmp.bits=read_short(fp);                      // 2 28
    415   bmp.bicompression=read_long(fp);              // 4 32
    416   bmp.bisizeimage=read_long(fp);                // 4 36
    417   bmp.bixpelspermeter=read_long(fp);            // 4 40
    418   bmp.biypelspermeter=read_long(fp);            // 4 44
    419   bmp.biclrused=read_long(fp);                  // 4 48
    420   bmp.biclrimportant=read_long(fp);             // 4 52
     403  bmp.headersize=read_uint32(fp);                 // 4 12
     404  bmp.infosize=read_uint32(fp);                   // 4 16
     405  bmp.width=read_uint32(fp);                      // 4 20
     406  bmp.height=read_uint32(fp);                     // 4 24
     407  bmp.biplanes=read_uint16(fp);                  // 2 26
     408  bmp.bits=read_uint16(fp);                      // 2 28
     409  bmp.bicompression=read_uint32(fp);              // 4 32
     410  bmp.bisizeimage=read_uint32(fp);                // 4 36
     411  bmp.bixpelspermeter=read_uint32(fp);            // 4 40
     412  bmp.biypelspermeter=read_uint32(fp);            // 4 44
     413  bmp.biclrused=read_uint32(fp);                  // 4 48
     414  bmp.biclrimportant=read_uint32(fp);             // 4 52
    421415  return 1;
    422416 
     
    460454    return NULL;
    461455 
    462   unsigned char *sl;
     456  uint8_t *sl;
    463457  int trailer=im->width()%4;
    464458  if (trailer==1) trailer=3;
    465459  else if (trailer==3) trailer=1;
    466   uchar buf[9];
     460  uint8_t buf[9];
    467461  for (i=im->height();i;i--)
    468462  {
     
    487481  image *im;
    488482  FILE *fp;
    489   unsigned char pal_quad[4];
     483  uint8_t pal_quad[4];
    490484  char *scrap;
    491485  int bytes,i;
     
    530524{
    531525  if (!fwrite(&bmp.id,1,2,fp)) return 0; 
    532   write_long(fp,bmp.filesize); 
     526  write_uint32(fp,bmp.filesize); 
    533527  if (!fwrite(bmp.reserved,1,4,fp)) return 0;   
    534   write_long(fp,bmp.headersize);
    535   write_long(fp,bmp.infosize); 
    536   write_long(fp,bmp.width);
    537   write_long(fp,bmp.height);
    538   write_short(fp,bmp.biplanes);
    539   write_short(fp,bmp.bits);
    540   write_long(fp,bmp.bicompression);
    541   write_long(fp,bmp.bisizeimage);
    542   write_long(fp,bmp.bixpelspermeter);
    543   write_long(fp,bmp.biypelspermeter);
    544   write_long(fp,bmp.biclrused);
    545   write_long(fp,bmp.biclrimportant);   
     528  write_uint32(fp,bmp.headersize);
     529  write_uint32(fp,bmp.infosize); 
     530  write_uint32(fp,bmp.width);
     531  write_uint32(fp,bmp.height);
     532  write_uint16(fp,bmp.biplanes);
     533  write_uint16(fp,bmp.bits);
     534  write_uint32(fp,bmp.bicompression);
     535  write_uint32(fp,bmp.bisizeimage);
     536  write_uint32(fp,bmp.bixpelspermeter);
     537  write_uint32(fp,bmp.biypelspermeter);
     538  write_uint32(fp,bmp.biclrused);
     539  write_uint32(fp,bmp.biclrimportant);   
    546540  return 1;
    547541 
     
    552546  FILE *fp;
    553547  int i,bytes;
    554   unsigned char pal_quad[4];
     548  uint8_t pal_quad[4];
    555549  fp=fopen(filename,"wb");
    556550  if (!fp)
Note: See TracChangeset for help on using the changeset viewer.