* Use size_t and ssize_t where appropriate.tags/v0.99.beta14
@@ -420,7 +420,8 @@ static int ncurses_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||||
int keys[7]; /* Necessary for ungetch(); */ | int keys[7]; /* Necessary for ungetch(); */ | ||||
char utf8[7]; | char utf8[7]; | ||||
uint32_t utf32; | uint32_t utf32; | ||||
unsigned int i, bytes = 0; | |||||
unsigned int i; | |||||
size_t bytes = 0; | |||||
keys[0] = intkey; | keys[0] = intkey; | ||||
utf8[0] = intkey; | utf8[0] = intkey; | ||||
@@ -328,7 +328,8 @@ static int slang_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||||
int keys[7]; /* Necessary for ungetkey(); */ | int keys[7]; /* Necessary for ungetkey(); */ | ||||
char utf8[7]; | char utf8[7]; | ||||
uint32_t utf32; | uint32_t utf32; | ||||
unsigned int i, bytes = 0; | |||||
unsigned int i; | |||||
size_t bytes = 0; | |||||
keys[0] = intkey; | keys[0] = intkey; | ||||
utf8[0] = intkey; | utf8[0] = intkey; | ||||
@@ -219,7 +219,7 @@ uint32_t cucul_get_char(cucul_canvas_t const *cv, int x, int y) | |||||
*/ | */ | ||||
int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) | int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) | ||||
{ | { | ||||
unsigned int rd; | |||||
size_t rd; | |||||
if(y < 0 || y >= (int)cv->height || x >= (int)cv->width) | if(y < 0 || y >= (int)cv->height || x >= (int)cv->width) | ||||
return 0; | return 0; | ||||
@@ -111,9 +111,9 @@ static uint32_t const cp437_lookup2[] = | |||||
* \return The corresponding UTF-32 character, or zero if the character | * \return The corresponding UTF-32 character, or zero if the character | ||||
* is incomplete. | * is incomplete. | ||||
*/ | */ | ||||
uint32_t cucul_utf8_to_utf32(char const *s, unsigned int *read) | |||||
uint32_t cucul_utf8_to_utf32(char const *s, size_t *bytes) | |||||
{ | { | ||||
unsigned int bytes = trailing[(int)(unsigned char)*s]; | |||||
unsigned int todo = trailing[(int)(unsigned char)*s]; | |||||
unsigned int i = 0; | unsigned int i = 0; | ||||
uint32_t ret = 0; | uint32_t ret = 0; | ||||
@@ -121,18 +121,18 @@ uint32_t cucul_utf8_to_utf32(char const *s, unsigned int *read) | |||||
{ | { | ||||
if(!*s) | if(!*s) | ||||
{ | { | ||||
if(read) | |||||
*read = 0; | |||||
if(bytes) | |||||
*bytes = 0; | |||||
return 0; | return 0; | ||||
} | } | ||||
ret += ((uint32_t)(unsigned char)*s++) << (6 * (bytes - i)); | |||||
ret += ((uint32_t)(unsigned char)*s++) << (6 * (todo - i)); | |||||
if(bytes == i++) | |||||
if(todo == i++) | |||||
{ | { | ||||
if(read) | |||||
*read = i; | |||||
return ret - offsets[bytes]; | |||||
if(bytes) | |||||
*bytes = i; | |||||
return ret - offsets[todo]; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -150,7 +150,7 @@ uint32_t cucul_utf8_to_utf32(char const *s, unsigned int *read) | |||||
* \param ch The UTF-32 character. | * \param ch The UTF-32 character. | ||||
* \return The number of bytes written. | * \return The number of bytes written. | ||||
*/ | */ | ||||
unsigned int cucul_utf32_to_utf8(char *buf, uint32_t ch) | |||||
size_t cucul_utf32_to_utf8(char *buf, uint32_t ch) | |||||
{ | { | ||||
static const uint8_t mark[7] = | static const uint8_t mark[7] = | ||||
{ | { | ||||
@@ -158,7 +158,7 @@ unsigned int cucul_utf32_to_utf8(char *buf, uint32_t ch) | |||||
}; | }; | ||||
char *parser = buf; | char *parser = buf; | ||||
int bytes; | |||||
size_t bytes; | |||||
if(ch < 0x80) | if(ch < 0x80) | ||||
{ | { | ||||
@@ -162,8 +162,8 @@ __extern void cucul_attr_to_argb64(uint32_t, uint8_t[8]); | |||||
* These functions perform conversions between usual character sets. | * These functions perform conversions between usual character sets. | ||||
* | * | ||||
* @{ */ | * @{ */ | ||||
__extern uint32_t cucul_utf8_to_utf32(char const *, unsigned int *); | |||||
__extern unsigned int cucul_utf32_to_utf8(char *, uint32_t); | |||||
__extern uint32_t cucul_utf8_to_utf32(char const *, size_t *); | |||||
__extern size_t cucul_utf32_to_utf8(char *, uint32_t); | |||||
__extern uint8_t cucul_utf32_to_cp437(uint32_t); | __extern uint8_t cucul_utf32_to_cp437(uint32_t); | ||||
__extern uint32_t cucul_cp437_to_utf32(uint8_t); | __extern uint32_t cucul_cp437_to_utf32(uint8_t); | ||||
__extern char cucul_utf32_to_ascii(uint32_t); | __extern char cucul_utf32_to_ascii(uint32_t); | ||||
@@ -288,13 +288,13 @@ __extern int cucul_put_figchar(cucul_canvas_t *, uint32_t); | |||||
* the current canvas to various text formats. | * the current canvas to various text formats. | ||||
* | * | ||||
* @{ */ | * @{ */ | ||||
__extern long int cucul_import_memory(cucul_canvas_t *, void const *, | |||||
unsigned long int, char const *); | |||||
__extern long int cucul_import_file(cucul_canvas_t *, char const *, | |||||
char const *); | |||||
__extern ssize_t cucul_import_memory(cucul_canvas_t *, void const *, | |||||
size_t, char const *); | |||||
__extern ssize_t cucul_import_file(cucul_canvas_t *, char const *, | |||||
char const *); | |||||
__extern char const * const * cucul_get_import_list(void); | __extern char const * const * cucul_get_import_list(void); | ||||
__extern void *cucul_export_memory(cucul_canvas_t const *, char const *, | __extern void *cucul_export_memory(cucul_canvas_t const *, char const *, | ||||
unsigned long int *); | |||||
size_t *); | |||||
__extern char const * const * cucul_get_export_list(void); | __extern char const * const * cucul_get_export_list(void); | ||||
/* @} */ | /* @} */ | ||||
@@ -37,10 +37,12 @@ | |||||
typedef signed char int8_t; | typedef signed char int8_t; | ||||
typedef signed short int16_t; | typedef signed short int16_t; | ||||
typedef signed long int int32_t; | typedef signed long int int32_t; | ||||
typedef signed long long int int64_t; | |||||
typedef unsigned char uint8_t; | typedef unsigned char uint8_t; | ||||
typedef unsigned short uint16_t; | typedef unsigned short uint16_t; | ||||
typedef unsigned long int uint32_t; | typedef unsigned long int uint32_t; | ||||
typedef unsigned long long int uint64_t; | |||||
typedef long int intptr_t; | typedef long int intptr_t; | ||||
typedef unsigned long int uintptr_t; | typedef unsigned long int uintptr_t; | ||||
@@ -44,16 +44,16 @@ static inline int sprintu16(char *s, uint16_t x) | |||||
return 2; | return 2; | ||||
} | } | ||||
static void *export_caca(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_ansi(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_utf8(cucul_canvas_t const *, unsigned long int *, int); | |||||
static void *export_html(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_html3(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_bbfr(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_irc(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_ps(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_svg(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_tga(cucul_canvas_t const *, unsigned long int *); | |||||
static void *export_caca(cucul_canvas_t const *, size_t *); | |||||
static void *export_ansi(cucul_canvas_t const *, size_t *); | |||||
static void *export_utf8(cucul_canvas_t const *, size_t *, int); | |||||
static void *export_html(cucul_canvas_t const *, size_t *); | |||||
static void *export_html3(cucul_canvas_t const *, size_t *); | |||||
static void *export_bbfr(cucul_canvas_t const *, size_t *); | |||||
static void *export_irc(cucul_canvas_t const *, size_t *); | |||||
static void *export_ps(cucul_canvas_t const *, size_t *); | |||||
static void *export_svg(cucul_canvas_t const *, size_t *); | |||||
static void *export_tga(cucul_canvas_t const *, size_t *); | |||||
/** \brief Export a canvas into a foreign format. | /** \brief Export a canvas into a foreign format. | ||||
* | * | ||||
@@ -78,12 +78,12 @@ static void *export_tga(cucul_canvas_t const *, unsigned long int *); | |||||
* | * | ||||
* \param cv A libcucul canvas | * \param cv A libcucul canvas | ||||
* \param format A string describing the requested output format. | * \param format A string describing the requested output format. | ||||
* \param bytes A pointer to an unsigned long integer where the number of | |||||
* allocated bytes will be written. | |||||
* \param bytes A pointer to a size_t where the number of allocated bytes | |||||
* will be written. | |||||
* \return A pointer to the exported memory area, or NULL in case of error. | * \return A pointer to the exported memory area, or NULL in case of error. | ||||
*/ | */ | ||||
void *cucul_export_memory(cucul_canvas_t const *cv, char const *format, | void *cucul_export_memory(cucul_canvas_t const *cv, char const *format, | ||||
unsigned long int *bytes) | |||||
size_t *bytes) | |||||
{ | { | ||||
if(!strcasecmp("caca", format)) | if(!strcasecmp("caca", format)) | ||||
return export_caca(cv, bytes); | return export_caca(cv, bytes); | ||||
@@ -159,7 +159,7 @@ char const * const * cucul_get_export_list(void) | |||||
*/ | */ | ||||
/* Generate a native libcaca canvas file. */ | /* Generate a native libcaca canvas file. */ | ||||
static void *export_caca(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_caca(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
char *data, *cur; | char *data, *cur; | ||||
unsigned int f, n; | unsigned int f, n; | ||||
@@ -212,7 +212,7 @@ static void *export_caca(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Generate UTF-8 representation of current canvas. */ | /* Generate UTF-8 representation of current canvas. */ | ||||
static void *export_utf8(cucul_canvas_t const *cv, unsigned long int *bytes, | |||||
static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, | |||||
int cr) | int cr) | ||||
{ | { | ||||
static uint8_t const palette[] = | static uint8_t const palette[] = | ||||
@@ -293,7 +293,7 @@ static void *export_utf8(cucul_canvas_t const *cv, unsigned long int *bytes, | |||||
} | } | ||||
/* Generate ANSI representation of current canvas. */ | /* Generate ANSI representation of current canvas. */ | ||||
static void *export_ansi(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
static uint8_t const palette[] = | static uint8_t const palette[] = | ||||
{ | { | ||||
@@ -373,7 +373,7 @@ static void *export_ansi(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Generate HTML representation of current canvas. */ | /* Generate HTML representation of current canvas. */ | ||||
static void *export_html(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
char *data, *cur; | char *data, *cur; | ||||
unsigned int x, y, len; | unsigned int x, y, len; | ||||
@@ -455,7 +455,7 @@ static void *export_html(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
* but permits viewing in old browsers (or limited ones such as links). It | * but permits viewing in old browsers (or limited ones such as links). It | ||||
* will not work under gecko (mozilla rendering engine) unless you set a | * will not work under gecko (mozilla rendering engine) unless you set a | ||||
* correct header. */ | * correct header. */ | ||||
static void *export_html3(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
char *data, *cur; | char *data, *cur; | ||||
unsigned int x, y, len; | unsigned int x, y, len; | ||||
@@ -556,7 +556,7 @@ static void *export_html3(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
return data; | return data; | ||||
} | } | ||||
static void *export_bbfr(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_bbfr(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
char *data, *cur; | char *data, *cur; | ||||
unsigned int x, y, len; | unsigned int x, y, len; | ||||
@@ -657,7 +657,7 @@ static void *export_bbfr(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Export a text file with IRC colours */ | /* Export a text file with IRC colours */ | ||||
static void *export_irc(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
static uint8_t const palette[] = | static uint8_t const palette[] = | ||||
{ | { | ||||
@@ -764,7 +764,7 @@ static void *export_irc(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Export a PostScript document. */ | /* Export a PostScript document. */ | ||||
static void *export_ps(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
static char const *ps_header = | static char const *ps_header = | ||||
"%!\n" | "%!\n" | ||||
@@ -873,7 +873,7 @@ static void *export_ps(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Export an SVG vector image */ | /* Export an SVG vector image */ | ||||
static void *export_svg(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
static char const svg_header[] = | static char const svg_header[] = | ||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | ||||
@@ -959,7 +959,7 @@ static void *export_svg(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
} | } | ||||
/* Export a TGA image */ | /* Export a TGA image */ | ||||
static void *export_tga(cucul_canvas_t const *cv, unsigned long int *bytes) | |||||
static void *export_tga(cucul_canvas_t const *cv, size_t *bytes) | |||||
{ | { | ||||
char const * const *fontlist; | char const * const *fontlist; | ||||
char *data, *cur; | char *data, *cur; | ||||
@@ -52,9 +52,9 @@ struct import | |||||
uint8_t faint, strike, proportional; /* unsupported */ | uint8_t faint, strike, proportional; /* unsupported */ | ||||
}; | }; | ||||
static long int import_caca(cucul_canvas_t *, void const *, unsigned int); | |||||
static long int import_text(cucul_canvas_t *, void const *, unsigned int); | |||||
static long int import_ansi(cucul_canvas_t *, void const *, unsigned int, int); | |||||
static ssize_t import_caca(cucul_canvas_t *, void const *, size_t); | |||||
static ssize_t import_text(cucul_canvas_t *, void const *, size_t); | |||||
static ssize_t import_ansi(cucul_canvas_t *, void const *, size_t, int); | |||||
static void ansi_parse_grcm(cucul_canvas_t *, struct import *, | static void ansi_parse_grcm(cucul_canvas_t *, struct import *, | ||||
unsigned int, unsigned int const *); | unsigned int, unsigned int const *); | ||||
@@ -86,8 +86,8 @@ static void ansi_parse_grcm(cucul_canvas_t *, struct import *, | |||||
* \return The number of bytes read, or 0 if there was not enough data, | * \return The number of bytes read, or 0 if there was not enough data, | ||||
* or -1 if an error occurred. | * or -1 if an error occurred. | ||||
*/ | */ | ||||
long int cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||||
unsigned long int len, char const *format) | |||||
ssize_t cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||||
size_t len, char const *format) | |||||
{ | { | ||||
if(!strcasecmp("caca", format)) | if(!strcasecmp("caca", format)) | ||||
return import_caca(cv, data, len); | return import_caca(cv, data, len); | ||||
@@ -151,8 +151,8 @@ long int cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||||
* \return The number of bytes read, or 0 if there was not enough data, | * \return The number of bytes read, or 0 if there was not enough data, | ||||
* or -1 if an error occurred. | * or -1 if an error occurred. | ||||
*/ | */ | ||||
long int cucul_import_file(cucul_canvas_t *cv, char const *filename, | |||||
char const *format) | |||||
ssize_t cucul_import_file(cucul_canvas_t *cv, char const *filename, | |||||
char const *format) | |||||
{ | { | ||||
#if defined __KERNEL__ | #if defined __KERNEL__ | ||||
seterrno(ENOSYS); | seterrno(ENOSYS); | ||||
@@ -160,7 +160,7 @@ long int cucul_import_file(cucul_canvas_t *cv, char const *filename, | |||||
#else | #else | ||||
FILE *fp; | FILE *fp; | ||||
void *data; | void *data; | ||||
long int size; | |||||
ssize_t size; | |||||
int ret; | int ret; | ||||
fp = fopen(filename, "rb"); | fp = fopen(filename, "rb"); | ||||
@@ -219,8 +219,7 @@ char const * const * cucul_get_import_list(void) | |||||
* XXX: the following functions are local. | * XXX: the following functions are local. | ||||
*/ | */ | ||||
static long int import_caca(cucul_canvas_t *cv, | |||||
void const *data, unsigned int size) | |||||
static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||||
{ | { | ||||
uint8_t const *buf = (uint8_t const *)data; | uint8_t const *buf = (uint8_t const *)data; | ||||
unsigned int control_size, data_size, expected_size, frames, f, n; | unsigned int control_size, data_size, expected_size, frames, f, n; | ||||
@@ -337,8 +336,7 @@ invalid_caca: | |||||
return -1; | return -1; | ||||
} | } | ||||
static long int import_text(cucul_canvas_t *cv, | |||||
void const *data, unsigned int size) | |||||
static ssize_t import_text(cucul_canvas_t *cv, void const *data, size_t size) | |||||
{ | { | ||||
char const *text = (char const *)data; | char const *text = (char const *)data; | ||||
unsigned int width = 0, height = 0, x = 0, y = 0, i; | unsigned int width = 0, height = 0, x = 0, y = 0, i; | ||||
@@ -380,8 +378,8 @@ static long int import_text(cucul_canvas_t *cv, | |||||
return size; | return size; | ||||
} | } | ||||
static long int import_ansi(cucul_canvas_t *cv, | |||||
void const *data, unsigned int size, int utf8) | |||||
static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||||
size_t size, int utf8) | |||||
{ | { | ||||
struct import im; | struct import im; | ||||
unsigned char const *buffer = (unsigned char const*)data; | unsigned char const *buffer = (unsigned char const*)data; | ||||
@@ -682,7 +680,7 @@ static long int import_ansi(cucul_canvas_t *cv, | |||||
/* Get the character we’re going to paste */ | /* Get the character we’re going to paste */ | ||||
else if(utf8) | else if(utf8) | ||||
{ | { | ||||
unsigned int bytes; | |||||
size_t bytes; | |||||
if(i + 6 < size) | if(i + 6 < size) | ||||
ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); | ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); | ||||
@@ -25,11 +25,11 @@ | |||||
#include "cucul++.h" | #include "cucul++.h" | ||||
uint32_t Charset::utf8ToUtf32(char const *s, unsigned int *read) | |||||
uint32_t Charset::utf8ToUtf32(char const *s, size_t *read) | |||||
{ | { | ||||
return cucul_utf8_to_utf32(s, read); | return cucul_utf8_to_utf32(s, read); | ||||
} | } | ||||
unsigned int Charset::utf32ToUtf8(char *buf, uint32_t ch) | |||||
size_t Charset::utf32ToUtf8(char *buf, uint32_t ch) | |||||
{ | { | ||||
return cucul_utf32_to_utf8(buf, ch); | return cucul_utf32_to_utf8(buf, ch); | ||||
} | } | ||||
@@ -38,8 +38,8 @@ class Cucul; | |||||
__class Charset | __class Charset | ||||
{ | { | ||||
public: | public: | ||||
uint32_t utf8ToUtf32(char const *, unsigned int *); | |||||
unsigned int utf32ToUtf8(char *, uint32_t); | |||||
uint32_t utf8ToUtf32(char const *, size_t *); | |||||
size_t utf32ToUtf8(char *, uint32_t); | |||||
uint8_t utf32ToCp437(uint32_t); | uint8_t utf32ToCp437(uint32_t); | ||||
uint32_t cp437ToUtf32(uint8_t); | uint32_t cp437ToUtf32(uint8_t); | ||||
}; | }; | ||||
@@ -23,12 +23,12 @@ | |||||
int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||||
{ | { | ||||
unsigned long int const *blocks; | |||||
uint32_t const *blocks; | |||||
cucul_font_t *f; | cucul_font_t *f; | ||||
char const * const * fonts; | char const * const * fonts; | ||||
cucul_canvas_t *cv; | cucul_canvas_t *cv; | ||||
void *buffer; | void *buffer; | ||||
unsigned long int len; | |||||
size_t len; | |||||
unsigned int i, j, x, y, cells, width; | unsigned int i, j, x, y, cells, width; | ||||
fonts = cucul_get_font_list(); | fonts = cucul_get_font_list(); | ||||
@@ -45,7 +45,7 @@ static caca_display_t *dp; | |||||
static int XSIZ, YSIZ; | static int XSIZ, YSIZ; | ||||
static cucul_dither_t *cucul_dither; | static cucul_dither_t *cucul_dither; | ||||
static char *bitmap; | static char *bitmap; | ||||
static int pause = 0; | |||||
static int paused = 0; | |||||
#else | #else | ||||
static aa_context *context; | static aa_context *context; | ||||
static aa_renderparams *params; | static aa_renderparams *params; | ||||
@@ -212,8 +212,8 @@ drawfire (void) | |||||
#ifndef LIBCACA | #ifndef LIBCACA | ||||
char *bitmap = aa_image (context); | char *bitmap = aa_image (context); | ||||
#else | #else | ||||
if(pause) | |||||
goto paused; | |||||
if(paused) | |||||
goto _paused; | |||||
#endif | #endif | ||||
height++; | height++; | ||||
@@ -237,7 +237,7 @@ drawfire (void) | |||||
i = 0; | i = 0; | ||||
firemain (); | firemain (); | ||||
#ifdef LIBCACA | #ifdef LIBCACA | ||||
paused: | |||||
_paused: | |||||
cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | ||||
cucul_get_canvas_height(cv), cucul_dither, bitmap); | cucul_get_canvas_height(cv), cucul_dither, bitmap); | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | ||||
@@ -279,7 +279,7 @@ game (void) | |||||
case CACA_KEY_CTRL_C: | case CACA_KEY_CTRL_C: | ||||
case CACA_KEY_CTRL_Z: | case CACA_KEY_CTRL_Z: | ||||
case CACA_KEY_ESCAPE: return; | case CACA_KEY_ESCAPE: return; | ||||
case ' ': pause = !pause; | |||||
case ' ': paused = !paused; | |||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
@@ -72,7 +72,7 @@ int main(int argc, char **argv) | |||||
static caca_display_t *dp; | static caca_display_t *dp; | ||||
static cucul_canvas_t *frontcv, *backcv, *mask; | static cucul_canvas_t *frontcv, *backcv, *mask; | ||||
int demo, next = -1, pause = 0, next_transition = DEMO_FRAMES; | |||||
int demo, next = -1, paused = 0, next_transition = DEMO_FRAMES; | |||||
unsigned int i; | unsigned int i; | ||||
int tmode = cucul_rand(0, TRANSITION_COUNT); | int tmode = cucul_rand(0, TRANSITION_COUNT); | ||||
@@ -117,7 +117,7 @@ int main(int argc, char **argv) | |||||
case CACA_KEY_CTRL_Z: | case CACA_KEY_CTRL_Z: | ||||
goto end; | goto end; | ||||
case ' ': | case ' ': | ||||
pause = !pause; | |||||
paused = !paused; | |||||
break; | break; | ||||
case '\r': | case '\r': | ||||
if(next == -1) | if(next == -1) | ||||
@@ -132,8 +132,8 @@ int main(int argc, char **argv) | |||||
cucul_set_canvas_size(mask, cucul_get_canvas_width(frontcv), | cucul_set_canvas_size(mask, cucul_get_canvas_width(frontcv), | ||||
cucul_get_canvas_height(frontcv)); | cucul_get_canvas_height(frontcv)); | ||||
if(pause) | |||||
goto paused; | |||||
if(paused) | |||||
goto _paused; | |||||
/* Update demo's data */ | /* Update demo's data */ | ||||
fn[demo](UPDATE, frontcv); | fn[demo](UPDATE, frontcv); | ||||
@@ -159,7 +159,7 @@ int main(int argc, char **argv) | |||||
fn[next](UPDATE, backcv); | fn[next](UPDATE, backcv); | ||||
frame++; | frame++; | ||||
paused: | |||||
_paused: | |||||
/* Render main demo's canvas */ | /* Render main demo's canvas */ | ||||
fn[demo](RENDER, frontcv); | fn[demo](RENDER, frontcv); | ||||