diff --git a/examples/aafire.c b/examples/aafire.c index 7fa4b9d..cef24bf 100644 --- a/examples/aafire.c +++ b/examples/aafire.c @@ -50,7 +50,7 @@ static aa_palette palette; #endif static unsigned int table[MAXTABLE]; #ifdef LIBCACA -const static int pal[] = +static int const pal[] = #else __AA_CONST static int pal[] = #endif diff --git a/examples/cacaview.c b/examples/cacaview.c index 43883ed..1ecfe44 100644 --- a/examples/cacaview.c +++ b/examples/cacaview.c @@ -42,7 +42,7 @@ #define STATUS_BACKGROUND 3 /* Local functions */ -static void load_image(const char *); +static void load_image(char const *); static void unload_image(void); static void draw_checkers(unsigned int, unsigned int, unsigned int, unsigned int); @@ -405,7 +405,7 @@ static void unload_image(void) bitmap = NULL; } -static void load_image(const char *name) +static void load_image(char const *name) { #if defined(HAVE_IMLIB2_H) /* Load the new image */ diff --git a/src/bitmap.c b/src/bitmap.c index 626d32f..39b6006 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -58,7 +58,7 @@ enum caca_feature _caca_antialiasing; */ static void mask2shift(unsigned int, int *, int *); -static void get_rgba_default(const struct caca_bitmap *, uint8_t *, int, int, +static void get_rgba_default(struct caca_bitmap const *, uint8_t *, int, int, unsigned int *, unsigned int *, unsigned int *, unsigned int *); static void rgb2hsv_default(int, int, int, int *, int *, int *); @@ -241,7 +241,7 @@ void caca_free_bitmap(struct caca_bitmap *bitmap) free(bitmap); } -static void get_rgba_default(const struct caca_bitmap *bitmap, uint8_t *pixels, +static void get_rgba_default(struct caca_bitmap const *bitmap, uint8_t *pixels, int x, int y, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a) { @@ -260,8 +260,8 @@ static void get_rgba_default(const struct caca_bitmap *bitmap, uint8_t *pixels, if(__BYTE_ORDER == __BIG_ENDIAN) #else /* This is compile-time optimised with at least -O1 or -Os */ - const uint32_t rmask = 0x12345678; - if(*(const uint8_t *)&rmask == 0x12) + uint32_t const rmask = 0x12345678; + if(*(uint8_t const *)&rmask == 0x12) #endif bits = ((uint32_t)pixels[0] << 16) | ((uint32_t)pixels[1] << 8) | @@ -339,7 +339,7 @@ static void rgb2hsv_default(int r, int g, int b, int *hue, int *sat, int *val) * \return void */ void caca_draw_bitmap(int x1, int y1, int x2, int y2, - const struct caca_bitmap *bitmap, void *pixels) + struct caca_bitmap const *bitmap, void *pixels) { /* Current dithering method */ void (*_init_dither) (int); @@ -347,7 +347,7 @@ void caca_draw_bitmap(int x1, int y1, int x2, int y2, void (*_increment_dither) (void); /* Only used when background is black */ - static const int white_colors[] = + static int const white_colors[] = { CACA_COLOR_BLACK, CACA_COLOR_DARKGRAY, @@ -355,7 +355,7 @@ void caca_draw_bitmap(int x1, int y1, int x2, int y2, CACA_COLOR_WHITE }; - static const int light_colors[] = + static int const light_colors[] = { CACA_COLOR_LIGHTMAGENTA, CACA_COLOR_LIGHTRED, @@ -366,7 +366,7 @@ void caca_draw_bitmap(int x1, int y1, int x2, int y2, CACA_COLOR_LIGHTMAGENTA }; - static const int dark_colors[] = + static int const dark_colors[] = { CACA_COLOR_MAGENTA, CACA_COLOR_RED, @@ -379,7 +379,7 @@ void caca_draw_bitmap(int x1, int y1, int x2, int y2, /* FIXME: choose better characters! */ # define DENSITY_CHARS 13 - static const char density_chars[] = + static char const density_chars[] = " " ". " ".. " diff --git a/src/caca.c b/src/caca.c index df2efcd..95cc8a3 100644 --- a/src/caca.c +++ b/src/caca.c @@ -188,9 +188,9 @@ unsigned int caca_get_height(void) * \param color The colour value. * \return A static string containing the colour's name. */ -const char *caca_get_color_name(enum caca_color color) +char const *caca_get_color_name(enum caca_color color) { - static const char *color_names[] = + static char const *color_names[] = { "black", "blue", @@ -291,7 +291,7 @@ void caca_set_feature(enum caca_feature feature) * \param feature The feature value. * \return A static string containing the feature's name. */ -const char *caca_get_feature_name(enum caca_feature feature) +char const *caca_get_feature_name(enum caca_feature feature) { switch(feature) { diff --git a/src/caca.h b/src/caca.h index 9a9beb6..d13f013 100644 --- a/src/caca.h +++ b/src/caca.h @@ -222,7 +222,7 @@ int caca_init(void); void caca_set_delay(unsigned int); enum caca_feature caca_get_feature(enum caca_feature); void caca_set_feature(enum caca_feature); -const char *caca_get_feature_name(enum caca_feature); +char const *caca_get_feature_name(enum caca_feature); unsigned int caca_get_rendertime(void); unsigned int caca_get_width(void); unsigned int caca_get_height(void); @@ -248,10 +248,10 @@ unsigned int caca_wait_event(void); void caca_set_color(enum caca_color, enum caca_color); enum caca_color caca_get_fg_color(void); enum caca_color caca_get_bg_color(void); -const char *caca_get_color_name(enum caca_color); +char const *caca_get_color_name(enum caca_color); void caca_putchar(int, int, char); -void caca_putstr(int, int, const char *); -void caca_printf(int, int, const char *, ...); +void caca_putstr(int, int, char const *); +void caca_printf(int, int, char const *, ...); void caca_clear(void); /* @} */ @@ -262,9 +262,9 @@ void caca_clear(void); * * @{ */ void caca_draw_line(int, int, int, int, char); -void caca_draw_polyline(const int x[], const int y[], int, char); +void caca_draw_polyline(int const x[], int const y[], int, char); void caca_draw_thin_line(int, int, int, int); -void caca_draw_thin_polyline(const int x[], const int y[], int); +void caca_draw_thin_polyline(int const x[], int const y[], int); void caca_draw_circle(int, int, int, char); void caca_draw_ellipse(int, int, int, int, char); @@ -296,13 +296,13 @@ unsigned int caca_sqrt(unsigned int); * * @{ */ struct caca_sprite; -struct caca_sprite * caca_load_sprite(const char *); -int caca_get_sprite_frames(const struct caca_sprite *); -int caca_get_sprite_width(const struct caca_sprite *, int); -int caca_get_sprite_height(const struct caca_sprite *, int); -int caca_get_sprite_dx(const struct caca_sprite *, int); -int caca_get_sprite_dy(const struct caca_sprite *, int); -void caca_draw_sprite(int, int, const struct caca_sprite *, int); +struct caca_sprite * caca_load_sprite(char const *); +int caca_get_sprite_frames(struct caca_sprite const *); +int caca_get_sprite_width(struct caca_sprite const *, int); +int caca_get_sprite_height(struct caca_sprite const *, int); +int caca_get_sprite_dx(struct caca_sprite const *, int); +int caca_get_sprite_dy(struct caca_sprite const *, int); +void caca_draw_sprite(int, int, struct caca_sprite const *, int); void caca_free_sprite(struct caca_sprite *); /* @} */ @@ -320,7 +320,7 @@ struct caca_bitmap *caca_create_bitmap(unsigned int, unsigned int, void caca_set_bitmap_palette(struct caca_bitmap *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]); -void caca_draw_bitmap(int, int, int, int, const struct caca_bitmap *, void *); +void caca_draw_bitmap(int, int, int, int, struct caca_bitmap const *, void *); void caca_free_bitmap(struct caca_bitmap *); /* @} */ diff --git a/src/graphics.c b/src/graphics.c index a6e574d..e2b798a 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -75,7 +75,7 @@ static int ncurses_attr[16*16]; #if defined(USE_SLANG) /* Tables generated by test/optipal.c */ -const static int slang_palette[2*16*16] = +static int const slang_palette[2*16*16] = { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 8, @@ -111,7 +111,7 @@ const static int slang_palette[2*16*16] = 9, 4, 14, 5, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, }; -const static int slang_assoc[16*16] = +static int const slang_assoc[16*16] = { 134, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 28, 135, 214, 86, 219, 91, 133, 127, 26, 23, 240, 112, 245, 117, 141, 126, @@ -336,7 +336,7 @@ void caca_putchar(int x, int y, char c) * \param y Y coordinate. * \param s The string to print. */ -void caca_putstr(int x, int y, const char *s) +void caca_putstr(int x, int y, char const *s) { #if defined(USE_CONIO) | defined(USE_X11) char *charbuf; @@ -428,7 +428,7 @@ void caca_putstr(int x, int y, const char *s) * \param format The format string to print. * \param ... Arguments to the format string. */ -void caca_printf(int x, int y, const char *format, ...) +void caca_printf(int x, int y, char const *format, ...) { char tmp[BUFSIZ]; char *buf = tmp; @@ -602,7 +602,7 @@ int _caca_init_graphics(void) Colormap colormap; XSetWindowAttributes x11_winattr; int (*old_error_handler)(Display *, XErrorEvent *); - const char *font_name = "8x13bold"; + char const *font_name = "8x13bold"; int i; if(getenv("CACA_GEOMETRY") && *(getenv("CACA_GEOMETRY"))) diff --git a/src/line.c b/src/line.c index 5192641..b94deee 100644 --- a/src/line.c +++ b/src/line.c @@ -88,7 +88,7 @@ void caca_draw_line(int x1, int y1, int x2, int y2, char c) * \param c Character to draw the lines with. * \return void */ -void caca_draw_polyline(const int x[], const int y[], int n, char c) +void caca_draw_polyline(int const x[], int const y[], int n, char c) { int i; struct line s; @@ -136,7 +136,7 @@ void caca_draw_thin_line(int x1, int y1, int x2, int y2) * \param n Number of lines to draw. * \return void */ -void caca_draw_thin_polyline(const int x[], const int y[], int n) +void caca_draw_thin_polyline(int const x[], int const y[], int n) { int i; struct line s; diff --git a/src/sprite.c b/src/sprite.c index 5739533..9333a0e 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -56,7 +56,7 @@ struct caca_sprite * \param file The filename. * \return The sprite, or NULL if an error occured. */ -struct caca_sprite *caca_load_sprite(const char *file) +struct caca_sprite *caca_load_sprite(char const *file) { char buf[BUFSIZ]; struct caca_sprite *sprite; @@ -177,7 +177,7 @@ sprite_alloc_failed: * \param sprite The sprite. * \return The number of frames. */ -int caca_get_sprite_frames(const struct caca_sprite *sprite) +int caca_get_sprite_frames(struct caca_sprite const *sprite) { if(sprite == NULL) return 0; @@ -192,7 +192,7 @@ int caca_get_sprite_frames(const struct caca_sprite *sprite) * \param f The frame index. * \return The width of the given frame of the sprite. */ -int caca_get_sprite_width(const struct caca_sprite *sprite, int f) +int caca_get_sprite_width(struct caca_sprite const *sprite, int f) { if(sprite == NULL) return 0; @@ -210,7 +210,7 @@ int caca_get_sprite_width(const struct caca_sprite *sprite, int f) * \param f The frame index. * \return The height of the given frame of the sprite. */ -int caca_get_sprite_height(const struct caca_sprite *sprite, int f) +int caca_get_sprite_height(struct caca_sprite const *sprite, int f) { if(sprite == NULL) return 0; @@ -228,7 +228,7 @@ int caca_get_sprite_height(const struct caca_sprite *sprite, int f) * \param f The frame index. * \return The X coordinate of the given frame's handle. */ -int caca_get_sprite_dx(const struct caca_sprite *sprite, int f) +int caca_get_sprite_dx(struct caca_sprite const *sprite, int f) { if(sprite == NULL) return 0; @@ -246,7 +246,7 @@ int caca_get_sprite_dx(const struct caca_sprite *sprite, int f) * \param f The frame index. * \return The Y coordinate of the given frame's handle. */ -int caca_get_sprite_dy(const struct caca_sprite *sprite, int f) +int caca_get_sprite_dy(struct caca_sprite const *sprite, int f) { if(sprite == NULL) return 0; @@ -267,7 +267,7 @@ int caca_get_sprite_dy(const struct caca_sprite *sprite, int f) * \param f The frame index. * \return void */ -void caca_draw_sprite(int x, int y, const struct caca_sprite *sprite, int f) +void caca_draw_sprite(int x, int y, struct caca_sprite const *sprite, int f) { int i, j; enum caca_color oldfg, oldbg; diff --git a/test/optipal.c b/test/optipal.c index b8c5e4b..e136d12 100644 --- a/test/optipal.c +++ b/test/optipal.c @@ -34,7 +34,7 @@ static void unused_colors(void); static int slang_assoc[16*16], palette[16*16]; /* 6 colours in hue order */ -static const enum caca_color hue_list[] = +static enum caca_color const hue_list[] = { CACA_COLOR_RED, CACA_COLOR_BROWN, @@ -75,7 +75,7 @@ int main(void) unused_colors(); /* Output the palette */ - printf("const static int slang_palette[2*16*16] =\n{\n"); + printf("static int const slang_palette[2*16*16] =\n{\n"); for(i = 0; i < 16 * 16; i++) { if((i % 8) == 0) printf(" "); @@ -85,7 +85,7 @@ int main(void) printf("};\n\n"); /* Output the association table */ - printf("const static int slang_assoc[16*16] =\n{\n"); + printf("static int const slang_assoc[16*16] =\n{\n"); for(i = 0; i < 16 * 16; i++) { if((i % 16) == 0) printf(" ");