From 1dd99ee7d52871c998d0944311260623d131521f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 11 Nov 2011 23:16:53 -0800 Subject: Fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith --- dsimple.c | 4 ++-- dsimple.h | 4 ++-- xlsfonts.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dsimple.c b/dsimple.c index 6866afe..2ec899c 100644 --- a/dsimple.c +++ b/dsimple.c @@ -55,7 +55,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; @@ -147,7 +147,7 @@ void Close_Display(void) * 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 c01f85d..6ef852a 100644 --- a/dsimple.h +++ b/dsimple.h @@ -51,7 +51,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 */ @@ -67,4 +67,4 @@ void usage(void); #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ -void Fatal_Error(char *, ...) _X_NORETURN; +void Fatal_Error(const char *, ...) _X_NORETURN; diff --git a/xlsfonts.c b/xlsfonts.c index fbb9d9e..0a2900a 100644 --- a/xlsfonts.c +++ b/xlsfonts.c @@ -63,7 +63,7 @@ typedef struct { static FontList *font_list = NULL; /* Local prototypes */ -static void get_list(char *pattern); +static void get_list(const char *pattern); static int compare(const void *arg1, const void *arg2); static void show_fonts(void); static void copy_number(char **pp1, char**pp2, int n1, int n2); @@ -165,7 +165,7 @@ int main(int argc, char **argv) static -void get_list(char *pattern) +void get_list(const char *pattern) { int available = nnames+1, i; @@ -253,7 +253,7 @@ void show_fonts(void) if (long_list == L_MEDIUM) { XFontStruct *pfi; - char *string; + const char *string; printf("DIR "); printf("MIN "); @@ -415,7 +415,7 @@ int IgnoreError(Display *disp, XErrorEvent *event) return 0; } -static char *bounds_metrics_title = +static const char *bounds_metrics_title = "width left right asc desc attr keysym\n"; #define PrintBounds(_what,_ptr) \ @@ -425,7 +425,7 @@ static char *bounds_metrics_title = p->rbearing, p->ascent, p->descent, p->attributes); } -static char* stringValued [] = { /* values are atoms */ +static const char* stringValued [] = { /* values are atoms */ /* font name components (see section 3.2 of the XLFD) */ "FOUNDRY", "FAMILY_NAME", @@ -510,7 +510,7 @@ ComputeFontType(XFontStruct *fs) { int i; Bool char_cell = True; - char *reason = NULL; + const char *reason = NULL; XCharStruct *cs; Atom awatom = XInternAtom (dpy, "AVERAGE_WIDTH", False); -- cgit v1.2.3