Преглед на файлове

* Changed most "unsigned char" variables into "uint8_t", including in

prototypes. As they are equivalent, this does not break the ABI.
tags/v0.99.beta14
Sam Hocevar sam преди 16 години
родител
ревизия
f44b5e11fa
променени са 16 файла, в които са добавени 45 реда и са изтрити 47 реда
  1. +1
    -1
      caca/caca.h
  2. +2
    -2
      caca/driver_conio.c
  3. +4
    -4
      caca/driver_gl.c
  4. +5
    -5
      cucul/attr.c
  5. +2
    -2
      cucul/charset.c
  6. +4
    -4
      cucul/cucul.c
  7. +9
    -10
      cucul/cucul.h
  8. +2
    -2
      cucul/dither.c
  9. +4
    -5
      cucul/export.c
  10. +1
    -1
      cucul/file.c
  11. +1
    -1
      examples/font.c
  12. +1
    -1
      examples/swallow.c
  13. +1
    -1
      kernel/kernel.c
  14. +1
    -1
      src/cacaplay.c
  15. +4
    -4
      src/cacaserver.c
  16. +3
    -3
      src/common-image.c

+ 1
- 1
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.


+ 2
- 2
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';



+ 4
- 4
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;


+ 5
- 5
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;


+ 2
- 2
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];


+ 4
- 4
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.


+ 9
- 10
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);
/* @} */


+ 2
- 2
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);


+ 4
- 5
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, "&nbsp;");
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, "&nbsp;");
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;
}
}


+ 1
- 1
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;


+ 1
- 1
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;



+ 1
- 1
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;


+ 1
- 1
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--)
{


+ 1
- 1
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;



+ 4
- 4
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)
{


+ 3
- 3
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;
}


Зареждане…
Отказ
Запис