diff --git a/caca/caca.h b/caca/caca.h index b5920b9..d3a4b31 100644 --- a/caca/caca.h +++ b/caca/caca.h @@ -83,7 +83,7 @@ struct caca_event struct { unsigned int w, h; } resize; struct { unsigned int ch; unsigned long int utf32; char utf8[8]; } key; } data; - unsigned char padding[16]; + uint8_t padding[16]; }; /** \brief Special key values. diff --git a/caca/driver_conio.c b/caca/driver_conio.c index c98fe69..4462e2b 100644 --- a/caca/driver_conio.c +++ b/caca/driver_conio.c @@ -135,7 +135,7 @@ static void conio_handle_resize(caca_display_t *dp) static int conio_get_event(caca_display_t *dp, caca_privevent_t *ev) { - unsigned char ch; + uint8_t ch; caca_privevent_t release; if(!_conio_kbhit()) @@ -148,7 +148,7 @@ static int conio_get_event(caca_display_t *dp, caca_privevent_t *ev) ev->type = CACA_EVENT_KEY_PRESS; ev->data.key.ch = ch; - ev->data.key.utf32 = (uint32_t)ch; + ev->data.key.utf32 = ch; ev->data.key.utf8[0] = ch; ev->data.key.utf8[1] = '\0'; diff --git a/caca/driver_gl.c b/caca/driver_gl.c index 55d995d..5063226 100644 --- a/caca/driver_gl.c +++ b/caca/driver_gl.c @@ -70,13 +70,13 @@ struct driver_private float incx, incy; unsigned long int const *blocks; int *txid; - unsigned char close; - unsigned char bit; - unsigned char mouse_changed, mouse_clicked; + uint8_t close; + uint8_t bit; + uint8_t mouse_changed, mouse_clicked; unsigned int mouse_x, mouse_y; unsigned int mouse_button, mouse_state; - unsigned char key; + uint8_t key; int special_key; float sw, sh; diff --git a/cucul/attr.c b/cucul/attr.c index 1ff8b6b..fd40f0c 100644 --- a/cucul/attr.c +++ b/cucul/attr.c @@ -181,7 +181,7 @@ int cucul_put_attr(cucul_canvas_t *cv, int x, int y, unsigned long int attr) * \param bg The requested ANSI background colour. * \return 0 in case of success, -1 if an error occurred. */ -int cucul_set_color_ansi(cucul_canvas_t *cv, unsigned char fg, unsigned char bg) +int cucul_set_color_ansi(cucul_canvas_t *cv, uint8_t fg, uint8_t bg) { uint32_t attr; @@ -257,7 +257,7 @@ int cucul_set_color_argb(cucul_canvas_t *cv, unsigned int fg, unsigned int bg) * \param attr The requested attribute value. * \return The corresponding DOS ANSI value. */ -unsigned char cucul_attr_to_ansi(unsigned long int attr) +uint8_t cucul_attr_to_ansi(unsigned long int attr) { uint8_t fg = nearest_ansi((attr >> 4) & 0x3fff); uint8_t bg = nearest_ansi(attr >> 18); @@ -281,7 +281,7 @@ unsigned char cucul_attr_to_ansi(unsigned long int attr) * \param attr The requested attribute value. * \return The corresponding ANSI foreground value. */ -unsigned char cucul_attr_to_ansi_fg(unsigned long int attr) +uint8_t cucul_attr_to_ansi_fg(unsigned long int attr) { return nearest_ansi(((uint16_t)attr >> 4) & 0x3fff); } @@ -301,7 +301,7 @@ unsigned char cucul_attr_to_ansi_fg(unsigned long int attr) * \param attr The requested attribute value. * \return The corresponding ANSI background value. */ -unsigned char cucul_attr_to_ansi_bg(unsigned long int attr) +uint8_t cucul_attr_to_ansi_bg(unsigned long int attr) { return nearest_ansi(attr >> 18); } @@ -387,7 +387,7 @@ unsigned int cucul_attr_to_rgb12_bg(unsigned long int attr) * \param attr The requested attribute value. * \param argb An array of 8-bit integers. */ -void cucul_attr_to_argb64(unsigned long int attr, unsigned char argb[8]) +void cucul_attr_to_argb64(unsigned long int attr, uint8_t argb[8]) { uint16_t fg = (attr >> 4) & 0x3fff; uint16_t bg = attr >> 18; diff --git a/cucul/charset.c b/cucul/charset.c index 65e0c5f..55a32d7 100644 --- a/cucul/charset.c +++ b/cucul/charset.c @@ -190,7 +190,7 @@ unsigned int cucul_utf32_to_utf8(char *buf, unsigned long int ch) * \param ch The UTF-32 character. * \return The corresponding CP437 character, or "?" if not representable. */ -unsigned char cucul_utf32_to_cp437(unsigned long int ch) +uint8_t cucul_utf32_to_cp437(unsigned long int ch) { unsigned int i; @@ -222,7 +222,7 @@ unsigned char cucul_utf32_to_cp437(unsigned long int ch) * \param ch The CP437 character. * \return The corresponding UTF-32 character, or zero if not representable. */ -unsigned long int cucul_cp437_to_utf32(unsigned char ch) +unsigned long int cucul_cp437_to_utf32(uint8_t ch) { if(ch > 0x7f) return cp437_lookup2[ch - 0x7f]; diff --git a/cucul/cucul.c b/cucul/cucul.c index 3554eef..fb2c55b 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -254,9 +254,9 @@ unsigned int cucul_get_canvas_height(cucul_canvas_t const *cv) * \param cv A libcucul canvas. * \return The canvas character array. */ -unsigned char const * cucul_get_canvas_chars(cucul_canvas_t const *cv) +uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *cv) { - return (unsigned char const *)cv->chars; + return (uint8_t const *)cv->chars; } /** \brief Get the canvas attribute array. @@ -273,9 +273,9 @@ unsigned char const * cucul_get_canvas_chars(cucul_canvas_t const *cv) * \param cv A libcucul canvas. * \return The canvas attribute array. */ -unsigned char const * cucul_get_canvas_attrs(cucul_canvas_t const *cv) +uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *cv) { - return (unsigned char const *)cv->attrs; + return (uint8_t const *)cv->attrs; } /** \brief Uninitialise \e libcucul. diff --git a/cucul/cucul.h b/cucul/cucul.h index 7f52398..d54a458 100644 --- a/cucul/cucul.h +++ b/cucul/cucul.h @@ -93,8 +93,8 @@ __extern int cucul_set_canvas_size(cucul_canvas_t *, unsigned int, unsigned int); __extern unsigned int cucul_get_canvas_width(cucul_canvas_t const *); __extern unsigned int cucul_get_canvas_height(cucul_canvas_t const *); -__extern unsigned char const * cucul_get_canvas_chars(cucul_canvas_t const *); -__extern unsigned char const * cucul_get_canvas_attrs(cucul_canvas_t const *); +__extern uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *); +__extern uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *); __extern int cucul_free_canvas(cucul_canvas_t *); __extern int cucul_rand(int, int); __extern char const * cucul_get_version(void); @@ -116,8 +116,7 @@ __extern int cucul_put_str(cucul_canvas_t *, int, int, char const *); __extern unsigned long int cucul_get_attr(cucul_canvas_t const *, int, int); __extern int cucul_set_attr(cucul_canvas_t *, unsigned long int); __extern int cucul_put_attr(cucul_canvas_t *, int, int, unsigned long int); -__extern int cucul_set_color_ansi(cucul_canvas_t *, unsigned char, - unsigned char); +__extern int cucul_set_color_ansi(cucul_canvas_t *, uint8_t, uint8_t); __extern int cucul_set_color_argb(cucul_canvas_t *, unsigned int, unsigned int); __extern int cucul_printf(cucul_canvas_t *, int, int, char const *, ...); @@ -151,12 +150,12 @@ __extern int cucul_stretch_right(cucul_canvas_t *); * These functions perform conversions between attribute values. * * @{ */ -__extern unsigned char cucul_attr_to_ansi(unsigned long int); -__extern unsigned char cucul_attr_to_ansi_fg(unsigned long int); -__extern unsigned char cucul_attr_to_ansi_bg(unsigned long int); +__extern uint8_t cucul_attr_to_ansi(unsigned long int); +__extern uint8_t cucul_attr_to_ansi_fg(unsigned long int); +__extern uint8_t cucul_attr_to_ansi_bg(unsigned long int); __extern unsigned int cucul_attr_to_rgb12_fg(unsigned long int); __extern unsigned int cucul_attr_to_rgb12_bg(unsigned long int); -__extern void cucul_attr_to_argb64(unsigned long int, unsigned char[8]); +__extern void cucul_attr_to_argb64(unsigned long int, uint8_t[8]); /* @} */ /** \defgroup cucul_charset libcucul character set conversions @@ -166,8 +165,8 @@ __extern void cucul_attr_to_argb64(unsigned long int, unsigned char[8]); * @{ */ __extern unsigned long int cucul_utf8_to_utf32(char const *, unsigned int *); __extern unsigned int cucul_utf32_to_utf8(char *, unsigned long int); -__extern unsigned char cucul_utf32_to_cp437(unsigned long int); -__extern unsigned long int cucul_cp437_to_utf32(unsigned char); +__extern uint8_t cucul_utf32_to_cp437(unsigned long int); +__extern unsigned long int cucul_cp437_to_utf32(uint8_t); __extern char cucul_utf32_to_ascii(unsigned long int); __extern int cucul_utf32_is_fullwidth(unsigned long int); /* @} */ diff --git a/cucul/dither.c b/cucul/dither.c index b4d5f83..95f8491 100644 --- a/cucul/dither.c +++ b/cucul/dither.c @@ -41,7 +41,7 @@ # define LOOKUP_SAT 32 # define LOOKUP_HUE 16 #endif -static unsigned char hsv_distances[LOOKUP_VAL][LOOKUP_SAT][LOOKUP_HUE]; +static uint8_t hsv_distances[LOOKUP_VAL][LOOKUP_SAT][LOOKUP_HUE]; static uint16_t lookup_colors[8]; static int lookup_initialised = 0; @@ -1531,7 +1531,7 @@ static int init_lookup(void) { int i, distbg, distfg, dist; int val, sat, hue; - unsigned char outbg, outfg; + uint8_t outbg, outfg; val = 0xfff * v / (LOOKUP_VAL - 1); sat = 0xfff * s / (LOOKUP_SAT - 1); diff --git a/cucul/export.c b/cucul/export.c index 34c5e74..bf49c62 100644 --- a/cucul/export.c +++ b/cucul/export.c @@ -429,8 +429,7 @@ static void *export_html(cucul_canvas_t const *cv, unsigned long int *bytes) else if(linechar[x + len] <= 0x00000020) cur += sprintf(cur, " "); else if(linechar[x + len] < 0x00000080) - cur += sprintf(cur, "%c", - (unsigned char)linechar[x + len]); + cur += sprintf(cur, "%c", (uint8_t)linechar[x + len]); else cur += sprintf(cur, "&#%i;", (unsigned int)linechar[x + len]); @@ -524,7 +523,7 @@ static void *export_html3(cucul_canvas_t const *cv, unsigned long int *bytes) else if(linechar[x + i] <= 0x00000020) cur += sprintf(cur, " "); else if(linechar[x + i] < 0x00000080) - cur += sprintf(cur, "%c", (unsigned char)linechar[x + i]); + cur += sprintf(cur, "%c", (uint8_t)linechar[x + i]); else cur += sprintf(cur, "&#%i;", (unsigned int)linechar[x + i]); } @@ -853,10 +852,10 @@ static void *export_ps(cucul_canvas_t const *cv, unsigned long int *bytes) case '\\': case '(': case ')': - cur += sprintf(cur, "(\\%c) show\n", (unsigned char)ch); + cur += sprintf(cur, "(\\%c) show\n", (uint8_t)ch); break; default: - cur += sprintf(cur, "(%c) show\n", (unsigned char)ch); + cur += sprintf(cur, "(%c) show\n", (uint8_t)ch); break; } } diff --git a/cucul/file.c b/cucul/file.c index 91601a2..8553e40 100644 --- a/cucul/file.c +++ b/cucul/file.c @@ -40,7 +40,7 @@ static int zipread(cucul_file_t *, void *, unsigned int); struct cucul_file { # if defined HAVE_ZLIB_H - unsigned char read_buffer[READSIZE]; + uint8_t read_buffer[READSIZE]; z_stream stream; gzFile gz; int eof, zip; diff --git a/examples/font.c b/examples/font.c index 71184a2..57892c5 100644 --- a/examples/font.c +++ b/examples/font.c @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) caca_display_t *dp; cucul_font_t *f; cucul_dither_t *d; - unsigned char *buf; + uint8_t *buf; unsigned int w, h; char const * const * fonts; diff --git a/examples/swallow.c b/examples/swallow.c index be993cf..25ca9c9 100644 --- a/examples/swallow.c +++ b/examples/swallow.c @@ -28,7 +28,7 @@ int main(int argc, char **argv) char cmd[BUFSIZ]; static cucul_canvas_t *cv, *app; static caca_display_t *dp; - unsigned char *buf[4]; + uint8_t *buf[4]; long int bytes[4], total[4]; FILE *f[4]; int w, h, i; diff --git a/kernel/kernel.c b/kernel/kernel.c index a737904..c18190a 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -190,7 +190,7 @@ int strcasecmp(const char *s1, const char *s2) int memcmp(const void *_s1, const void *_s2, size_t n) { - unsigned char const *s1 = _s1, *s2 = _s2; + uint8_t const *s1 = _s1, *s2 = _s2; while(n--) { diff --git a/src/cacaplay.c b/src/cacaplay.c index 38fea93..24a22da 100644 --- a/src/cacaplay.c +++ b/src/cacaplay.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) { cucul_canvas_t *cv, *app; caca_display_t *dp; - unsigned char *buf = NULL; + uint8_t *buf = NULL; long int bytes = 0, total = 0; int fd; diff --git a/src/cacaserver.c b/src/cacaserver.c index 51100f7..ffe3de9 100644 --- a/src/cacaserver.c +++ b/src/cacaserver.c @@ -149,10 +149,10 @@ int main(void) /* FIXME, handle >255 sizes */ memcpy(server->prefix, INIT_PREFIX, sizeof(INIT_PREFIX)); tmp = strstr(server->prefix, "____"); - tmp[0] = (unsigned char) (server->width & 0xff00) >> 8; - tmp[1] = (unsigned char) server->width & 0xff; - tmp[2] = (unsigned char) (server->height & 0xff00) >> 8; - tmp[3] = (unsigned char) server->height & 0xff; + tmp[0] = (uint8_t) (server->width & 0xff00) >> 8; + tmp[1] = (uint8_t) server->width & 0xff; + tmp[2] = (uint8_t) (server->height & 0xff00) >> 8; + tmp[3] = (uint8_t) server->height & 0xff; if((server->sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { diff --git a/src/common-image.c b/src/common-image.c index 53a74a1..a2d6f43 100644 --- a/src/common-image.c +++ b/src/common-image.c @@ -277,7 +277,7 @@ void unload_image(struct image * im) #if !defined(USE_IMLIB2) static unsigned int u32fread(FILE *fp) { - unsigned char buffer[4]; + uint8_t buffer[4]; fread(buffer, 4, 1, fp); return ((unsigned int)buffer[3] << 24) | ((unsigned int)buffer[2] << 16) | ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]); @@ -285,14 +285,14 @@ static unsigned int u32fread(FILE *fp) static unsigned int u16fread(FILE *fp) { - unsigned char buffer[2]; + uint8_t buffer[2]; fread(buffer, 2, 1, fp); return ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]); } static unsigned int u8fread(FILE *fp) { - unsigned char buffer; + uint8_t buffer; fread(&buffer, 1, 1, fp); return (unsigned int)buffer; }