use const keyword --> fewer warnings

This commit is contained in:
Albert Cahalan 2004-11-23 01:28:44 +00:00
parent 7aa5b236a4
commit dc6ae1a5b8
10 changed files with 67 additions and 63 deletions

View file

@ -7,6 +7,10 @@ bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/
2004.November.22 (0.9.15)
* Fixed many warnings.
Albert Cahalan <albert@users.sf.net>
2004.November.21 (0.9.15)
* Updated Hebrew translation.
Dovix <dovix2003@yahoo.com>

View file

@ -39,7 +39,7 @@ enum {
/* Hex codes: */
int color_hexes[NUM_COLORS][3] = {
const int color_hexes[NUM_COLORS][3] = {
{0, 0, 0}, /* Black */
{128, 128, 128}, /* Gray */
{192, 192, 192}, /* Silver */
@ -62,7 +62,7 @@ int color_hexes[NUM_COLORS][3] = {
/* Color names: */
char * color_names[NUM_COLORS] = {
const char * const color_names[NUM_COLORS] = {
gettext_noop("Black!"),
gettext_noop("Gray!"),
gettext_noop("Silver!"),

View file

@ -16,7 +16,7 @@
#define GREAT_H
char * great_strs[] = {
const char * const great_strs[] = {
gettext_noop("Great!"),
gettext_noop("Cool!"),
gettext_noop("Keep it up!"),

View file

@ -44,7 +44,7 @@ enum {
/* Magic tool names: */
char * magic_names[NUM_MAGICS] = {
const char * const magic_names[NUM_MAGICS] = {
gettext_noop("Rainbow"),
gettext_noop("Sparkles"),
@ -69,7 +69,7 @@ char * magic_names[NUM_MAGICS] = {
/* Some text to write when each tool is selected: */
char * magic_tips[NUM_MAGICS] = {
const char * const magic_tips[NUM_MAGICS] = {
gettext_noop("You can draw in rainbow colors!"),
gettext_noop("Click and move to draw sparkles."),
@ -94,7 +94,7 @@ char * magic_tips[NUM_MAGICS] = {
/* Tool icon filenames: */
char * magic_img_fnames[NUM_TOOLS] = {
const char * const magic_img_fnames[NUM_TOOLS] = {
DATA_PREFIX "images/magic/rainbow.png",
DATA_PREFIX "images/magic/sparkles.png",
@ -125,7 +125,7 @@ char * magic_img_fnames[NUM_TOOLS] = {
#define NUM_RAINBOW_COLORS 23
int rainbow_hexes[NUM_RAINBOW_COLORS][3] = {
const int rainbow_hexes[NUM_RAINBOW_COLORS][3] = {
{255, 0, 0},
{255, 64, 0},
{255, 128, 0},

View file

@ -36,7 +36,7 @@ enum {
/* How many sides do they have? */
int shape_sides[NUM_SHAPES] = {
const int shape_sides[NUM_SHAPES] = {
4, /* Square */
4, /* Square */
4, /* Rectangle */
@ -56,7 +56,7 @@ int shape_sides[NUM_SHAPES] = {
/* Which shapes are 1:1 aspect? */
int shape_locked[NUM_SHAPES] = {
const int shape_locked[NUM_SHAPES] = {
1, /* Square */
1, /* Square */
0, /* Rectangle */
@ -76,7 +76,7 @@ int shape_locked[NUM_SHAPES] = {
/* Which shapes are filled? */
int shape_filled[NUM_SHAPES] = {
const int shape_filled[NUM_SHAPES] = {
0, /* Square */
1, /* Square */
0, /* Rectangle */
@ -97,7 +97,7 @@ int shape_filled[NUM_SHAPES] = {
/* Initial angles for shapes: */
int shape_init_ang[NUM_SHAPES] = {
const int shape_init_ang[NUM_SHAPES] = {
45, /* Square */
45, /* Square */
45, /* Rectangle */
@ -117,7 +117,7 @@ int shape_init_ang[NUM_SHAPES] = {
/* Shapes that don't make sense rotating (e.g., circles): */
int shape_no_rotate[NUM_SHAPES] = {
const int shape_no_rotate[NUM_SHAPES] = {
0, /* Square */
0, /* Square */
0, /* Rectangle */
@ -137,7 +137,7 @@ int shape_no_rotate[NUM_SHAPES] = {
/* Shape names: */
char * shape_names[NUM_SHAPES] = {
const char * const shape_names[NUM_SHAPES] = {
gettext_noop("Square"),
gettext_noop("Square"),
gettext_noop("Rectangle"),
@ -157,7 +157,7 @@ char * shape_names[NUM_SHAPES] = {
/* Some text to write when each shape is selected: */
char * shape_tips[NUM_SHAPES] = {
const char * const shape_tips[NUM_SHAPES] = {
gettext_noop("A square has four sides, each the same length."),
gettext_noop("A square has four sides, each the same length."),
gettext_noop("A rectangle has four sides."),
@ -177,7 +177,7 @@ char * shape_tips[NUM_SHAPES] = {
/* Shape icon filenames: */
char * shape_img_fnames[NUM_SHAPES] = {
const char * const shape_img_fnames[NUM_SHAPES] = {
DATA_PREFIX "images/shapes/square.png",
DATA_PREFIX "images/shapes/square_f.png",
DATA_PREFIX "images/shapes/rectangle.png",

View file

@ -55,7 +55,7 @@ enum {
/* Sound file filenames: */
char * sound_fnames[NUM_SOUNDS] = {
const char * const sound_fnames[NUM_SOUNDS] = {
DATA_PREFIX "sounds/harp.wav",
DATA_PREFIX "sounds/click.wav",
DATA_PREFIX "sounds/bleep.wav",

View file

@ -30,7 +30,7 @@ enum {
/* Tux filenames: */
char * tux_img_fnames[NUM_TIP_TUX] = {
const char * const tux_img_fnames[NUM_TIP_TUX] = {
DATA_PREFIX "images/tux/default.png",
DATA_PREFIX "images/tux/kiss.png",
DATA_PREFIX "images/tux/bored.png",

View file

@ -32,7 +32,7 @@ enum {
/* Title names: */
char * title_names[NUM_TITLES] = {
const char * const title_names[NUM_TITLES] = {
"",
"",
gettext_noop("Tools"),

View file

@ -38,7 +38,7 @@ enum {
/* Tool names: */
char * tool_names[NUM_TOOLS] = {
const char * const tool_names[NUM_TOOLS] = {
gettext_noop("Paint"),
gettext_noop("Stamp"),
gettext_noop("Lines"),
@ -58,7 +58,7 @@ char * tool_names[NUM_TOOLS] = {
/* Some text to write when each tool is selected: */
char * tool_tips[NUM_TOOLS] = {
const char * const tool_tips[NUM_TOOLS] = {
gettext_noop("Pick a color and a brush shape to draw with."),
gettext_noop("Pick a picture to stamp around your drawing."),
gettext_noop("Click to start drawing a line. Let go to complete it."),
@ -83,7 +83,7 @@ char * tool_tips[NUM_TOOLS] = {
/* Tool icon filenames: */
char * tool_img_fnames[NUM_TOOLS] = {
const char * const tool_img_fnames[NUM_TOOLS] = {
DATA_PREFIX "images/tools/brush.png",
DATA_PREFIX "images/tools/stamp.png",
DATA_PREFIX "images/tools/lines.png",
@ -103,7 +103,7 @@ char * tool_img_fnames[NUM_TOOLS] = {
/* Tux icons to use: */
int tool_tux[NUM_TOOLS] = {
const int tool_tux[NUM_TOOLS] = {
TUX_DEFAULT,
TUX_DEFAULT,
TUX_DEFAULT,

View file

@ -283,7 +283,7 @@ extern char* g_win32_getlocale(void);
The SDL stderr redirection trick doesn't seem to work for perror().
This does pretty much the same thing.
*/
static void win32_perror(const char *str)
static void win32_perror(const char * const str)
{
if ( str && *str )
fprintf(stderr,"%s : ",str);
@ -308,7 +308,7 @@ static void win32_perror(const char *str)
TTF_OpenFont() with the filename of a font that doesn't exist. This
is an old and well documented bug that is fixed in CVS.
*/
static TTF_Font *BUGFIX_TTF_OpenFont206(const char *file, int ptsize)
static TTF_Font *BUGFIX_TTF_OpenFont206(const char * const file, int ptsize)
{
FILE *fp;
@ -487,7 +487,7 @@ static int recording, playing;
static char * playfile;
static FILE * demofi;
static int WINDOW_WIDTH, WINDOW_HEIGHT;
static char * printcommand;
static const char * printcommand;
static int prog_bar_ctr;
static SDL_Surface * screen;
@ -637,9 +637,9 @@ static void setup(int argc, char * argv[]);
static SDL_Cursor * get_cursor(char * bits, char * mask_bits,
int w, int h, int x, int y);
static void seticon(void);
static SDL_Surface * loadimage(char * fname);
static SDL_Surface * do_loadimage(char * fname, int abort_on_error);
static SDL_Surface * loadaltimage(char * fname);
static SDL_Surface * loadimage(const char * const fname);
static SDL_Surface * do_loadimage(const char * const fname, int abort_on_error);
static SDL_Surface * loadaltimage(const char * const fname);
static void draw_toolbar(void);
static void draw_magic(void);
static void draw_colors(int enabled);
@ -653,18 +653,18 @@ static void draw_none(void);
static void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
char * descs[], info_type * infs[],
Mix_Chunk * sounds[], int * count, int starting, int max,
char * dir, int fatal, int maxw, int maxh);
const char * const dir, int fatal, int maxw, int maxh);
#else
static void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
char * descs[], info_type * infs[],
int * count, int starting, int max,
char * dir, int fatal, int maxw, int maxh);
const char * const dir, int fatal, int maxw, int maxh);
#endif
static SDL_Surface * thumbnail(SDL_Surface * src, int max_x, int max_y,
int keep_aspect);
static Uint32 getpixel(SDL_Surface * surface, int x, int y);
static void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
static void debug(char * str);
static void debug(const char * const str);
static void do_undo(void);
static void do_redo(void);
static void render_brush(void);
@ -681,21 +681,21 @@ static void update_screen(int x1, int y1, int x2, int y2);
static Uint8 alpha(Uint8 c1, Uint8 c2, Uint8 a);
static int compare_strings(char * * s1, char * * s2);
static int compare_dirent2s(struct dirent2 * f1, struct dirent2 * f2);
static void draw_tux_text(int which_tux, char * str,
static void draw_tux_text(int which_tux, const char * const str,
int force_locale_font, int want_right_to_left);
static void wordwrap_text(TTF_Font * font, char * str, SDL_Color color,
static void wordwrap_text(TTF_Font * font, const char * const str, SDL_Color color,
int left, int top, int right,
int force_locale_font, int want_right_to_left);
static char * loaddesc(char * fname);
static info_type * loadinfo(char * fname);
static char * loaddesc(const char * const fname);
static info_type * loadinfo(const char * const fname);
#ifndef NOSOUND
static Mix_Chunk * loadsound(char * fname);
static Mix_Chunk * loadsound(const char * const fname);
#endif
static void do_wait(void);
static void load_current(void);
static void save_current(void);
static char * get_fname(char * name);
static int do_prompt(char * text, char * btn_yes, char * btn_no);
static char * get_fname(const char * const name);
static int do_prompt(const char * const text, const char * const btn_yes, const char * const btn_no);
static void cleanup(void);
static void free_cursor(SDL_Cursor ** cursor);
static void free_surface(SDL_Surface **surface_array);
@ -705,7 +705,7 @@ static void update_shape(int cx, int ox1, int ox2, int cy, int oy1, int oy2,
static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush);
static int rotation(int ctr_x, int ctr_y, int ox, int oy);
static int do_save(void);
static int do_png_save(FILE * fi, char * fname, SDL_Surface * surf);
static int do_png_save(FILE * fi, const char * const fname, SDL_Surface * surf);
static void get_new_file_id(void);
static int do_quit(void);
static int do_open(int want_new_tool);
@ -722,20 +722,20 @@ static void show_progress_bar(void);
static void do_print(void);
static void strip_trailing_whitespace(char * buf);
static void do_render_cur_text(int do_blit);
static void loadfonts(char * dir, int fatal);
static void loadfonts(const char * const dir, int fatal);
static char * uppercase(char * str);
static unsigned char * textdir(unsigned char * str);
static SDL_Surface * do_render_button_label(char * label);
static unsigned char * textdir(const unsigned char * const str);
static SDL_Surface * do_render_button_label(const char * const label);
static void create_button_labels(void);
static int colors_close(Uint32 c1, Uint32 c2);
static void do_flood_fill(int x, int y, Uint32 cur_colr, Uint32 old_colr);
static Uint32 scrolltimer_callback(Uint32 interval, void *param);
static Uint32 drawtext_callback(Uint32 interval, void *param);
static void control_drawtext_timer(Uint32 interval, char* text);
static void control_drawtext_timer(Uint32 interval, const char * const text);
static void parse_options(FILE * fi);
static char * debug_gettext(const char * str);
static void do_setcursor(SDL_Cursor * c);
static char * great_str(void);
static const char * great_str(void);
static int charsize(char c);
static void draw_image_title(int t, int x);
static int need_own_font(int l);
@ -5727,7 +5727,7 @@ static void setup(int argc, char * argv[])
/* Render a button label using the appropriate string/font: */
static SDL_Surface * do_render_button_label(char * label)
static SDL_Surface * do_render_button_label(const char * const label)
{
char * str;
SDL_Surface * tmp_surf, * surf;
@ -5881,7 +5881,7 @@ static SDL_Cursor * get_cursor(char * bits, char * mask_bits,
/* Load an image (with errors): */
static SDL_Surface * loadimage(char * fname)
static SDL_Surface * loadimage(const char * const fname)
{
return(do_loadimage(fname, 1));
}
@ -5889,7 +5889,7 @@ static SDL_Surface * loadimage(char * fname)
/* Load an image: */
static SDL_Surface * do_loadimage(char * fname, int abort_on_error)
static SDL_Surface * do_loadimage(const char * const fname, int abort_on_error)
{
SDL_Surface * s, * disp_fmt_s;
@ -6772,12 +6772,12 @@ static void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
char * descs[], info_type * infs[],
Mix_Chunk * sounds[],
int * count, int starting, int max,
char * dir, int fatal, int maxw, int maxh)
const char * const dir, int fatal, int maxw, int maxh)
#else
static void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
char * descs[], info_type * infs[],
int * count, int starting, int max,
char * dir, int fatal, int maxw, int maxh)
const char * const dir, int fatal, int maxw, int maxh)
#endif
{
DIR * d;
@ -7219,7 +7219,7 @@ static void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
/* Show debugging stuff: */
static void debug(char * str)
static void debug(const char * const str)
{
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s\n", str);
@ -7792,7 +7792,7 @@ static int compare_dirent2s(struct dirent2 * f1, struct dirent2 * f2)
/* Draw tux's text on the screen: */
static void draw_tux_text(int which_tux, char * str,
static void draw_tux_text(int which_tux, const char * const str,
int force_locale_font, int want_right_to_left)
{
SDL_Rect dest;
@ -7841,7 +7841,7 @@ static void draw_tux_text(int which_tux, char * str,
}
static void wordwrap_text(TTF_Font * font, char * str, SDL_Color color,
static void wordwrap_text(TTF_Font * font, const char * const str, SDL_Color color,
int left, int top, int right,
int force_locale_font, int want_right_to_left)
{
@ -8163,7 +8163,7 @@ static void wordwrap_text(TTF_Font * font, char * str, SDL_Color color,
#ifndef NOSOUND
static Mix_Chunk * loadsound(char * fname)
static Mix_Chunk * loadsound(const char * const fname)
{
char * snd_fname;
char tmp_str[64];
@ -8245,7 +8245,7 @@ static void strip_trailing_whitespace( char *buf )
/* Load a file's description: */
static char * loaddesc(char * fname)
static char * loaddesc(const char * const fname)
{
char * txt_fname;
char buf[256], def_buf[256];
@ -8345,7 +8345,7 @@ static char * loaddesc(char * fname)
/* Load a file's info: */
static info_type * loadinfo(char * fname)
static info_type * loadinfo(const char * const fname)
{
char * dat_fname;
char buf[256];
@ -8432,7 +8432,7 @@ static info_type * loadinfo(char * fname)
/* Load a file's alternative image: */
static SDL_Surface * loadaltimage(char * fname)
static SDL_Surface * loadaltimage(const char * const fname)
{
char * alt_fname;
SDL_Surface * s;
@ -8650,7 +8650,7 @@ static void save_current(void)
/* The filename for the current image: */
static char * get_fname(char * name)
static char * get_fname(const char * const name)
{
char f[512];
const char * tux_settings_dir;
@ -8739,7 +8739,7 @@ static char * get_fname(char * name)
/* Prompt the user with a yes/no question: */
static int do_prompt(char * text, char * btn_yes, char * btn_no)
static int do_prompt(const char * const text, const char * const btn_yes, const char * const btn_no)
{
SDL_Event event;
SDL_Rect dest;
@ -9739,7 +9739,7 @@ static int do_save(void)
/* Actually save the PNG data to the file stream: */
static int do_png_save(FILE * fi, char * fname, SDL_Surface * surf)
static int do_png_save(FILE * fi, const char * const fname, SDL_Surface * surf)
{
png_structp png_ptr;
png_infop info_ptr;
@ -11934,7 +11934,7 @@ static void do_render_cur_text(int do_blit)
}
static void loadfonts(char * dir, int fatal)
static void loadfonts(const char * const dir, int fatal)
{
DIR * d;
struct dirent * f;
@ -12133,7 +12133,7 @@ static char * uppercase(char * str)
/* Return string in right-to-left mode, if necessary: */
static unsigned char * textdir(unsigned char * str)
static unsigned char * textdir(const unsigned char * const str)
{
unsigned char * dstr;
int i, j;
@ -12305,7 +12305,7 @@ static Uint32 scrolltimer_callback(Uint32 interval, void *param)
/* Controls the Text-Timer - interval == 0 removes the timer */
static void control_drawtext_timer(Uint32 interval, char* text)
static void control_drawtext_timer(Uint32 interval, const char * const text)
{
static int activated = 0;
static SDL_TimerID TimerID = 0;
@ -12628,7 +12628,7 @@ static void do_setcursor(SDL_Cursor * c)
}
static char * great_str(void)
static const char * great_str(void)
{
return(great_strs[rand() % (sizeof(great_strs) / sizeof(char *))]);
}