Ignore:
Timestamp:
Apr 19, 2008, 9:25:52 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Remove all unsigned ints from exported functions. Signed arithmetic is far better for error checking.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_x11.c

    r2299 r2305  
    7676    char const *fonts[] = { NULL, "8x13bold", "fixed" }, **parser;
    7777    char const *geometry;
    78     unsigned int width = cucul_get_canvas_width(dp->cv);
    79     unsigned int height = cucul_get_canvas_height(dp->cv);
     78    int width = cucul_get_canvas_width(dp->cv);
     79    int height = cucul_get_canvas_height(dp->cv);
    8080    int i;
    8181
     
    112112    for( ; ; parser++)
    113113    {
    114         unsigned int font_max_char;
     114        uint32_t font_max_char;
    115115
    116116        if(!*parser)
     
    144144
    145145        font_max_char =
    146             (((unsigned int)dp->drv.p->font_struct->max_byte1) << 8)
     146            (dp->drv.p->font_struct->max_byte1 << 8)
    147147             | dp->drv.p->font_struct->max_char_or_byte2;
    148148        if(font_max_char && (font_max_char < dp->drv.p->max_char))
     
    278278}
    279279
    280 static unsigned int x11_get_display_width(caca_display_t const *dp)
     280static int x11_get_display_width(caca_display_t const *dp)
    281281{
    282282    return cucul_get_canvas_width(dp->cv) * dp->drv.p->font_width;
    283283}
    284284
    285 static unsigned int x11_get_display_height(caca_display_t const *dp)
     285static int x11_get_display_height(caca_display_t const *dp)
    286286{
    287287    return cucul_get_canvas_height(dp->cv) * dp->drv.p->font_height;
     
    292292    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    293293    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    294     unsigned int width = cucul_get_canvas_width(dp->cv);
    295     unsigned int height = cucul_get_canvas_height(dp->cv);
    296     unsigned int x, y, len;
     294    int width = cucul_get_canvas_width(dp->cv);
     295    int height = cucul_get_canvas_height(dp->cv);
     296    int x, y, len;
    297297
    298298    /* First draw the background colours. Splitting the process in two
     
    323323    for(y = 0; y < height; y++)
    324324    {
    325         unsigned int yoff = (y + 1) * dp->drv.p->font_height
     325        int yoff = (y + 1) * dp->drv.p->font_height
    326326                                    - dp->drv.p->font_offset;
    327327        uint32_t const *chars = cvchars + y * width;
     
    379379static int x11_get_event(caca_display_t *dp, caca_privevent_t *ev)
    380380{
    381     unsigned int width = cucul_get_canvas_width(dp->cv);
    382     unsigned int height = cucul_get_canvas_height(dp->cv);
     381    int width = cucul_get_canvas_width(dp->cv);
     382    int height = cucul_get_canvas_height(dp->cv);
    383383    XEvent xevent;
    384384    char key;
     
    402402        if(xevent.type == ConfigureNotify)
    403403        {
    404             unsigned int w, h;
     404            int w, h;
    405405
    406406            w = (xevent.xconfigure.width + dp->drv.p->font_width / 3)
     
    422422        if(xevent.type == MotionNotify)
    423423        {
    424             unsigned int newx = xevent.xmotion.x / dp->drv.p->font_width;
    425             unsigned int newy = xevent.xmotion.y / dp->drv.p->font_height;
     424            int newx = xevent.xmotion.x / dp->drv.p->font_width;
     425            int newy = xevent.xmotion.y / dp->drv.p->font_height;
    426426
    427427            if(newx >= width)
Note: See TracChangeset for help on using the changeset viewer.