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.
Location:
libcaca/trunk/caca
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r2303 r2305  
    2828
    2929#undef __extern
    30 #if defined(_WIN32) && defined(__LIBCACA__)
     30#if defined(_DOXYGEN_SKIP_ME)
     31#elif defined(_WIN32) && defined(__LIBCACA__)
    3132#   define __extern extern __declspec(dllexport)
    3233#else
     
    8081    union
    8182    {
    82         struct { unsigned int x, y, button; } mouse;
    83         struct { unsigned int w, h; } resize;
    84         struct { unsigned int ch; uint32_t utf32; char utf8[8]; } key;
     83        struct { int x, y, button; } mouse;
     84        struct { int w, h; } resize;
     85        struct { int ch; uint32_t utf32; char utf8[8]; } key;
    8586    } data;
    8687    uint8_t padding[16];
     
    171172__extern cucul_canvas_t * caca_get_canvas(caca_display_t *);
    172173__extern int caca_refresh_display(caca_display_t *);
    173 __extern int caca_set_display_time(caca_display_t *, unsigned int);
    174 __extern unsigned int caca_get_display_time(caca_display_t const *);
    175 __extern unsigned int caca_get_display_width(caca_display_t const *);
    176 __extern unsigned int caca_get_display_height(caca_display_t const *);
     174__extern int caca_set_display_time(caca_display_t *, int);
     175__extern int caca_get_display_time(caca_display_t const *);
     176__extern int caca_get_display_width(caca_display_t const *);
     177__extern int caca_get_display_height(caca_display_t const *);
    177178__extern int caca_set_display_title(caca_display_t *, char const *);
    178179__extern int caca_set_mouse(caca_display_t *, int);
     
    187188 *
    188189 *  @{ */
    189 __extern int caca_get_event(caca_display_t *, unsigned int,
    190                             caca_event_t *, int);
    191 __extern unsigned int caca_get_mouse_x(caca_display_t const *);
    192 __extern unsigned int caca_get_mouse_y(caca_display_t const *);
     190__extern int caca_get_event(caca_display_t *, int, caca_event_t *, int);
     191__extern int caca_get_mouse_x(caca_display_t const *);
     192__extern int caca_get_mouse_y(caca_display_t const *);
    193193__extern enum caca_event_type caca_get_event_type(caca_event_t const *);
    194 __extern unsigned int caca_get_event_key_ch(caca_event_t const *);
     194__extern int caca_get_event_key_ch(caca_event_t const *);
    195195__extern uint32_t caca_get_event_key_utf32(caca_event_t const *);
    196196__extern int caca_get_event_key_utf8(caca_event_t const *, char *);
    197 __extern unsigned int caca_get_event_mouse_button(caca_event_t const *);
    198 __extern unsigned int caca_get_event_mouse_x(caca_event_t const *);
    199 __extern unsigned int caca_get_event_mouse_y(caca_event_t const *);
    200 __extern unsigned int caca_get_event_resize_width(caca_event_t const *);
    201 __extern unsigned int caca_get_event_resize_height(caca_event_t const *);
     197__extern int caca_get_event_mouse_button(caca_event_t const *);
     198__extern int caca_get_event_mouse_x(caca_event_t const *);
     199__extern int caca_get_event_mouse_y(caca_event_t const *);
     200__extern int caca_get_event_resize_width(caca_event_t const *);
     201__extern int caca_get_event_resize_height(caca_event_t const *);
    202202/*  @} */
    203203
     
    206206#endif
    207207
    208 #if !defined(_DOXYGEN_SKIP_ME)
    209 #   undef __extern
    210 #endif
     208#undef __extern
    211209
    212210#endif /* __CACA_H__ */
  • libcaca/trunk/caca/caca_internals.h

    r2299 r2305  
    9696    union
    9797    {
    98         struct { unsigned int x, y, button; } mouse;
    99         struct { unsigned int w, h; } resize;
    100         struct { unsigned int ch; unsigned long int utf32; char utf8[8]; } key;
     98        struct { int x, y, button; } mouse;
     99        struct { int w, h; } resize;
     100        struct { int ch; uint32_t utf32; char utf8[8]; } key;
    101101    } data;
    102102};
     
    123123        int (* end_graphics) (caca_display_t *);
    124124        int (* set_display_title) (caca_display_t *, char const *);
    125         unsigned int (* get_display_width) (caca_display_t const *);
    126         unsigned int (* get_display_height) (caca_display_t const *);
     125        int (* get_display_width) (caca_display_t const *);
     126        int (* get_display_height) (caca_display_t const *);
    127127        void (* display) (caca_display_t *);
    128128        void (* handle_resize) (caca_display_t *);
     
    135135    struct mouse
    136136    {
    137         unsigned int x, y;
     137        int x, y;
    138138    } mouse;
    139139
     
    143143        int resized;   /* A resize event was requested */
    144144        int allow;     /* The display driver allows resizing */
    145         unsigned w, h; /* Requested width and height */
     145        int w, h; /* Requested width and height */
    146146    } resize;
    147147
    148148    /* Framerate handling */
    149     unsigned int delay, rendertime;
     149    int delay, rendertime;
    150150    caca_timer_t timer;
    151151    int lastticks;
     
    159159#if defined(USE_SLANG) || defined(USE_NCURSES)
    160160        caca_timer_t key_timer;
    161         unsigned int last_key_ticks;
    162         unsigned int autorepeat_ticks;
     161        int last_key_ticks;
     162        int autorepeat_ticks;
    163163        caca_privevent_t last_key_event;
    164164#endif
    165165#if defined(USE_WIN32)
    166         unsigned char not_empty_struct;
     166        uint8_t not_empty_struct;
    167167#endif
    168168    } events;
     
    170170
    171171/* Internal timer functions */
    172 extern void _caca_sleep(unsigned int);
    173 extern unsigned int _caca_getticks(caca_timer_t *);
     172extern void _caca_sleep(int);
     173extern int _caca_getticks(caca_timer_t *);
    174174
    175175/* Internal event functions */
  • libcaca/trunk/caca/driver_cocoa.m

    r2138 r2305  
    6363    //NSFont* _font;
    6464    NSRect _font_rect;
    65     unsigned int _h, _w;
     65    int _h, _w;
    6666    uint32_t* _attrs;
    6767    uint32_t* _chars;
     
    100100
    101101#ifdef PRECACHE_WHOLE_COLOR_TABLE
    102     unsigned int i;
     102    int i;
    103103    for(i = 0; i < NCOLORS; i++)
    104104        _colorCache[i] = [[NSColor colorFromRgb12:i] retain];
     
    126126    //[_font release];
    127127#ifdef PRECACHE_WHOLE_COLOR_TABLE
    128     unsigned short i;
     128    short i;
    129129    for(i = 0; i < NCOLORS; i++)
    130130        [_colorCache[i] release];
     
    249249    }
    250250
    251     unsigned int x, y;
     251    int x, y;
    252252    float fw = _font_rect.size.width;
    253253    float fh = _font_rect.size.height;
     
    259259    NSRectFill(rect);
    260260
    261     unsigned int arrayLength = 0;
     261    int arrayLength = 0;
    262262    for(y = 0; y < _h; y++)
    263263    {
    264         unsigned int yoff = y * fh;
     264        int yoff = y * fh;
    265265        for(x = 0; x < _w; x++)
    266266        {
     
    308308    for(y = 0; y < _h; y++)
    309309    {
    310         unsigned int yoff = y * fh;
     310        int yoff = y * fh;
    311311        for(x = 0; x < _w; x++, chars++)
    312312        {
     
    598598}
    599599
    600 static unsigned int get_caca_keycode(NSEvent* event)
    601 {
    602     unsigned int caca_keycode = 0;
     600static int get_caca_keycode(NSEvent* event)
     601{
     602    int caca_keycode = 0;
    603603    /*
    604604    unsigned short mac_keycode = [event keyCode];
     
    748748    }
    749749
    750     unsigned int caca_keycode = get_caca_keycode(event);
     750    int caca_keycode = get_caca_keycode(event);
    751751    if(caca_keycode)
    752752    {
     
    801801        {
    802802            NSPoint mouseLoc = [NSEvent mouseLocation];
    803             unsigned int mouse_x = round(mouseLoc.x);
    804             unsigned int mouse_y = round(mouseLoc.y);
     803            int mouse_x = round(mouseLoc.x);
     804            int mouse_y = round(mouseLoc.y);
    805805            if(dp->mouse.x == mouse_x && dp->mouse.y == mouse_y)
    806806                break;
     
    827827static int cocoa_init_graphics(caca_display_t *dp)
    828828{
    829     unsigned int width = cucul_get_canvas_width(dp->cv);
    830     unsigned int height = cucul_get_canvas_height(dp->cv);
     829    int width = cucul_get_canvas_width(dp->cv);
     830    int height = cucul_get_canvas_height(dp->cv);
    831831
    832832    debug_log(@"%s dp->cv: %ux%u", __PRETTY_FUNCTION__, width, height);
     
    971971}
    972972
    973 static unsigned int cocoa_get_display_width(caca_display_t const *dp)
     973static int cocoa_get_display_width(caca_display_t const *dp)
    974974{
    975975    return [dp->drv.p->window frame].size.width;
    976976}
    977977
    978 static unsigned int cocoa_get_display_height(caca_display_t const *dp)
     978static int cocoa_get_display_height(caca_display_t const *dp)
    979979{
    980980    return [dp->drv.p->window frame].size.height;
  • libcaca/trunk/caca/driver_conio.c

    r2300 r2305  
    8585}
    8686
    87 static unsigned int conio_get_display_width(caca_display_t const *dp)
     87static int conio_get_display_width(caca_display_t const *dp)
    8888{
    8989    /* Fallback to a 6x10 font */
     
    9191}
    9292
    93 static unsigned int conio_get_display_height(caca_display_t const *dp)
     93static int conio_get_display_height(caca_display_t const *dp)
    9494{
    9595    /* Fallback to a 6x10 font */
     
    102102    uint32_t const *chars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    103103    uint32_t const *attrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    104     unsigned int width = cucul_get_canvas_width(dp->cv);
    105     unsigned int height = cucul_get_canvas_height(dp->cv);
    106     unsigned int n;
     104    int width = cucul_get_canvas_width(dp->cv);
     105    int height = cucul_get_canvas_height(dp->cv);
     106    int n;
    107107
    108108    for(n = height * width; n--; )
  • libcaca/trunk/caca/driver_gl.c

    r2303 r2305  
    6464{
    6565    int window;
    66     unsigned int width, height;
    67     unsigned int new_width, new_height;
     66    int width, height;
     67    int new_width, new_height;
    6868    cucul_font_t *f;
    6969    float font_width, font_height;
     
    7474    uint8_t bit;
    7575    uint8_t mouse_changed, mouse_clicked;
    76     unsigned int mouse_x, mouse_y;
    77     unsigned int mouse_button, mouse_state;
     76    int mouse_x, mouse_y;
     77    int mouse_button, mouse_state;
    7878
    7979    uint8_t key;
     
    8888    char *argv[2] = { "", NULL };
    8989    char const * const * fonts;
    90     unsigned int width = cucul_get_canvas_width(dp->cv);
    91     unsigned int height = cucul_get_canvas_height(dp->cv);
     90    int width = cucul_get_canvas_width(dp->cv);
     91    int height = cucul_get_canvas_height(dp->cv);
    9292    int argc = 1;
    9393
     
    205205}
    206206
    207 static unsigned int gl_get_display_width(caca_display_t const *dp)
     207static int gl_get_display_width(caca_display_t const *dp)
    208208{
    209209    return dp->drv.p->width;
    210210}
    211211
    212 static unsigned int gl_get_display_height(caca_display_t const *dp)
     212static int gl_get_display_height(caca_display_t const *dp)
    213213{
    214214    return dp->drv.p->height;
     
    219219    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    220220    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    221     unsigned int width = cucul_get_canvas_width(dp->cv);
    222     unsigned int x, y, line;
     221    int width = cucul_get_canvas_width(dp->cv);
     222    int x, y, line;
    223223
    224224    glClear(GL_COLOR_BUFFER_BIT);
  • libcaca/trunk/caca/driver_ncurses.c

    r2304 r2305  
    333333}
    334334
    335 static unsigned int ncurses_get_display_width(caca_display_t const *dp)
     335static int ncurses_get_display_width(caca_display_t const *dp)
    336336{
    337337    /* Fallback to a 6x10 font */
     
    339339}
    340340
    341 static unsigned int ncurses_get_display_height(caca_display_t const *dp)
     341static int ncurses_get_display_height(caca_display_t const *dp)
    342342{
    343343    /* Fallback to a 6x10 font */
     
    349349    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    350350    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    351     unsigned int width = cucul_get_canvas_width(dp->cv);
    352     unsigned int height = cucul_get_canvas_height(dp->cv);
     351    int width = cucul_get_canvas_width(dp->cv);
     352    int height = cucul_get_canvas_height(dp->cv);
    353353    int x, y;
    354354
     
    421421        char utf8[7];
    422422        uint32_t utf32;
    423         unsigned int i;
    424         size_t bytes = 0;
     423        size_t i, bytes = 0;
    425424
    426425        keys[0] = intkey;
     
    496495        }
    497496
    498         if(dp->mouse.x == (unsigned int)mevent.x &&
    499            dp->mouse.y == (unsigned int)mevent.y)
     497        if(dp->mouse.x == mevent.x && dp->mouse.y == mevent.y)
    500498            return _pop_event(dp, ev);
    501499
  • libcaca/trunk/caca/driver_raw.c

    r2299 r2305  
    3030static int raw_init_graphics(caca_display_t *dp)
    3131{
    32     unsigned int width = cucul_get_canvas_width(dp->cv);
    33     unsigned int height = cucul_get_canvas_height(dp->cv);
     32    int width = cucul_get_canvas_width(dp->cv);
     33    int height = cucul_get_canvas_height(dp->cv);
    3434    char const *geometry;
    3535
     
    5757}
    5858
    59 static unsigned int raw_get_display_width(caca_display_t const *dp)
     59static int raw_get_display_width(caca_display_t const *dp)
    6060{
    6161    return 0;
    6262}
    6363
    64 static unsigned int raw_get_display_height(caca_display_t const *dp)
     64static int raw_get_display_height(caca_display_t const *dp)
    6565{
    6666    return 0;
     
    7070{
    7171    void *buffer;
    72     unsigned long int len;
     72    size_t len;
    7373
    7474    buffer = cucul_export_memory(dp->cv, "caca", &len);
  • libcaca/trunk/caca/driver_slang.c

    r2304 r2305  
    208208}
    209209
    210 static unsigned int slang_get_display_width(caca_display_t const *dp)
     210static int slang_get_display_width(caca_display_t const *dp)
    211211{
    212212    /* Fallback to a 6x10 font */
     
    214214}
    215215
    216 static unsigned int slang_get_display_height(caca_display_t const *dp)
     216static int slang_get_display_height(caca_display_t const *dp)
    217217{
    218218    /* Fallback to a 6x10 font */
     
    224224    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    225225    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    226     unsigned int width = cucul_get_canvas_width(dp->cv);
    227     unsigned int height = cucul_get_canvas_height(dp->cv);
     226    int width = cucul_get_canvas_width(dp->cv);
     227    int height = cucul_get_canvas_height(dp->cv);
    228228    int x, y;
    229229
     
    329329        char utf8[7];
    330330        uint32_t utf32;
    331         unsigned int i;
    332         size_t bytes = 0;
     331        size_t i, bytes = 0;
    333332
    334333        keys[0] = intkey;
     
    362361    {
    363362        int button = (SLang_getkey() - ' ' + 1) & 0xf;
    364         unsigned int x = SLang_getkey() - '!';
    365         unsigned int y = SLang_getkey() - '!';
     363        int x = SLang_getkey() - '!';
     364        int y = SLang_getkey() - '!';
    366365
    367366        ev->data.mouse.button = button;
  • libcaca/trunk/caca/driver_vga.c

    r2299 r2305  
    102102}
    103103
    104 static unsigned int vga_get_display_width(caca_display_t const *dp)
     104static int vga_get_display_width(caca_display_t const *dp)
    105105{
    106106    /* Fallback to a 320x200 screen */
     
    108108}
    109109
    110 static unsigned int vga_get_display_height(caca_display_t const *dp)
     110static int vga_get_display_height(caca_display_t const *dp)
    111111{
    112112    /* Fallback to a 320x200 screen */
     
    119119    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    120120    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    121     unsigned int width = cucul_get_canvas_width(dp->cv);
    122     unsigned int height = cucul_get_canvas_height(dp->cv);
     121    int width = cucul_get_canvas_width(dp->cv);
     122    int height = cucul_get_canvas_height(dp->cv);
    123123    int n;
    124124
  • libcaca/trunk/caca/driver_win32.c

    r2299 r2305  
    8383static int win32_init_graphics(caca_display_t *dp)
    8484{
    85     unsigned int width = cucul_get_canvas_width(dp->cv);
    86     unsigned int height = cucul_get_canvas_height(dp->cv);
     85    int width = cucul_get_canvas_width(dp->cv);
     86    int height = cucul_get_canvas_height(dp->cv);
    8787    CONSOLE_SCREEN_BUFFER_INFO csbi;
    8888    SMALL_RECT rect;
     
    176176}
    177177
    178 static unsigned int win32_get_display_width(caca_display_t const *dp)
     178static int win32_get_display_width(caca_display_t const *dp)
    179179{
    180180    /* FIXME */
     
    184184}
    185185
    186 static unsigned int win32_get_display_height(caca_display_t const *dp)
     186static int win32_get_display_height(caca_display_t const *dp)
    187187{
    188188    /* FIXME */
     
    199199    uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    200200    uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    201     unsigned int width = cucul_get_canvas_width(dp->cv);
    202     unsigned int height = cucul_get_canvas_height(dp->cv);
    203     unsigned int n;
     201    int width = cucul_get_canvas_width(dp->cv);
     202    int height = cucul_get_canvas_height(dp->cv);
     203    int n;
    204204
    205205    /* Render everything to our screen buffer */
     
    303303                COORD pos = rec.Event.MouseEvent.dwMousePosition;
    304304
    305                 if(dp->mouse.x == (unsigned int)pos.X &&
    306                    dp->mouse.y == (unsigned int)pos.Y)
     305                if(dp->mouse.x == pos.X && dp->mouse.y == pos.Y)
    307306                    continue;
    308307
  • 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)
  • libcaca/trunk/caca/event.c

    r2303 r2305  
    6464 *  \return 1 if a matching event was received, or 0 if the wait timeouted.
    6565 */
    66 int caca_get_event(caca_display_t *dp, unsigned int event_mask,
     66int caca_get_event(caca_display_t *dp, int event_mask,
    6767                   caca_event_t *ev, int timeout)
    6868{
     
    128128 *  \return The X mouse coordinate.
    129129 */
    130 unsigned int caca_get_mouse_x(caca_display_t const *dp)
    131 {
    132     unsigned int width = cucul_get_canvas_width(dp->cv);
     130int caca_get_mouse_x(caca_display_t const *dp)
     131{
     132    int width = cucul_get_canvas_width(dp->cv);
    133133
    134134    if(dp->mouse.x >= width)
     
    150150 *  \return The Y mouse coordinate.
    151151 */
    152 unsigned int caca_get_mouse_y(caca_display_t const *dp)
    153 {
    154     unsigned int height = cucul_get_canvas_height(dp->cv);
     152int caca_get_mouse_y(caca_display_t const *dp)
     153{
     154    int height = cucul_get_canvas_height(dp->cv);
    155155
    156156    if(dp->mouse.y >= height)
     
    199199 *  \return The key value.
    200200 */
    201 unsigned int caca_get_event_key_ch(caca_event_t const *ev)
     201int caca_get_event_key_ch(caca_event_t const *ev)
    202202{
    203203    return ((caca_privevent_t const *)ev)->data.key.ch;
     
    250250 *  \return The event's mouse button.
    251251 */
    252 unsigned int caca_get_event_mouse_button(caca_event_t const *ev)
     252int caca_get_event_mouse_button(caca_event_t const *ev)
    253253{
    254254    return ((caca_privevent_t const *)ev)->data.mouse.button;
     
    266266 *  \return The event's X mouse coordinate.
    267267 */
    268 unsigned int caca_get_event_mouse_x(caca_event_t const *ev)
     268int caca_get_event_mouse_x(caca_event_t const *ev)
    269269{
    270270    return ((caca_privevent_t const *)ev)->data.mouse.x;
     
    282282 *  \return The event's Y mouse coordinate.
    283283 */
    284 unsigned int caca_get_event_mouse_y(caca_event_t const *ev)
     284int caca_get_event_mouse_y(caca_event_t const *ev)
    285285{
    286286    return ((caca_privevent_t const *)ev)->data.mouse.y;
     
    298298 *  \return The event's new display width value.
    299299 */
    300 unsigned int caca_get_event_resize_width(caca_event_t const *ev)
     300int caca_get_event_resize_width(caca_event_t const *ev)
    301301{
    302302    return ((caca_privevent_t const *)ev)->data.resize.w;
     
    314314 *  \return The event's new display height value.
    315315 */
    316 unsigned int caca_get_event_resize_height(caca_event_t const *ev)
     316int caca_get_event_resize_height(caca_event_t const *ev)
    317317{
    318318    return ((caca_privevent_t const *)ev)->data.resize.h;
     
    326326{
    327327#if defined(USE_SLANG) || defined(USE_NCURSES)
    328     unsigned int ticks;
     328    int ticks;
    329329#endif
    330330    int ret;
  • libcaca/trunk/caca/graphics.c

    r2299 r2305  
    6363 *  \return The display width.
    6464 */
    65 unsigned int caca_get_display_width(caca_display_t const *dp)
     65int caca_get_display_width(caca_display_t const *dp)
    6666{
    6767    return dp->drv.get_display_width(dp);
     
    8080 *  \return The display height.
    8181 */
    82 unsigned int caca_get_display_height(caca_display_t const *dp)
     82int caca_get_display_height(caca_display_t const *dp)
    8383{
    8484    return dp->drv.get_display_height(dp);
     
    9494 *  default behaviour.
    9595 *
    96  *  This function never fails.
     96 *  If an error occurs, -1 is returned and \b errno is set accordingly:
     97 *  - \c EINVAL Refresh delay value is invalid.
    9798 *
    9899 *  \param dp The libcaca display context.
    99100 *  \param usec The refresh delay in microseconds.
    100  *  \return This function always returns 0.
    101  */
    102 int caca_set_display_time(caca_display_t *dp, unsigned int usec)
    103 {
     101 *  \return 0 upon success, -1 if an error occurred.
     102 */
     103int caca_set_display_time(caca_display_t *dp, int usec)
     104{
     105    if(usec < 0)
     106    {
     107        seterrno(EINVAL);
     108        return -1;
     109    }
     110
    104111    dp->delay = usec;
    105112    return 0;
     
    119126 *  \return The render time in microseconds.
    120127 */
    121 unsigned int caca_get_display_time(caca_display_t const *dp)
     128int caca_get_display_time(caca_display_t const *dp)
    122129{
    123130    return dp->rendertime;
  • libcaca/trunk/caca/time.c

    r2299 r2305  
    3636#include "caca_internals.h"
    3737
    38 void _caca_sleep(unsigned int usec)
     38void _caca_sleep(int usec)
    3939{
    4040#if defined(HAVE_USLEEP)
     
    4747}
    4848
    49 unsigned int _caca_getticks(caca_timer_t *timer)
     49int _caca_getticks(caca_timer_t *timer)
    5050{
    5151#if defined(HAVE_GETTIMEOFDAY)
     
    5353#elif defined(USE_WIN32)
    5454    static __int64 freq = -1; /* FIXME: can this move to caca_context? */
    55     unsigned __int64 usec;
     55    __int64 usec;
    5656#endif
    57     unsigned int ticks = 0;
     57    int ticks = 0;
    5858    int new_sec, new_usec;
    5959
Note: See TracChangeset for help on using the changeset viewer.