From 387a35ee121974363e8755ab6d9bb1ba8fe6bf22 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:33:19 -0700 Subject: [PATCH] Fix gcc warnings about discarding const qualifiers Change-Id: Ia63048860e0417359b0390528c122813fb6704f4 Signed-off-by: Alan Coopersmith --- dsimple.c | 6 +++--- dsimple.h | 6 +++--- xwd.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dsimple.c b/dsimple.c index fa31f14..d2d52a4 100644 --- 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); diff --git a/dsimple.h b/dsimple.h index 895ee83..c249b45 100644 --- 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 --- 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; -- 2.7.4