Changeset 2304
- Timestamp:
- Apr 19, 2008, 9:25:47 PM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_ncurses.c
r2299 r2304 421 421 char utf8[7]; 422 422 uint32_t utf32; 423 unsigned int i, bytes = 0; 423 unsigned int i; 424 size_t bytes = 0; 424 425 425 426 keys[0] = intkey; -
libcaca/trunk/caca/driver_slang.c
r2299 r2304 329 329 char utf8[7]; 330 330 uint32_t utf32; 331 unsigned int i, bytes = 0; 331 unsigned int i; 332 size_t bytes = 0; 332 333 333 334 keys[0] = intkey; -
libcaca/trunk/cucul/canvas.c
r2303 r2304 220 220 int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) 221 221 { 222 unsigned int rd;222 size_t rd; 223 223 224 224 if(y < 0 || y >= (int)cv->height || x >= (int)cv->width) -
libcaca/trunk/cucul/charset.c
r2303 r2304 112 112 * is incomplete. 113 113 */ 114 uint32_t cucul_utf8_to_utf32(char const *s, unsigned int *read)115 { 116 unsigned int bytes= trailing[(int)(unsigned char)*s];114 uint32_t cucul_utf8_to_utf32(char const *s, size_t *bytes) 115 { 116 unsigned int todo = trailing[(int)(unsigned char)*s]; 117 117 unsigned int i = 0; 118 118 uint32_t ret = 0; … … 122 122 if(!*s) 123 123 { 124 if( read)125 * read= 0;124 if(bytes) 125 *bytes = 0; 126 126 return 0; 127 127 } 128 128 129 ret += ((uint32_t)(unsigned char)*s++) << (6 * ( bytes- i));130 131 if( bytes== i++)129 ret += ((uint32_t)(unsigned char)*s++) << (6 * (todo - i)); 130 131 if(todo == i++) 132 132 { 133 if( read)134 * read= i;135 return ret - offsets[ bytes];133 if(bytes) 134 *bytes = i; 135 return ret - offsets[todo]; 136 136 } 137 137 } … … 151 151 * \return The number of bytes written. 152 152 */ 153 unsigned int cucul_utf32_to_utf8(char *buf, uint32_t ch)153 size_t cucul_utf32_to_utf8(char *buf, uint32_t ch) 154 154 { 155 155 static const uint8_t mark[7] = … … 159 159 160 160 char *parser = buf; 161 int bytes;161 size_t bytes; 162 162 163 163 if(ch < 0x80) -
libcaca/trunk/cucul/cucul.h
r2303 r2304 163 163 * 164 164 * @{ */ 165 __extern uint32_t cucul_utf8_to_utf32(char const *, unsigned int *);166 __extern unsigned int cucul_utf32_to_utf8(char *, uint32_t);165 __extern uint32_t cucul_utf8_to_utf32(char const *, size_t *); 166 __extern size_t cucul_utf32_to_utf8(char *, uint32_t); 167 167 __extern uint8_t cucul_utf32_to_cp437(uint32_t); 168 168 __extern uint32_t cucul_cp437_to_utf32(uint8_t); … … 289 289 * 290 290 * @{ */ 291 __extern long int cucul_import_memory(cucul_canvas_t *, void const *,292 unsigned long int, char const *);293 __extern long int cucul_import_file(cucul_canvas_t *, char const *,294 291 __extern ssize_t cucul_import_memory(cucul_canvas_t *, void const *, 292 size_t, char const *); 293 __extern ssize_t cucul_import_file(cucul_canvas_t *, char const *, 294 char const *); 295 295 __extern char const * const * cucul_get_import_list(void); 296 296 __extern void *cucul_export_memory(cucul_canvas_t const *, char const *, 297 unsigned long int *);297 size_t *); 298 298 __extern char const * const * cucul_get_export_list(void); 299 299 /* @} */ -
libcaca/trunk/cucul/cucul_types.h.in
r2299 r2304 38 38 typedef signed short int16_t; 39 39 typedef signed long int int32_t; 40 typedef signed long long int int64_t; 40 41 41 42 typedef unsigned char uint8_t; 42 43 typedef unsigned short uint16_t; 43 44 typedef unsigned long int uint32_t; 45 typedef unsigned long long int uint64_t; 44 46 45 47 typedef long int intptr_t; -
libcaca/trunk/cucul/export.c
r2300 r2304 45 45 } 46 46 47 static void *export_caca(cucul_canvas_t const *, unsigned long int *);48 static void *export_ansi(cucul_canvas_t const *, unsigned long int *);49 static void *export_utf8(cucul_canvas_t const *, unsigned long int *, int);50 static void *export_html(cucul_canvas_t const *, unsigned long int *);51 static void *export_html3(cucul_canvas_t const *, unsigned long int *);52 static void *export_bbfr(cucul_canvas_t const *, unsigned long int *);53 static void *export_irc(cucul_canvas_t const *, unsigned long int *);54 static void *export_ps(cucul_canvas_t const *, unsigned long int *);55 static void *export_svg(cucul_canvas_t const *, unsigned long int *);56 static void *export_tga(cucul_canvas_t const *, unsigned long int *);47 static void *export_caca(cucul_canvas_t const *, size_t *); 48 static void *export_ansi(cucul_canvas_t const *, size_t *); 49 static void *export_utf8(cucul_canvas_t const *, size_t *, int); 50 static void *export_html(cucul_canvas_t const *, size_t *); 51 static void *export_html3(cucul_canvas_t const *, size_t *); 52 static void *export_bbfr(cucul_canvas_t const *, size_t *); 53 static void *export_irc(cucul_canvas_t const *, size_t *); 54 static void *export_ps(cucul_canvas_t const *, size_t *); 55 static void *export_svg(cucul_canvas_t const *, size_t *); 56 static void *export_tga(cucul_canvas_t const *, size_t *); 57 57 58 58 /** \brief Export a canvas into a foreign format. … … 79 79 * \param cv A libcucul canvas 80 80 * \param format A string describing the requested output format. 81 * \param bytes A pointer to a n unsigned long integer where the number of82 * allocated byteswill be written.81 * \param bytes A pointer to a size_t where the number of allocated bytes 82 * will be written. 83 83 * \return A pointer to the exported memory area, or NULL in case of error. 84 84 */ 85 85 void *cucul_export_memory(cucul_canvas_t const *cv, char const *format, 86 unsigned long int *bytes)86 size_t *bytes) 87 87 { 88 88 if(!strcasecmp("caca", format)) … … 160 160 161 161 /* Generate a native libcaca canvas file. */ 162 static void *export_caca(cucul_canvas_t const *cv, unsigned long int *bytes)162 static void *export_caca(cucul_canvas_t const *cv, size_t *bytes) 163 163 { 164 164 char *data, *cur; … … 213 213 214 214 /* Generate UTF-8 representation of current canvas. */ 215 static void *export_utf8(cucul_canvas_t const *cv, unsigned long int *bytes,215 static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, 216 216 int cr) 217 217 { … … 294 294 295 295 /* Generate ANSI representation of current canvas. */ 296 static void *export_ansi(cucul_canvas_t const *cv, unsigned long int *bytes)296 static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) 297 297 { 298 298 static uint8_t const palette[] = … … 374 374 375 375 /* Generate HTML representation of current canvas. */ 376 static void *export_html(cucul_canvas_t const *cv, unsigned long int *bytes)376 static void *export_html(cucul_canvas_t const *cv, size_t *bytes) 377 377 { 378 378 char *data, *cur; … … 456 456 * will not work under gecko (mozilla rendering engine) unless you set a 457 457 * correct header. */ 458 static void *export_html3(cucul_canvas_t const *cv, unsigned long int *bytes)458 static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) 459 459 { 460 460 char *data, *cur; … … 557 557 } 558 558 559 static void *export_bbfr(cucul_canvas_t const *cv, unsigned long int *bytes)559 static void *export_bbfr(cucul_canvas_t const *cv, size_t *bytes) 560 560 { 561 561 char *data, *cur; … … 658 658 659 659 /* Export a text file with IRC colours */ 660 static void *export_irc(cucul_canvas_t const *cv, unsigned long int *bytes)660 static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) 661 661 { 662 662 static uint8_t const palette[] = … … 765 765 766 766 /* Export a PostScript document. */ 767 static void *export_ps(cucul_canvas_t const *cv, unsigned long int *bytes)767 static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) 768 768 { 769 769 static char const *ps_header = … … 874 874 875 875 /* Export an SVG vector image */ 876 static void *export_svg(cucul_canvas_t const *cv, unsigned long int *bytes)876 static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) 877 877 { 878 878 static char const svg_header[] = … … 960 960 961 961 /* Export a TGA image */ 962 static void *export_tga(cucul_canvas_t const *cv, unsigned long int *bytes)962 static void *export_tga(cucul_canvas_t const *cv, size_t *bytes) 963 963 { 964 964 char const * const *fontlist; -
libcaca/trunk/cucul/import.c
r2299 r2304 53 53 }; 54 54 55 static long int import_caca(cucul_canvas_t *, void const *, unsigned int);56 static long int import_text(cucul_canvas_t *, void const *, unsigned int);57 static long int import_ansi(cucul_canvas_t *, void const *, unsigned int, int);55 static ssize_t import_caca(cucul_canvas_t *, void const *, size_t); 56 static ssize_t import_text(cucul_canvas_t *, void const *, size_t); 57 static ssize_t import_ansi(cucul_canvas_t *, void const *, size_t, int); 58 58 59 59 static void ansi_parse_grcm(cucul_canvas_t *, struct import *, … … 87 87 * or -1 if an error occurred. 88 88 */ 89 long int cucul_import_memory(cucul_canvas_t *cv, void const *data,90 unsigned long int len, char const *format)89 ssize_t cucul_import_memory(cucul_canvas_t *cv, void const *data, 90 size_t len, char const *format) 91 91 { 92 92 if(!strcasecmp("caca", format)) … … 152 152 * or -1 if an error occurred. 153 153 */ 154 long int cucul_import_file(cucul_canvas_t *cv, char const *filename,155 154 ssize_t cucul_import_file(cucul_canvas_t *cv, char const *filename, 155 char const *format) 156 156 { 157 157 #if defined __KERNEL__ … … 161 161 FILE *fp; 162 162 void *data; 163 long int size;163 ssize_t size; 164 164 int ret; 165 165 … … 220 220 */ 221 221 222 static long int import_caca(cucul_canvas_t *cv, 223 void const *data, unsigned int size) 222 static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) 224 223 { 225 224 uint8_t const *buf = (uint8_t const *)data; … … 338 337 } 339 338 340 static long int import_text(cucul_canvas_t *cv, 341 void const *data, unsigned int size) 339 static ssize_t import_text(cucul_canvas_t *cv, void const *data, size_t size) 342 340 { 343 341 char const *text = (char const *)data; … … 381 379 } 382 380 383 static long int import_ansi(cucul_canvas_t *cv,384 void const *data, unsigned int size, int utf8)381 static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, 382 size_t size, int utf8) 385 383 { 386 384 struct import im; … … 683 681 else if(utf8) 684 682 { 685 unsigned int bytes;683 size_t bytes; 686 684 687 685 if(i + 6 < size) -
libcaca/trunk/cxx/cucul++.cpp
r2303 r2304 26 26 27 27 28 uint32_t Charset::utf8ToUtf32(char const *s, unsigned int *read)28 uint32_t Charset::utf8ToUtf32(char const *s, size_t *read) 29 29 { 30 30 return cucul_utf8_to_utf32(s, read); 31 31 } 32 unsigned int Charset::utf32ToUtf8(char *buf, uint32_t ch)32 size_t Charset::utf32ToUtf8(char *buf, uint32_t ch) 33 33 { 34 34 return cucul_utf32_to_utf8(buf, ch); -
libcaca/trunk/cxx/cucul++.h
r2303 r2304 39 39 { 40 40 public: 41 uint32_t utf8ToUtf32(char const *, unsigned int *);42 unsigned int utf32ToUtf8(char *, uint32_t);41 uint32_t utf8ToUtf32(char const *, size_t *); 42 size_t utf32ToUtf8(char *, uint32_t); 43 43 uint8_t utf32ToCp437(uint32_t); 44 44 uint32_t cp437ToUtf32(uint8_t); -
libcaca/trunk/examples/font2tga.c
r2299 r2304 24 24 int main(int argc, char *argv[]) 25 25 { 26 u nsigned long int const *blocks;26 uint32_t const *blocks; 27 27 cucul_font_t *f; 28 28 char const * const * fonts; 29 29 cucul_canvas_t *cv; 30 30 void *buffer; 31 unsigned long int len;31 size_t len; 32 32 unsigned int i, j, x, y, cells, width; 33 33 -
libcaca/trunk/src/aafire.c
r2299 r2304 46 46 static cucul_dither_t *cucul_dither; 47 47 static char *bitmap; 48 static int pause = 0;48 static int paused = 0; 49 49 #else 50 50 static aa_context *context; … … 213 213 char *bitmap = aa_image (context); 214 214 #else 215 if(pause )216 goto paused;215 if(paused) 216 goto _paused; 217 217 #endif 218 218 … … 238 238 firemain (); 239 239 #ifdef LIBCACA 240 paused:240 _paused: 241 241 cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), 242 242 cucul_get_canvas_height(cv), cucul_dither, bitmap); … … 280 280 case CACA_KEY_CTRL_Z: 281 281 case CACA_KEY_ESCAPE: return; 282 case ' ': pause = !pause;282 case ' ': paused = !paused; 283 283 } 284 284 } -
libcaca/trunk/src/cacademo.c
r2299 r2304 73 73 static cucul_canvas_t *frontcv, *backcv, *mask; 74 74 75 int demo, next = -1, pause = 0, next_transition = DEMO_FRAMES;75 int demo, next = -1, paused = 0, next_transition = DEMO_FRAMES; 76 76 unsigned int i; 77 77 int tmode = cucul_rand(0, TRANSITION_COUNT); … … 118 118 goto end; 119 119 case ' ': 120 pause = !pause;120 paused = !paused; 121 121 break; 122 122 case '\r': … … 133 133 cucul_get_canvas_height(frontcv)); 134 134 135 if(pause )136 goto paused;135 if(paused) 136 goto _paused; 137 137 138 138 /* Update demo's data */ … … 160 160 161 161 frame++; 162 paused:162 _paused: 163 163 /* Render main demo's canvas */ 164 164 fn[demo](RENDER, frontcv);
Note: See TracChangeset
for help on using the changeset viewer.