diff options
-rw-r--r-- | dsimple.c | 4 | ||||
-rw-r--r-- | dsimple.h | 4 | ||||
-rw-r--r-- | xprop.c | 29 |
3 files changed, 19 insertions, 18 deletions
@@ -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; @@ -333,7 +333,7 @@ Window Window_With_Name( * 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); @@ -49,7 +49,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 */ @@ -80,4 +80,4 @@ void usage(void); Window Select_Window(Display *, int descend); Window Window_With_Name(Display *, Window, const char *); -void Fatal_Error(char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1,2); +void Fatal_Error(const char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1,2); @@ -537,7 +537,8 @@ static void Read_Mappings (FILE *stream) { char format_buffer[100]; - char name[1000], *dformat, *format; + char name[1000]; + const char *dformat, *format; int count, c; Atom atom; @@ -1594,7 +1595,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) int size; char format_char; Atom type = 0; - unsigned char *data = NULL; + const unsigned char *data = NULL; int nelements = 0; atom = Parse_Atom(propname, False); @@ -1612,14 +1613,14 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) if (size != 8) Fatal_Error("can't use format character 's' with any size except 8."); type = XA_STRING; - data = (unsigned char *) value; + data = (const unsigned char *) value; nelements = strlen(value); break; case 'u': if (size != 8) Fatal_Error("can't use format character 'u' with any size except 8."); type = XInternAtom(dpy, "UTF8_STRING", False); - data = (unsigned char *) value; + data = (const unsigned char *) value; nelements = strlen(value); break; case 't': { @@ -1648,11 +1649,11 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) intvalue = strtoul(tmp, NULL, 0); switch(size) { case 8: - data8[0] = intvalue; data = (unsigned char *) data8; break; + data8[0] = intvalue; data = (const unsigned char *) data8; break; case 16: - data16[0] = intvalue; data = (unsigned char *) data16; break; + data16[0] = intvalue; data = (const unsigned char *) data16; break; case 32: - data32[0] = intvalue; data = (unsigned char *) data32; break; + data32[0] = intvalue; data = (const unsigned char *) data32; break; } tmp = strtok(NULL,","); while(tmp != NULL){ @@ -1688,11 +1689,11 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) intvalue = strtoul(tmp, NULL, 0); switch(size) { case 8: - data8[0] = intvalue; data = (unsigned char *) data8; break; + data8[0] = intvalue; data = (const unsigned char *) data8; break; case 16: - data16[0] = intvalue; data = (unsigned char *) data16; break; + data16[0] = intvalue; data = (const unsigned char *) data16; break; case 32: - data32[0] = intvalue; data = (unsigned char *) data32; break; + data32[0] = intvalue; data = (const unsigned char *) data32; break; } tmp = strtok(NULL,","); while(tmp != NULL){ @@ -1733,11 +1734,11 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) type = XA_INTEGER; switch (size) { case 8: - data8 = boolvalue; data = (unsigned char *) &data8; break; + data8 = boolvalue; data = (const unsigned char *) &data8; break; case 16: - data16 = boolvalue; data = (unsigned char *) &data16; break; + data16 = boolvalue; data = (const unsigned char *) &data16; break; case 32: default: - data32 = boolvalue; data = (unsigned char *) &data32; break; + data32 = boolvalue; data = (const unsigned char *) &data32; break; } nelements = 1; break; @@ -1746,7 +1747,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value) static Atom avalue; avalue = Parse_Atom(value, False); type = XA_ATOM; - data = (unsigned char *) &avalue; + data = (const unsigned char *) &avalue; nelements = 1; break; } |