Update of /cvsroot/tuxpaint/tuxpaint/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19037/src

Modified Files:
        colors.h great.h magic.h shapes.h sounds.h tip_tux.h titles.h 
        tools.h tuxpaint.c 
Log Message:
use const keyword --> fewer warnings

Index: tools.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/tools.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tools.h     24 May 2004 20:47:17 -0000      1.3
+++ tools.h     23 Nov 2004 01:28:45 -0000      1.4
@@ -38,7 +38,7 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* Tux icons to use: */
 
-int tool_tux[NUM_TOOLS] = {
+const int tool_tux[NUM_TOOLS] = {
   TUX_DEFAULT,
   TUX_DEFAULT,
   TUX_DEFAULT,

Index: titles.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/titles.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- titles.h    15 Sep 2004 06:52:09 -0000      1.2
+++ titles.h    23 Nov 2004 01:28:45 -0000      1.3
@@ -32,7 +32,7 @@
 
 /* Title names: */
 
-char * title_names[NUM_TITLES] = {
+const char * const title_names[NUM_TITLES] = {
   "",
   "",
   gettext_noop("Tools"),

Index: shapes.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/shapes.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- shapes.h    24 Feb 2003 01:48:03 -0000      1.1.1.1
+++ shapes.h    23 Nov 2004 01:28:45 -0000      1.2
@@ -36,7 +36,7 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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",

Index: great.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/great.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- great.h     24 Feb 2003 01:48:05 -0000      1.1.1.1
+++ great.h     23 Nov 2004 01:28:45 -0000      1.2
@@ -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!"),

Index: tip_tux.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/tip_tux.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- tip_tux.h   24 Feb 2003 01:48:03 -0000      1.1.1.1
+++ tip_tux.h   23 Nov 2004 01:28:45 -0000      1.2
@@ -30,7 +30,7 @@
 
 /* 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",

Index: colors.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/colors.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- colors.h    22 Nov 2004 01:41:41 -0000      1.4
+++ colors.h    23 Nov 2004 01:28:45 -0000      1.5
@@ -39,7 +39,7 @@
 
 /* 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 @@
 
 /* Color names: */
 
-char * color_names[NUM_COLORS] = {
+const char * const color_names[NUM_COLORS] = {
   gettext_noop("Black!"),
   gettext_noop("Gray!"),
   gettext_noop("Silver!"),

Index: magic.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/magic.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- magic.h     6 Feb 2004 21:56:35 -0000       1.2
+++ magic.h     23 Nov 2004 01:28:45 -0000      1.3
@@ -44,7 +44,7 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 #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},

Index: tuxpaint.c
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/tuxpaint.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- tuxpaint.c  22 Nov 2004 23:17:22 -0000      1.167
+++ tuxpaint.c  23 Nov 2004 01:28:45 -0000      1.168
@@ -283,7 +283,7 @@
   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 @@
    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 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 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 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 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 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 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
                   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 @@
 
 /* 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 @@
 
 /* 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 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 @@
 
 #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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 @@
 
 /* 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 loadfonts(char * dir, int fatal)
+static void loadfonts(const char * const dir, int fatal)
 {
   DIR * d;
   struct dirent * f;
@@ -12133,7 +12133,7 @@
 
 /* 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 @@
 
 /* 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 char * great_str(void)
+static const char * great_str(void)
 {
   return(great_strs[rand() % (sizeof(great_strs) / sizeof(char *))]);
 }

Index: sounds.h
===================================================================
RCS file: /cvsroot/tuxpaint/tuxpaint/src/sounds.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sounds.h    19 Dec 2003 18:12:07 -0000      1.2
+++ sounds.h    23 Nov 2004 01:28:45 -0000      1.3
@@ -55,7 +55,7 @@
 
 /* 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",

_______________________________________________
Tuxpaint-commits mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-commits

Reply via email to