Fix gcc warnings about discarding const qualifiers 46/9446/1
authorAlan Coopersmith <alan.coopersmith@oracle.com>
Sat, 20 Jul 2013 06:33:19 +0000 (23:33 -0700)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 3 Sep 2013 04:11:40 +0000 (00:11 -0400)
Change-Id: Ia63048860e0417359b0390528c122813fb6704f4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
dsimple.c
dsimple.h
xwd.c

index fa31f14..d2d52a4 100644 (file)
--- a/dsimple.c
+++ b/dsimple.c
@@ -54,7 +54,7 @@ from The Open Group.
 
 
 /* This stuff is defined in the calling program by just_display.h */
-char    *program_name = "unknown_program";
+const char *program_name = "unknown_program";
 Display *dpy = NULL;
 int      screen = 0;
 
@@ -318,7 +318,7 @@ Window Window_With_Name(
  *       printf with up to 7 arguments.
  */
 void
-outl(char *msg, ...)
+outl(const char *msg, ...)
 {
        va_list args;
        fflush(stdout);
@@ -334,7 +334,7 @@ outl(char *msg, ...)
  * Standard fatal error routine - call like printf but maximum of 7 arguments.
  * Does not require dpy or screen defined.
  */
-void Fatal_Error(char *msg, ...)
+void Fatal_Error(const char *msg, ...)
 {
        va_list args;
        fflush(stdout);
index 895ee83..c249b45 100644 (file)
--- a/dsimple.h
+++ b/dsimple.h
@@ -47,7 +47,7 @@ from The Open Group.
 
     /* Global variables used by routines in just_display.c */
 
-extern char *program_name;                   /* Name of this program */
+extern const char *program_name;             /* Name of this program */
 extern Display *dpy;                         /* The current display */
 extern int screen;                           /* The current screen */
 
@@ -76,5 +76,5 @@ void usage(void) _X_NORETURN;
 
 Window Select_Window(Display *, int);
 Window Window_With_Name(Display *, Window, const char *);
-void Fatal_Error(char *, ...) _X_NORETURN;
-void outl(char *, ...);
+void Fatal_Error(const char *, ...) _X_NORETURN;
+void outl(const char *, ...);
diff --git a/xwd.c b/xwd.c
index 5b40121..d4cc449 100644 (file)
--- a/xwd.c
+++ b/xwd.c
@@ -255,6 +255,7 @@ Window_Dump(Window window, FILE *out)
     int header_size;
     int ncolors, i;
     char *win_name;
+    char default_win_name[] = "xwdump";
     Bool got_win_name;
     XWindowAttributes win_info;
     XImage *image;
@@ -327,7 +328,7 @@ Window_Dump(Window window, FILE *out)
 
     XFetchName(dpy, window, &win_name);
     if (!win_name || !win_name[0]) {
-       win_name = "xwdump";
+       win_name = default_win_name;
        got_win_name = False;
     } else {
        got_win_name = True;