- Timestamp:
- Apr 19, 2008, 9:25:52 PM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca.h
r2303 r2305 28 28 29 29 #undef __extern 30 #if defined(_WIN32) && defined(__LIBCACA__) 30 #if defined(_DOXYGEN_SKIP_ME) 31 #elif defined(_WIN32) && defined(__LIBCACA__) 31 32 # define __extern extern __declspec(dllexport) 32 33 #else … … 80 81 union 81 82 { 82 struct { unsignedint x, y, button; } mouse;83 struct { unsignedint w, h; } resize;84 struct { unsignedint 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; 85 86 } data; 86 87 uint8_t padding[16]; … … 171 172 __extern cucul_canvas_t * caca_get_canvas(caca_display_t *); 172 173 __extern int caca_refresh_display(caca_display_t *); 173 __extern int caca_set_display_time(caca_display_t *, unsignedint);174 __extern unsignedint caca_get_display_time(caca_display_t const *);175 __extern unsignedint caca_get_display_width(caca_display_t const *);176 __extern unsignedint 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 *); 177 178 __extern int caca_set_display_title(caca_display_t *, char const *); 178 179 __extern int caca_set_mouse(caca_display_t *, int); … … 187 188 * 188 189 * @{ */ 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 *); 193 193 __extern enum caca_event_type caca_get_event_type(caca_event_t const *); 194 __extern unsignedint caca_get_event_key_ch(caca_event_t const *);194 __extern int caca_get_event_key_ch(caca_event_t const *); 195 195 __extern uint32_t caca_get_event_key_utf32(caca_event_t const *); 196 196 __extern int caca_get_event_key_utf8(caca_event_t const *, char *); 197 __extern unsignedint caca_get_event_mouse_button(caca_event_t const *);198 __extern unsignedint caca_get_event_mouse_x(caca_event_t const *);199 __extern unsignedint caca_get_event_mouse_y(caca_event_t const *);200 __extern unsignedint caca_get_event_resize_width(caca_event_t const *);201 __extern unsignedint 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 *); 202 202 /* @} */ 203 203 … … 206 206 #endif 207 207 208 #if !defined(_DOXYGEN_SKIP_ME) 209 # undef __extern 210 #endif 208 #undef __extern 211 209 212 210 #endif /* __CACA_H__ */ -
libcaca/trunk/caca/caca_internals.h
r2299 r2305 96 96 union 97 97 { 98 struct { unsignedint x, y, button; } mouse;99 struct { unsignedint 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; 101 101 } data; 102 102 }; … … 123 123 int (* end_graphics) (caca_display_t *); 124 124 int (* set_display_title) (caca_display_t *, char const *); 125 unsignedint (* get_display_width) (caca_display_t const *);126 unsignedint (* 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 *); 127 127 void (* display) (caca_display_t *); 128 128 void (* handle_resize) (caca_display_t *); … … 135 135 struct mouse 136 136 { 137 unsignedint x, y;137 int x, y; 138 138 } mouse; 139 139 … … 143 143 int resized; /* A resize event was requested */ 144 144 int allow; /* The display driver allows resizing */ 145 unsignedw, h; /* Requested width and height */145 int w, h; /* Requested width and height */ 146 146 } resize; 147 147 148 148 /* Framerate handling */ 149 unsignedint delay, rendertime;149 int delay, rendertime; 150 150 caca_timer_t timer; 151 151 int lastticks; … … 159 159 #if defined(USE_SLANG) || defined(USE_NCURSES) 160 160 caca_timer_t key_timer; 161 unsignedint last_key_ticks;162 unsignedint autorepeat_ticks;161 int last_key_ticks; 162 int autorepeat_ticks; 163 163 caca_privevent_t last_key_event; 164 164 #endif 165 165 #if defined(USE_WIN32) 166 u nsigned charnot_empty_struct;166 uint8_t not_empty_struct; 167 167 #endif 168 168 } events; … … 170 170 171 171 /* Internal timer functions */ 172 extern void _caca_sleep( unsignedint);173 extern unsignedint _caca_getticks(caca_timer_t *);172 extern void _caca_sleep(int); 173 extern int _caca_getticks(caca_timer_t *); 174 174 175 175 /* Internal event functions */ -
libcaca/trunk/caca/driver_cocoa.m
r2138 r2305 63 63 //NSFont* _font; 64 64 NSRect _font_rect; 65 unsignedint _h, _w;65 int _h, _w; 66 66 uint32_t* _attrs; 67 67 uint32_t* _chars; … … 100 100 101 101 #ifdef PRECACHE_WHOLE_COLOR_TABLE 102 unsignedint i;102 int i; 103 103 for(i = 0; i < NCOLORS; i++) 104 104 _colorCache[i] = [[NSColor colorFromRgb12:i] retain]; … … 126 126 //[_font release]; 127 127 #ifdef PRECACHE_WHOLE_COLOR_TABLE 128 unsignedshort i;128 short i; 129 129 for(i = 0; i < NCOLORS; i++) 130 130 [_colorCache[i] release]; … … 249 249 } 250 250 251 unsignedint x, y;251 int x, y; 252 252 float fw = _font_rect.size.width; 253 253 float fh = _font_rect.size.height; … … 259 259 NSRectFill(rect); 260 260 261 unsignedint arrayLength = 0;261 int arrayLength = 0; 262 262 for(y = 0; y < _h; y++) 263 263 { 264 unsignedint yoff = y * fh;264 int yoff = y * fh; 265 265 for(x = 0; x < _w; x++) 266 266 { … … 308 308 for(y = 0; y < _h; y++) 309 309 { 310 unsignedint yoff = y * fh;310 int yoff = y * fh; 311 311 for(x = 0; x < _w; x++, chars++) 312 312 { … … 598 598 } 599 599 600 static unsignedint get_caca_keycode(NSEvent* event)601 { 602 unsignedint caca_keycode = 0;600 static int get_caca_keycode(NSEvent* event) 601 { 602 int caca_keycode = 0; 603 603 /* 604 604 unsigned short mac_keycode = [event keyCode]; … … 748 748 } 749 749 750 unsignedint caca_keycode = get_caca_keycode(event);750 int caca_keycode = get_caca_keycode(event); 751 751 if(caca_keycode) 752 752 { … … 801 801 { 802 802 NSPoint mouseLoc = [NSEvent mouseLocation]; 803 unsignedint mouse_x = round(mouseLoc.x);804 unsignedint mouse_y = round(mouseLoc.y);803 int mouse_x = round(mouseLoc.x); 804 int mouse_y = round(mouseLoc.y); 805 805 if(dp->mouse.x == mouse_x && dp->mouse.y == mouse_y) 806 806 break; … … 827 827 static int cocoa_init_graphics(caca_display_t *dp) 828 828 { 829 unsignedint width = cucul_get_canvas_width(dp->cv);830 unsignedint 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); 831 831 832 832 debug_log(@"%s dp->cv: %ux%u", __PRETTY_FUNCTION__, width, height); … … 971 971 } 972 972 973 static unsignedint cocoa_get_display_width(caca_display_t const *dp)973 static int cocoa_get_display_width(caca_display_t const *dp) 974 974 { 975 975 return [dp->drv.p->window frame].size.width; 976 976 } 977 977 978 static unsignedint cocoa_get_display_height(caca_display_t const *dp)978 static int cocoa_get_display_height(caca_display_t const *dp) 979 979 { 980 980 return [dp->drv.p->window frame].size.height; -
libcaca/trunk/caca/driver_conio.c
r2300 r2305 85 85 } 86 86 87 static unsignedint conio_get_display_width(caca_display_t const *dp)87 static int conio_get_display_width(caca_display_t const *dp) 88 88 { 89 89 /* Fallback to a 6x10 font */ … … 91 91 } 92 92 93 static unsignedint conio_get_display_height(caca_display_t const *dp)93 static int conio_get_display_height(caca_display_t const *dp) 94 94 { 95 95 /* Fallback to a 6x10 font */ … … 102 102 uint32_t const *chars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 103 103 uint32_t const *attrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 104 unsignedint width = cucul_get_canvas_width(dp->cv);105 unsignedint height = cucul_get_canvas_height(dp->cv);106 unsignedint n;104 int width = cucul_get_canvas_width(dp->cv); 105 int height = cucul_get_canvas_height(dp->cv); 106 int n; 107 107 108 108 for(n = height * width; n--; ) -
libcaca/trunk/caca/driver_gl.c
r2303 r2305 64 64 { 65 65 int window; 66 unsignedint width, height;67 unsignedint new_width, new_height;66 int width, height; 67 int new_width, new_height; 68 68 cucul_font_t *f; 69 69 float font_width, font_height; … … 74 74 uint8_t bit; 75 75 uint8_t mouse_changed, mouse_clicked; 76 unsignedint mouse_x, mouse_y;77 unsignedint mouse_button, mouse_state;76 int mouse_x, mouse_y; 77 int mouse_button, mouse_state; 78 78 79 79 uint8_t key; … … 88 88 char *argv[2] = { "", NULL }; 89 89 char const * const * fonts; 90 unsignedint width = cucul_get_canvas_width(dp->cv);91 unsignedint 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); 92 92 int argc = 1; 93 93 … … 205 205 } 206 206 207 static unsignedint gl_get_display_width(caca_display_t const *dp)207 static int gl_get_display_width(caca_display_t const *dp) 208 208 { 209 209 return dp->drv.p->width; 210 210 } 211 211 212 static unsignedint gl_get_display_height(caca_display_t const *dp)212 static int gl_get_display_height(caca_display_t const *dp) 213 213 { 214 214 return dp->drv.p->height; … … 219 219 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 220 220 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 221 unsignedint width = cucul_get_canvas_width(dp->cv);222 unsignedint x, y, line;221 int width = cucul_get_canvas_width(dp->cv); 222 int x, y, line; 223 223 224 224 glClear(GL_COLOR_BUFFER_BIT); -
libcaca/trunk/caca/driver_ncurses.c
r2304 r2305 333 333 } 334 334 335 static unsignedint ncurses_get_display_width(caca_display_t const *dp)335 static int ncurses_get_display_width(caca_display_t const *dp) 336 336 { 337 337 /* Fallback to a 6x10 font */ … … 339 339 } 340 340 341 static unsignedint ncurses_get_display_height(caca_display_t const *dp)341 static int ncurses_get_display_height(caca_display_t const *dp) 342 342 { 343 343 /* Fallback to a 6x10 font */ … … 349 349 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 350 350 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 351 unsignedint width = cucul_get_canvas_width(dp->cv);352 unsignedint 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); 353 353 int x, y; 354 354 … … 421 421 char utf8[7]; 422 422 uint32_t utf32; 423 unsigned int i; 424 size_t bytes = 0; 423 size_t i, bytes = 0; 425 424 426 425 keys[0] = intkey; … … 496 495 } 497 496 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) 500 498 return _pop_event(dp, ev); 501 499 -
libcaca/trunk/caca/driver_raw.c
r2299 r2305 30 30 static int raw_init_graphics(caca_display_t *dp) 31 31 { 32 unsignedint width = cucul_get_canvas_width(dp->cv);33 unsignedint 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); 34 34 char const *geometry; 35 35 … … 57 57 } 58 58 59 static unsignedint raw_get_display_width(caca_display_t const *dp)59 static int raw_get_display_width(caca_display_t const *dp) 60 60 { 61 61 return 0; 62 62 } 63 63 64 static unsignedint raw_get_display_height(caca_display_t const *dp)64 static int raw_get_display_height(caca_display_t const *dp) 65 65 { 66 66 return 0; … … 70 70 { 71 71 void *buffer; 72 unsigned long int len;72 size_t len; 73 73 74 74 buffer = cucul_export_memory(dp->cv, "caca", &len); -
libcaca/trunk/caca/driver_slang.c
r2304 r2305 208 208 } 209 209 210 static unsignedint slang_get_display_width(caca_display_t const *dp)210 static int slang_get_display_width(caca_display_t const *dp) 211 211 { 212 212 /* Fallback to a 6x10 font */ … … 214 214 } 215 215 216 static unsignedint slang_get_display_height(caca_display_t const *dp)216 static int slang_get_display_height(caca_display_t const *dp) 217 217 { 218 218 /* Fallback to a 6x10 font */ … … 224 224 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 225 225 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 226 unsignedint width = cucul_get_canvas_width(dp->cv);227 unsignedint 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); 228 228 int x, y; 229 229 … … 329 329 char utf8[7]; 330 330 uint32_t utf32; 331 unsigned int i; 332 size_t bytes = 0; 331 size_t i, bytes = 0; 333 332 334 333 keys[0] = intkey; … … 362 361 { 363 362 int button = (SLang_getkey() - ' ' + 1) & 0xf; 364 unsignedint x = SLang_getkey() - '!';365 unsignedint y = SLang_getkey() - '!';363 int x = SLang_getkey() - '!'; 364 int y = SLang_getkey() - '!'; 366 365 367 366 ev->data.mouse.button = button; -
libcaca/trunk/caca/driver_vga.c
r2299 r2305 102 102 } 103 103 104 static unsignedint vga_get_display_width(caca_display_t const *dp)104 static int vga_get_display_width(caca_display_t const *dp) 105 105 { 106 106 /* Fallback to a 320x200 screen */ … … 108 108 } 109 109 110 static unsignedint vga_get_display_height(caca_display_t const *dp)110 static int vga_get_display_height(caca_display_t const *dp) 111 111 { 112 112 /* Fallback to a 320x200 screen */ … … 119 119 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 120 120 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 121 unsignedint width = cucul_get_canvas_width(dp->cv);122 unsignedint 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); 123 123 int n; 124 124 -
libcaca/trunk/caca/driver_win32.c
r2299 r2305 83 83 static int win32_init_graphics(caca_display_t *dp) 84 84 { 85 unsignedint width = cucul_get_canvas_width(dp->cv);86 unsignedint 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); 87 87 CONSOLE_SCREEN_BUFFER_INFO csbi; 88 88 SMALL_RECT rect; … … 176 176 } 177 177 178 static unsignedint win32_get_display_width(caca_display_t const *dp)178 static int win32_get_display_width(caca_display_t const *dp) 179 179 { 180 180 /* FIXME */ … … 184 184 } 185 185 186 static unsignedint win32_get_display_height(caca_display_t const *dp)186 static int win32_get_display_height(caca_display_t const *dp) 187 187 { 188 188 /* FIXME */ … … 199 199 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 200 200 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 201 unsignedint width = cucul_get_canvas_width(dp->cv);202 unsignedint height = cucul_get_canvas_height(dp->cv);203 unsignedint n;201 int width = cucul_get_canvas_width(dp->cv); 202 int height = cucul_get_canvas_height(dp->cv); 203 int n; 204 204 205 205 /* Render everything to our screen buffer */ … … 303 303 COORD pos = rec.Event.MouseEvent.dwMousePosition; 304 304 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) 307 306 continue; 308 307 -
libcaca/trunk/caca/driver_x11.c
r2299 r2305 76 76 char const *fonts[] = { NULL, "8x13bold", "fixed" }, **parser; 77 77 char const *geometry; 78 unsignedint width = cucul_get_canvas_width(dp->cv);79 unsignedint 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); 80 80 int i; 81 81 … … 112 112 for( ; ; parser++) 113 113 { 114 u nsigned int font_max_char;114 uint32_t font_max_char; 115 115 116 116 if(!*parser) … … 144 144 145 145 font_max_char = 146 ( ((unsigned int)dp->drv.p->font_struct->max_byte1)<< 8)146 (dp->drv.p->font_struct->max_byte1 << 8) 147 147 | dp->drv.p->font_struct->max_char_or_byte2; 148 148 if(font_max_char && (font_max_char < dp->drv.p->max_char)) … … 278 278 } 279 279 280 static unsignedint x11_get_display_width(caca_display_t const *dp)280 static int x11_get_display_width(caca_display_t const *dp) 281 281 { 282 282 return cucul_get_canvas_width(dp->cv) * dp->drv.p->font_width; 283 283 } 284 284 285 static unsignedint x11_get_display_height(caca_display_t const *dp)285 static int x11_get_display_height(caca_display_t const *dp) 286 286 { 287 287 return cucul_get_canvas_height(dp->cv) * dp->drv.p->font_height; … … 292 292 uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); 293 293 uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); 294 unsignedint width = cucul_get_canvas_width(dp->cv);295 unsignedint height = cucul_get_canvas_height(dp->cv);296 unsignedint 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; 297 297 298 298 /* First draw the background colours. Splitting the process in two … … 323 323 for(y = 0; y < height; y++) 324 324 { 325 unsignedint yoff = (y + 1) * dp->drv.p->font_height325 int yoff = (y + 1) * dp->drv.p->font_height 326 326 - dp->drv.p->font_offset; 327 327 uint32_t const *chars = cvchars + y * width; … … 379 379 static int x11_get_event(caca_display_t *dp, caca_privevent_t *ev) 380 380 { 381 unsignedint width = cucul_get_canvas_width(dp->cv);382 unsignedint 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); 383 383 XEvent xevent; 384 384 char key; … … 402 402 if(xevent.type == ConfigureNotify) 403 403 { 404 unsignedint w, h;404 int w, h; 405 405 406 406 w = (xevent.xconfigure.width + dp->drv.p->font_width / 3) … … 422 422 if(xevent.type == MotionNotify) 423 423 { 424 unsignedint newx = xevent.xmotion.x / dp->drv.p->font_width;425 unsignedint 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; 426 426 427 427 if(newx >= width) -
libcaca/trunk/caca/event.c
r2303 r2305 64 64 * \return 1 if a matching event was received, or 0 if the wait timeouted. 65 65 */ 66 int caca_get_event(caca_display_t *dp, unsignedint event_mask,66 int caca_get_event(caca_display_t *dp, int event_mask, 67 67 caca_event_t *ev, int timeout) 68 68 { … … 128 128 * \return The X mouse coordinate. 129 129 */ 130 unsignedint caca_get_mouse_x(caca_display_t const *dp)131 { 132 unsignedint width = cucul_get_canvas_width(dp->cv);130 int caca_get_mouse_x(caca_display_t const *dp) 131 { 132 int width = cucul_get_canvas_width(dp->cv); 133 133 134 134 if(dp->mouse.x >= width) … … 150 150 * \return The Y mouse coordinate. 151 151 */ 152 unsignedint caca_get_mouse_y(caca_display_t const *dp)153 { 154 unsignedint height = cucul_get_canvas_height(dp->cv);152 int caca_get_mouse_y(caca_display_t const *dp) 153 { 154 int height = cucul_get_canvas_height(dp->cv); 155 155 156 156 if(dp->mouse.y >= height) … … 199 199 * \return The key value. 200 200 */ 201 unsignedint caca_get_event_key_ch(caca_event_t const *ev)201 int caca_get_event_key_ch(caca_event_t const *ev) 202 202 { 203 203 return ((caca_privevent_t const *)ev)->data.key.ch; … … 250 250 * \return The event's mouse button. 251 251 */ 252 unsignedint caca_get_event_mouse_button(caca_event_t const *ev)252 int caca_get_event_mouse_button(caca_event_t const *ev) 253 253 { 254 254 return ((caca_privevent_t const *)ev)->data.mouse.button; … … 266 266 * \return The event's X mouse coordinate. 267 267 */ 268 unsignedint caca_get_event_mouse_x(caca_event_t const *ev)268 int caca_get_event_mouse_x(caca_event_t const *ev) 269 269 { 270 270 return ((caca_privevent_t const *)ev)->data.mouse.x; … … 282 282 * \return The event's Y mouse coordinate. 283 283 */ 284 unsignedint caca_get_event_mouse_y(caca_event_t const *ev)284 int caca_get_event_mouse_y(caca_event_t const *ev) 285 285 { 286 286 return ((caca_privevent_t const *)ev)->data.mouse.y; … … 298 298 * \return The event's new display width value. 299 299 */ 300 unsignedint caca_get_event_resize_width(caca_event_t const *ev)300 int caca_get_event_resize_width(caca_event_t const *ev) 301 301 { 302 302 return ((caca_privevent_t const *)ev)->data.resize.w; … … 314 314 * \return The event's new display height value. 315 315 */ 316 unsignedint caca_get_event_resize_height(caca_event_t const *ev)316 int caca_get_event_resize_height(caca_event_t const *ev) 317 317 { 318 318 return ((caca_privevent_t const *)ev)->data.resize.h; … … 326 326 { 327 327 #if defined(USE_SLANG) || defined(USE_NCURSES) 328 unsignedint ticks;328 int ticks; 329 329 #endif 330 330 int ret; -
libcaca/trunk/caca/graphics.c
r2299 r2305 63 63 * \return The display width. 64 64 */ 65 unsignedint caca_get_display_width(caca_display_t const *dp)65 int caca_get_display_width(caca_display_t const *dp) 66 66 { 67 67 return dp->drv.get_display_width(dp); … … 80 80 * \return The display height. 81 81 */ 82 unsignedint caca_get_display_height(caca_display_t const *dp)82 int caca_get_display_height(caca_display_t const *dp) 83 83 { 84 84 return dp->drv.get_display_height(dp); … … 94 94 * default behaviour. 95 95 * 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. 97 98 * 98 99 * \param dp The libcaca display context. 99 100 * \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 */ 103 int caca_set_display_time(caca_display_t *dp, int usec) 104 { 105 if(usec < 0) 106 { 107 seterrno(EINVAL); 108 return -1; 109 } 110 104 111 dp->delay = usec; 105 112 return 0; … … 119 126 * \return The render time in microseconds. 120 127 */ 121 unsignedint caca_get_display_time(caca_display_t const *dp)128 int caca_get_display_time(caca_display_t const *dp) 122 129 { 123 130 return dp->rendertime; -
libcaca/trunk/caca/time.c
r2299 r2305 36 36 #include "caca_internals.h" 37 37 38 void _caca_sleep( unsignedint usec)38 void _caca_sleep(int usec) 39 39 { 40 40 #if defined(HAVE_USLEEP) … … 47 47 } 48 48 49 unsignedint _caca_getticks(caca_timer_t *timer)49 int _caca_getticks(caca_timer_t *timer) 50 50 { 51 51 #if defined(HAVE_GETTIMEOFDAY) … … 53 53 #elif defined(USE_WIN32) 54 54 static __int64 freq = -1; /* FIXME: can this move to caca_context? */ 55 unsigned__int64 usec;55 __int64 usec; 56 56 #endif 57 unsignedint ticks = 0;57 int ticks = 0; 58 58 int new_sec, new_usec; 59 59 -
libcaca/trunk/cucul/canvas.c
r2304 r2305 300 300 { 301 301 uint32_t attr = cv->curattr; 302 unsignedint n;302 int n; 303 303 304 304 for(n = cv->width * cv->height; n--; ) … … 394 394 endj = (y + src->height >= dst->height) ? dst->height - y : src->height; 395 395 396 if( (unsigned int)starti > src->width || (unsigned int)startj > src->height396 if(starti > src->width || startj > src->height 397 397 || starti >= endi || startj >= endj) 398 398 return 0; … … 400 400 for(j = startj; j < endj; j++) 401 401 { 402 unsignedint dstix = (j + y) * dst->width + starti + x;403 unsignedint srcix = j * src->width + starti;402 int dstix = (j + y) * dst->width + starti + x; 403 int srcix = j * src->width + starti; 404 404 int stride = endi - starti; 405 405 … … 408 408 dst->chars[dstix - 1] = ' '; 409 409 410 if( (unsigned int)(endi + x)< dst->width410 if(endi + x < dst->width 411 411 && dst->chars[dstix + stride] == CUCUL_MAGIC_FULLWIDTH) 412 412 dst->chars[dstix + stride] = ' '; … … 433 433 dst->chars[dstix] = ' '; 434 434 435 if((unsigned int)endi < src->width 436 && src->chars[endi] == CUCUL_MAGIC_FULLWIDTH) 435 if(endi < src->width && src->chars[endi] == CUCUL_MAGIC_FULLWIDTH) 437 436 dst->chars[dstix + stride - 1] = ' '; 438 437 } … … 448 447 * 449 448 * If an error occurs, -1 is returned and \b errno is set accordingly: 449 * - \c EINVAL Specified width or height is invalid. 450 450 * - \c EBUSY The canvas is in use by a display driver and cannot be resized. 451 451 * - \c ENOMEM Not enough memory for the requested canvas size. If this … … 459 459 * \return 0 in case of success, -1 if an error occurred. 460 460 */ 461 int cucul_set_canvas_boundaries(cucul_canvas_t *cv, int x, int y, 462 unsigned int w, unsigned int h) 461 int cucul_set_canvas_boundaries(cucul_canvas_t *cv, int x, int y, int w, int h) 463 462 { 464 463 cucul_canvas_t *new; 465 unsignedint f, saved_f, framecount;464 int f, saved_f, framecount; 466 465 467 466 if(cv->refcount) 468 467 { 469 468 seterrno(EBUSY); 469 return -1; 470 } 471 472 if(w < 0 || h < 0) 473 { 474 seterrno(EINVAL); 470 475 return -1; 471 476 } -
libcaca/trunk/cucul/cucul.c
r2300 r2305 34 34 #include "cucul_internals.h" 35 35 36 static int cucul_resize(cucul_canvas_t *, unsigned int, unsignedint);36 static int cucul_resize(cucul_canvas_t *, int, int); 37 37 38 38 /** \brief Initialise a \e libcucul canvas. … … 47 47 * 48 48 * If an error occurs, NULL is returned and \b errno is set accordingly: 49 * - \c EINVAL Specified width or height is invalid. 49 50 * - \c ENOMEM Not enough memory for the requested canvas size. 50 51 * … … 53 54 * \return A libcucul canvas handle upon success, NULL if an error occurred. 54 55 */ 55 cucul_canvas_t * cucul_create_canvas(unsigned int width, unsigned int height) 56 { 57 cucul_canvas_t *cv = malloc(sizeof(cucul_canvas_t)); 56 cucul_canvas_t * cucul_create_canvas(int width, int height) 57 { 58 cucul_canvas_t *cv; 59 60 if(width < 0 || height < 0) 61 { 62 seterrno(EINVAL); 63 return NULL; 64 } 65 66 cv = malloc(sizeof(cucul_canvas_t)); 58 67 59 68 if(!cv) … … 191 200 * 192 201 * If an error occurs, -1 is returned and \b errno is set accordingly: 202 * - \c EINVAL Specified width or height is invalid. 193 203 * - \c EBUSY The canvas is in use by a display driver and cannot be resized. 194 204 * - \c ENOMEM Not enough memory for the requested canvas size. If this … … 200 210 * \return 0 in case of success, -1 if an error occurred. 201 211 */ 202 int cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, 203 unsigned int height) 204 { 212 int cucul_set_canvas_size(cucul_canvas_t *cv, int width, int height) 213 { 214 if(width < 0 || height < 0) 215 { 216 seterrno(EINVAL); 217 return -1; 218 } 219 205 220 if(cv->refcount && cv->resize_callback 206 221 && !cv->resize_callback(cv->resize_data)) … … 222 237 * \return The canvas width. 223 238 */ 224 unsignedint cucul_get_canvas_width(cucul_canvas_t const *cv)239 int cucul_get_canvas_width(cucul_canvas_t const *cv) 225 240 { 226 241 return cv->width; … … 236 251 * \return The canvas height. 237 252 */ 238 unsignedint cucul_get_canvas_height(cucul_canvas_t const *cv)253 int cucul_get_canvas_height(cucul_canvas_t const *cv) 239 254 { 240 255 return cv->height; … … 293 308 int cucul_free_canvas(cucul_canvas_t *cv) 294 309 { 295 unsignedint f;310 int f; 296 311 297 312 if(cv->refcount) … … 357 372 */ 358 373 359 int cucul_resize(cucul_canvas_t *cv, unsigned int width, unsignedint height)360 { 361 unsignedint x, y, f, old_width, old_height, new_size, old_size;374 int cucul_resize(cucul_canvas_t *cv, int width, int height) 375 { 376 int x, y, f, old_width, old_height, new_size, old_size; 362 377 363 378 old_width = cv->width; … … 427 442 /* New width is smaller. Copy as many lines as possible. Ignore 428 443 * the first line, it is already in place. */ 429 unsignedint lines = height < old_height ? height : old_height;444 int lines = height < old_height ? height : old_height; 430 445 431 446 for(f = 0; f < cv->framecount; f++) -
libcaca/trunk/cucul/cucul.h
r2304 r2305 28 28 29 29 #undef __extern 30 #if defined(_WIN32) && defined(__LIBCUCUL__) 30 #if defined(_DOXYGEN_SKIP_ME) 31 #elif defined(_WIN32) && defined(__LIBCUCUL__) 31 32 # define __extern extern __declspec(dllexport) 32 33 #else … … 87 88 * 88 89 * @{ */ 89 __extern cucul_canvas_t * cucul_create_canvas( unsigned int, unsignedint);90 __extern cucul_canvas_t * cucul_create_canvas(int, int); 90 91 __extern int cucul_manage_canvas(cucul_canvas_t *, int (*)(void *), void *); 91 92 __extern int cucul_unmanage_canvas(cucul_canvas_t *, int (*)(void *), void *); 92 __extern int cucul_set_canvas_size(cucul_canvas_t *, unsigned int, 93 unsigned int); 94 __extern unsigned int cucul_get_canvas_width(cucul_canvas_t const *); 95 __extern unsigned int cucul_get_canvas_height(cucul_canvas_t const *); 93 __extern int cucul_set_canvas_size(cucul_canvas_t *, int, int); 94 __extern int cucul_get_canvas_width(cucul_canvas_t const *); 95 __extern int cucul_get_canvas_height(cucul_canvas_t const *); 96 96 __extern uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *); 97 97 __extern uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *); … … 126 126 __extern int cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *, 127 127 cucul_canvas_t const *); 128 __extern int cucul_set_canvas_boundaries(cucul_canvas_t *, int, int, 129 unsigned int, unsigned int); 128 __extern int cucul_set_canvas_boundaries(cucul_canvas_t *, int, int, int, int); 130 129 /* @} */ 131 130 … … 208 207 * 209 208 * @{ */ 210 __extern unsignedint cucul_get_frame_count(cucul_canvas_t const *);211 __extern int cucul_set_frame(cucul_canvas_t *, unsignedint);209 __extern int cucul_get_frame_count(cucul_canvas_t const *); 210 __extern int cucul_set_frame(cucul_canvas_t *, int); 212 211 __extern char const *cucul_get_frame_name(cucul_canvas_t const *); 213 212 __extern int cucul_set_frame_name(cucul_canvas_t *, char const *); 214 __extern int cucul_create_frame(cucul_canvas_t *, unsignedint);215 __extern int cucul_free_frame(cucul_canvas_t *, unsignedint);213 __extern int cucul_create_frame(cucul_canvas_t *, int); 214 __extern int cucul_free_frame(cucul_canvas_t *, int); 216 215 /* @} */ 217 216 … … 222 221 * 223 222 * @{ */ 224 __extern cucul_dither_t *cucul_create_dither(unsigned int, unsigned int, 225 unsigned int, unsigned int, 223 __extern cucul_dither_t *cucul_create_dither(int, int, int, int, 226 224 uint32_t, uint32_t, 227 225 uint32_t, uint32_t); 228 226 __extern int cucul_set_dither_palette(cucul_dither_t *, 229 u nsigned int r[], unsigned int g[],230 u nsigned int b[], unsigned int a[]);227 uint32_t r[], uint32_t g[], 228 uint32_t b[], uint32_t a[]); 231 229 __extern int cucul_set_dither_brightness(cucul_dither_t *, float); 232 230 __extern float cucul_get_dither_brightness(cucul_dither_t const *); … … 262 260 * 263 261 * @{ */ 264 __extern cucul_font_t *cucul_load_font(void const *, unsigned int);262 __extern cucul_font_t *cucul_load_font(void const *, size_t); 265 263 __extern char const * const * cucul_get_font_list(void); 266 __extern unsignedint cucul_get_font_width(cucul_font_t const *);267 __extern unsignedint cucul_get_font_height(cucul_font_t const *);268 __extern u nsigned int const *cucul_get_font_blocks(cucul_font_t const *);264 __extern int cucul_get_font_width(cucul_font_t const *); 265 __extern int cucul_get_font_height(cucul_font_t const *); 266 __extern uint32_t const *cucul_get_font_blocks(cucul_font_t const *); 269 267 __extern int cucul_render_canvas(cucul_canvas_t const *, cucul_font_t const *, 270 void *, unsigned int, unsigned int, 271 unsigned int); 268 void *, int, int, int); 272 269 __extern int cucul_free_font(cucul_font_t *); 273 270 /* @} */ … … 367 364 #endif 368 365 369 #if !defined(_DOXYGEN_SKIP_ME) 370 # undef __extern 371 #endif 366 #undef __extern 372 367 373 368 #endif /* __CUCUL_H__ */ -
libcaca/trunk/cucul/cucul_internals.h
r2299 r2305 23 23 { 24 24 /* Frame size */ 25 unsignedint width, height;25 int width, height; 26 26 27 27 /* Cell information */ … … 44 44 45 45 /* Frame information */ 46 unsignedint frame, framecount;46 int frame, framecount; 47 47 struct cucul_frame *frames; 48 48 49 49 /* Canvas management */ 50 unsignedint refcount;51 unsignedint autoinc;50 int refcount; 51 int autoinc; 52 52 int (*resize_callback)(void *); 53 53 void *resize_data; 54 54 55 55 /* Shortcut to the active frame information */ 56 unsignedint width, height;56 int width, height; 57 57 uint32_t *chars; 58 58 uint32_t *attrs; … … 65 65 struct cucul_buffer 66 66 { 67 unsigned long int size;67 size_t size; 68 68 char *data; 69 69 int user_data; -
libcaca/trunk/cucul/dither.c
r2303 r2305 139 139 char const *algo_name; 140 140 void (*init_dither) (int); 141 unsignedint (*get_dither) (void);141 int (*get_dither) (void); 142 142 void (*increment_dither) (void); 143 143 144 144 char const *glyph_name; 145 145 uint32_t const * glyphs; 146 unsignedglyph_count;146 int glyph_count; 147 147 148 148 int invert; … … 179 179 /* Dithering algorithms */ 180 180 static void init_no_dither(int); 181 static unsignedint get_no_dither(void);181 static int get_no_dither(void); 182 182 static void increment_no_dither(void); 183 183 184 184 static void init_fstein_dither(int); 185 static unsignedint get_fstein_dither(void);185 static int get_fstein_dither(void); 186 186 static void increment_fstein_dither(void); 187 187 188 188 static void init_ordered2_dither(int); 189 static unsignedint get_ordered2_dither(void);189 static int get_ordered2_dither(void); 190 190 static void increment_ordered2_dither(void); 191 191 192 192 static void init_ordered4_dither(int); 193 static unsignedint get_ordered4_dither(void);193 static int get_ordered4_dither(void); 194 194 static void increment_ordered4_dither(void); 195 195 196 196 static void init_ordered8_dither(int); 197 static unsignedint get_ordered8_dither(void);197 static int get_ordered8_dither(void); 198 198 static void increment_ordered8_dither(void); 199 199 200 200 static void init_random_dither(int); 201 static unsignedint get_random_dither(void);201 static int get_random_dither(void); 202 202 static void increment_random_dither(void); 203 203 … … 261 261 * \return Dither object upon success, NULL if an error occurred. 262 262 */ 263 cucul_dither_t *cucul_create_dither(unsigned int bpp, unsigned int w, 264 unsigned int h, unsigned int pitch, 263 cucul_dither_t *cucul_create_dither(int bpp, int w, int h, int pitch, 265 264 uint32_t rmask, uint32_t gmask, 266 265 uint32_t bmask, uint32_t amask) … … 270 269 271 270 /* Minor sanity test */ 272 if( !w || !h || !pitch|| bpp > 32 || bpp < 8)271 if(w < 0 || h < 0 || pitch < 0 || bpp > 32 || bpp < 8) 273 272 { 274 273 seterrno(EINVAL); … … 374 373 */ 375 374 int cucul_set_dither_palette(cucul_dither_t *d, 376 u nsigned int red[], unsigned int green[],377 u nsigned int blue[], unsigned int alpha[])375 uint32_t red[], uint32_t green[], 376 uint32_t blue[], uint32_t alpha[]) 378 377 { 379 378 int i, has_alpha = 0; … … 947 946 uint32_t savedattr; 948 947 int fs_length; 949 int x1, y1, x2, y2, pitch, deltax, deltay; 950 unsigned int dchmax; 948 int x1, y1, x2, y2, pitch, deltax, deltay, dchmax; 951 949 952 950 if(!d || !pixels) … … 982 980 x++) 983 981 { 984 unsigned int i;985 int ch = 0, distmin;986 982 unsigned int rgba[4]; 983 int error[3]; 984 int i, ch = 0, distmin; 987 985 int fg_r = 0, fg_g = 0, fg_b = 0, bg_r, bg_g, bg_b; 988 986 int fromx, fromy, tox, toy, myx, myy, dots, dist; 989 int error[3]; 990 991 unsigned int outfg = 0, outbg = 0; 987 988 int outfg = 0, outbg = 0; 992 989 uint32_t outch; 993 990 … … 1363 1360 } 1364 1361 1365 static unsignedint get_no_dither(void)1362 static int get_no_dither(void) 1366 1363 { 1367 1364 return 0x80; … … 1381 1378 } 1382 1379 1383 static unsignedint get_fstein_dither(void)1380 static int get_fstein_dither(void) 1384 1381 { 1385 1382 return 0x80; … … 1394 1391 * Ordered 2 dithering 1395 1392 */ 1396 static unsignedint const *ordered2_table;1397 static unsignedint ordered2_index;1393 static int const *ordered2_table; 1394 static int ordered2_index; 1398 1395 1399 1396 static void init_ordered2_dither(int line) 1400 1397 { 1401 static unsignedint const dither2x2[] =1398 static int const dither2x2[] = 1402 1399 { 1403 1400 0x00, 0x80, … … 1409 1406 } 1410 1407 1411 static unsignedint get_ordered2_dither(void)1408 static int get_ordered2_dither(void) 1412 1409 { 1413 1410 return ordered2_table[ordered2_index]; … … 1426 1423 -2, -7, -8, 3, 1427 1424 4, -3, -4, -7};*/ 1428 static unsignedint const *ordered4_table;1429 static unsignedint ordered4_index;1425 static int const *ordered4_table; 1426 static int ordered4_index; 1430 1427 1431 1428 static void init_ordered4_dither(int line) 1432 1429 { 1433 static unsignedint const dither4x4[] =1430 static int const dither4x4[] = 1434 1431 { 1435 1432 0x00, 0x80, 0x20, 0xa0, … … 1443 1440 } 1444 1441 1445 static unsignedint get_ordered4_dither(void)1442 static int get_ordered4_dither(void) 1446 1443 { 1447 1444 return ordered4_table[ordered4_index]; … … 1456 1453 * Ordered 8 dithering 1457 1454 */ 1458 static unsignedint const *ordered8_table;1459 static unsignedint ordered8_index;1455 static int const *ordered8_table; 1456 static int ordered8_index; 1460 1457 1461 1458 static void init_ordered8_dither(int line) 1462 1459 { 1463 static unsignedint const dither8x8[] =1460 static int const dither8x8[] = 1464 1461 { 1465 1462 0x00, 0x80, 0x20, 0xa0, 0x08, 0x88, 0x28, 0xa8, … … 1477 1474 } 1478 1475 1479 static unsignedint get_ordered8_dither(void)1476 static int get_ordered8_dither(void) 1480 1477 { 1481 1478 return ordered8_table[ordered8_index]; … … 1495 1492 } 1496 1493 1497 static unsignedint get_random_dither(void)1494 static int get_random_dither(void) 1498 1495 { 1499 1496 return cucul_rand(0x00, 0x100); … … 1510 1507 static int init_lookup(void) 1511 1508 { 1512 unsignedint v, s, h;1509 int v, s, h; 1513 1510 1514 1511 /* These ones are constant */ -
libcaca/trunk/cucul/export.c
r2304 r2305 163 163 { 164 164 char *data, *cur; 165 unsignedint f, n;165 int f, n; 166 166 167 167 /* 52 bytes for the header: … … 223 223 224 224 char *data, *cur; 225 unsignedint x, y;225 int x, y; 226 226 227 227 /* 23 bytes assumed for max length per pixel ('\e[5;1;3x;4y;9x;10ym' plus … … 303 303 304 304 char *data, *cur; 305 unsignedint x, y;305 int x, y; 306 306 307 307 uint8_t prevfg = -1; … … 377 377 { 378 378 char *data, *cur; 379 unsignedint x, y, len;379 int x, y, len; 380 380 381 381 /* The HTML header: less than 1000 bytes … … 459 459 { 460 460 char *data, *cur; 461 unsignedint x, y, len;461 int x, y, len; 462 462 463 463 /* The HTML table markup: less than 1000 bytes … … 483 483 for(x = 0; x < cv->width; x += len) 484 484 { 485 unsignedint i, needfont;485 int i, needfont; 486 486 487 487 /* Use colspan option to factor cells with same attributes … … 560 560 { 561 561 char *data, *cur; 562 unsignedint x, y, len;562 int x, y, len; 563 563 564 564 /* The font markup: less than 100 bytes … … 581 581 for(x = 0; x < cv->width; x += len) 582 582 { 583 unsignedint i, needback, needfront;583 int i, needback, needfront; 584 584 585 585 /* Use colspan option to factor cells with same attributes … … 667 667 668 668 char *data, *cur; 669 unsignedint x, y;669 int x, y; 670 670 671 671 /* 14 bytes assumed for max length per pixel. Worst case scenario: … … 793 793 794 794 char *data, *cur; 795 unsignedint x, y;795 int x, y; 796 796 797 797 /* 200 is arbitrary but should be ok */ … … 884 884 885 885 char *data, *cur; 886 unsignedint x, y;886 int x, y; 887 887 888 888 /* 200 is arbitrary but should be ok */ … … 965 965 char *data, *cur; 966 966 cucul_font_t *f; 967 unsignedint i, w, h;967 int i, w, h; 968 968 969 969 fontlist = cucul_get_font_list(); -
libcaca/trunk/cucul/figfont.c
r2303 r2305 34 34 struct cucul_figfont 35 35 { 36 unsignedint term_width;36 int term_width; 37 37 int x, y, w, h, lines; 38 38 39 39 enum { H_DEFAULT, H_KERN, H_SMUSH, H_NONE, H_OVERLAP } hmode; 40 unsignedint hsmushrule;40 int hsmushrule; 41 41 uint32_t hardblank; 42 unsignedint height, baseline, max_length;42 int height, baseline, max_length; 43 43 int old_layout; 44 unsignedint print_direction, full_layout, codetag_count;45 unsignedint glyphs;44 int print_direction, full_layout, codetag_count; 45 int glyphs; 46 46 cucul_canvas_t *fontcv, *charcv; 47 47 int *left, *right; /* Unused yet */ 48 u nsigned int *lookup;48 uint32_t *lookup; 49 49 }; 50 50 51 static uint32_t hsmush(uint32_t ch1, uint32_t ch2, unsignedint rule);51 static uint32_t hsmush(uint32_t ch1, uint32_t ch2, int rule); 52 52 static cucul_figfont_t * open_figfont(char const *); 53 53 static int free_figfont(cucul_figfont_t *); … … 131 131 { 132 132 cucul_figfont_t *ff = cv->ff; 133 unsignedint c, w, h, x, y, overlap, extra, xleft, xright;133 int c, w, h, x, y, overlap, extra, xleft, xright; 134 134 135 135 switch(ch) … … 254 254 { 255 255 cucul_figfont_t *ff = cv->ff; 256 unsignedint x, y;256 int x, y; 257 257 258 258 //ff->torender = cv; … … 292 292 char *data = NULL; 293 293 cucul_file_t *f; 294 unsignedint i, j, size, comment_lines;294 int i, j, size, comment_lines; 295 295 296 296 ff = malloc(sizeof(cucul_figfont_t)); … … 488 488 } 489 489 490 static uint32_t hsmush(uint32_t ch1, uint32_t ch2, unsignedint rule)490 static uint32_t hsmush(uint32_t ch1, uint32_t ch2, int rule) 491 491 { 492 492 /* Rule 1 */ -
libcaca/trunk/cucul/font.c
r2303 r2305 71 71 #define DECLARE_UNPACKGLYPH(bpp) \ 72 72 static inline void \ 73 unpack_glyph ## bpp(uint8_t *glyph, uint8_t *packed_data, \ 74 unsigned int n) \ 73 unpack_glyph ## bpp(uint8_t *glyph, uint8_t *packed_data, int n) \ 75 74 { \ 76 unsignedint i; \75 int i; \ 77 76 \ 78 77 for(i = 0; i < n; i++) \ … … 112 111 * \return A font handle or NULL in case of error. 113 112 */ 114 cucul_font_t *cucul_load_font(void const *data, unsigned int size)113 cucul_font_t *cucul_load_font(void const *data, size_t size) 115 114 { 116 115 cucul_font_t *f; 117 unsignedint i;116 int i; 118 117 119 118 if(size == 0) … … 248 247 + f->header.blocks * sizeof(struct block_info), 249 248 f->header.glyphs * sizeof(struct glyph_info)); 250 for(i = 0; i < f->header.glyphs; i++)249 for(i = 0; i < (int)f->header.glyphs; i++) 251 250 { 252 251 f->glyph_list[i].width = hton16(f->glyph_list[i].width); … … 325 324 * \return The standard glyph width. 326 325 */ 327 unsignedint cucul_get_font_width(cucul_font_t const *f)326 int cucul_get_font_width(cucul_font_t const *f) 328 327 { 329 328 return f->header.width; … … 340 339 * \return The standard glyph height. 341 340 */ 342 unsignedint cucul_get_font_height(cucul_font_t const *f)341 int cucul_get_font_height(cucul_font_t const *f) 343 342 { 344 343 return f->header.height; … … 405 404 * all. They may be cropped instead in future versions. 406 405 * 407 * This function never fails. 406 * If an error occurs, -1 is returned and \b errno is set accordingly: 407 * - \c EINVAL Specified width, height or pitch is invalid. 408 408 * 409 409 * \param cv The canvas to render … … 413 413 * \param height The height (in pixels) of the image buffer 414 414 * \param pitch The pitch (in bytes) of an image buffer line. 415 * \return This function always returns 0.415 * \return 0 in case of success, -1 if an error occurred. 416 416 */ 417 417 int cucul_render_canvas(cucul_canvas_t const *cv, cucul_font_t const *f, 418 void *buf, unsigned int width, 419 unsigned int height, unsigned int pitch) 418 void *buf, int width, int height, int pitch) 420 419 { 421 420 uint8_t *glyph = NULL; 422 unsigned int x, y, xmax, ymax; 421 int x, y, xmax, ymax; 422 423 if(width < 0 || height < 0 || pitch < 0) 424 { 425 seterrno(EINVAL); 426 return -1; 427 } 423 428 424 429 if(f->header.bpp != 8) … … 440 445 { 441 446 uint8_t argb[8]; 442 unsignedint starty = y * f->header.height;443 unsignedint startx = x * f->header.width;447 int starty = y * f->header.height; 448 int startx = x * f->header.width; 444 449 uint32_t ch = cv->chars[y * cv->width + x]; 445 450 uint32_t attr = cv->attrs[y * cv->width + x]; 446 unsignedint b, i, j;451 int b, i, j; 447 452 struct glyph_info *g; 448 453 -
libcaca/trunk/cucul/frame.c
r2299 r2305 37 37 * \return The frame count 38 38 */ 39 unsignedint cucul_get_frame_count(cucul_canvas_t const *cv)39 int cucul_get_frame_count(cucul_canvas_t const *cv) 40 40 { 41 41 return cv->framecount; … … 57 57 * \return 0 in case of success, -1 if an error occurred. 58 58 */ 59 int cucul_set_frame(cucul_canvas_t *cv, unsignedint id)60 { 61 if(id >= cv->framecount)59 int cucul_set_frame(cucul_canvas_t *cv, int id) 60 { 61 if(id < 0 || id >= cv->framecount) 62 62 { 63 63 seterrno(EINVAL); … … 125 125 * values range from 0 to the current canvas frame count. If the frame 126 126 * index is greater than or equals the current canvas frame count, the new 127 * frame is appended at the end of the canvas. 127 * frame is appended at the end of the canvas. If the frame index is less 128 * than zero, the new frame is inserted at index 0. 128 129 * 129 130 * The active frame does not change, but its index may be renumbered due … … 137 138 * \return 0 in case of success, -1 if an error occurred. 138 139 */ 139 int cucul_create_frame(cucul_canvas_t *cv, unsigned int id) 140 { 141 unsigned int size = cv->width * cv->height; 142 unsigned int f; 143 144 if(id > cv->framecount) 140 int cucul_create_frame(cucul_canvas_t *cv, int id) 141 { 142 int size = cv->width * cv->height; 143 int f; 144 145 if(id < 0) 146 id = 0; 147 else if(id > cv->framecount) 145 148 id = cv->framecount; 146 149 … … 195 198 * \return 0 in case of success, -1 if an error occurred. 196 199 */ 197 int cucul_free_frame(cucul_canvas_t *cv, unsignedint id)198 { 199 unsignedint f;200 201 if(id >= cv->framecount)200 int cucul_free_frame(cucul_canvas_t *cv, int id) 201 { 202 int f; 203 204 if(id < 0 || id >= cv->framecount) 202 205 { 203 206 seterrno(EINVAL); -
libcaca/trunk/cucul/transform.c
r2299 r2305 47 47 { 48 48 uint32_t *attrs = cv->attrs; 49 unsignedint i;49 int i; 50 50 51 51 for(i = cv->height * cv->width; i--; ) … … 72 72 int cucul_flip(cucul_canvas_t *cv) 73 73 { 74 unsignedint y;74 int y; 75 75 76 76 for(y = 0; y < cv->height; y++) … … 131 131 int cucul_flop(cucul_canvas_t *cv) 132 132 { 133 unsignedint x;133 int x; 134 134 135 135 for(x = 0; x < cv->width; x++) … … 181 181 uint32_t *abegin = cv->attrs; 182 182 uint32_t *aend = abegin + cv->width * cv->height - 1; 183 unsignedint y;183 int y; 184 184 185 185 while(cbegin < cend) … … 243 243 { 244 244 uint32_t *newchars, *newattrs; 245 unsignedint x, y, w2, h2;245 int x, y, w2, h2; 246 246 247 247 if(cv->refcount) … … 360 360 { 361 361 uint32_t *newchars, *newattrs; 362 unsignedint x, y, w2, h2;362 int x, y, w2, h2; 363 363 364 364 if(cv->refcount) … … 475 475 { 476 476 uint32_t *newchars, *newattrs; 477 unsignedint x, y;477 int x, y; 478 478 479 479 if(cv->refcount) … … 566 566 { 567 567 uint32_t *newchars, *newattrs; 568 unsignedint x, y;568 int x, y; 569 569 570 570 if(cv->refcount) -
libcaca/trunk/examples/text.c
r2299 r2305 38 38 cucul_canvas_t *cv, *pig; 39 39 void *buffer; 40 unsigned long int len;41 unsignedint i, j;40 size_t len; 41 int i, j; 42 42 43 43 pig = cucul_create_canvas(0, 0);
Note: See TracChangeset
for help on using the changeset viewer.