diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 11:29:03 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 11:29:07 -0800 |
commit | 24d38c420d5d60c988f07dd25f7fa81171dac64f (patch) | |
tree | 47d34022ccbff9515e85ed47cf34794c19454df2 | |
parent | e17c2f59266528dce1cfb71798dc6075b74839a3 (diff) |
Fix some gcc -Wwrite-strings warnings
Many are unfixable at the moment due to the libXt API
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | auth.c | 10 | ||||
-rw-r--r-- | choose.c | 6 | ||||
-rw-r--r-- | info.c | 4 | ||||
-rw-r--r-- | misc.c | 2 | ||||
-rw-r--r-- | popup.c | 2 | ||||
-rw-r--r-- | popup.h | 2 | ||||
-rw-r--r-- | printhex.c | 4 | ||||
-rw-r--r-- | remote.c | 7 | ||||
-rw-r--r-- | restart.c | 9 | ||||
-rw-r--r-- | save.c | 6 | ||||
-rw-r--r-- | saveutil.c | 21 | ||||
-rw-r--r-- | saveutil.h | 8 | ||||
-rw-r--r-- | xsm.c | 4 | ||||
-rw-r--r-- | xsm.h | 14 |
14 files changed, 52 insertions, 47 deletions
@@ -82,10 +82,10 @@ write_iceauth(FILE *addfp, FILE *removefp, IceAuthDataEntry *entry) #ifndef HAS_MKSTEMP static char * -unique_filename(char *path, char *prefix) +unique_filename(const char *path, const char *prefix) #else static char * -unique_filename(char *path, char *prefix, int *pFd) +unique_filename(const char *path, const char *prefix, int *pFd) #endif { #ifndef HAS_MKSTEMP @@ -133,7 +133,7 @@ SetAuthentication(int count, IceListenObj *listenObjs, { FILE *addfp = NULL; FILE *removefp = NULL; - char *path; + const char *path; int original_umask; char command[256]; int i; @@ -143,10 +143,10 @@ SetAuthentication(int count, IceListenObj *listenObjs, original_umask = umask (0077); /* disallow non-owner access */ - path = (char *) getenv ("SM_SAVE_DIR"); + path = getenv ("SM_SAVE_DIR"); if (!path) { - path = (char *) getenv ("HOME"); + path = getenv ("HOME"); if (!path) path = "."; } @@ -78,13 +78,13 @@ GetSessionNames(int *count_ret, String **short_names_ret, { DIR *dir; struct dirent *entry; - char *path; + const char *path; int count; - path = (char *) getenv ("SM_SAVE_DIR"); + path = getenv ("SM_SAVE_DIR"); if (!path) { - path = (char *) getenv ("HOME"); + path = getenv ("HOME"); if (!path) path = "."; } @@ -101,7 +101,7 @@ typedef struct { static void -AppendStr(Buffer *buffer, char *str) +AppendStr(Buffer *buffer, const char *str) { int len = strlen (str); @@ -506,7 +506,7 @@ UpdateClientList(void) { ClientRec *client = (ClientRec *) cl->thing; int extra1, extra2; - char *hint; + const char *hint; progName = NULL; restart_service_prop = NULL; @@ -95,7 +95,7 @@ putenv(char *s) int -strbw(char *a, char *b) +strbw(const char *a, const char *b) { return !strncmp (a, b, strlen (b)); } @@ -36,7 +36,7 @@ from The Open Group. void PopupPopup(Widget parent, Widget popup, Bool transient, Bool first_time, - int offset_x, int offset_y, String delAction) + int offset_x, int offset_y, const _XtString delAction) { if (!transient && !first_time) { @@ -36,6 +36,6 @@ from The Open Group. extern void PopupPopup(Widget parent, Widget popup, Bool transient, Bool first_time, int offset_x, int offset_y, - String delAction); + const _XtString delAction); #endif @@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group. #include "xsm.h" -static char *hex_table[] = { /* for printing hex digits */ +static const char *hex_table[] = { /* for printing hex digits */ "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", @@ -69,7 +69,7 @@ fprintfhex(register FILE *fp, unsigned int len, char *cp) for (; len > 0; len--, ucp++) { - register char *s = hex_table[*ucp]; + register const char *s = hex_table[*ucp]; putc (s[0], fp); putc (s[1], fp); } @@ -36,9 +36,10 @@ static char *format_rstart_env(char *str); void -remote_start(char *restart_protocol, char *restart_machine, char *program, - char **args, char *cwd, char **env, - char *non_local_display_env, char *non_local_session_env) +remote_start(const char *restart_protocol, const char *restart_machine, + const char *program, char **args, const char *cwd, + char **env, const char *non_local_display_env, + const char *non_local_session_env) { FILE *fp; int pipefd[2]; @@ -145,7 +145,7 @@ Restart(int flag) List *cl, *pl, *vl; PendingClient *c; Prop *prop; - char *cwd; + const char *cwd; char *program; char **args; char **env; @@ -338,7 +338,7 @@ Restart(int flag) void Clone(ClientRec *client, Bool useSavedState) { - char *cwd; + const char *cwd; char *program; char **args; char **env; @@ -518,14 +518,15 @@ void StartDefaultApps (void) { FILE *f; - char *buf, *p, *home, filename[128]; + char *buf, *p, filename[128]; + const char *home; int buflen, len; /* * First try ~/.xsmstartup, then system.xsm */ - home = (char *) getenv ("HOME"); + home = getenv ("HOME"); if (!home) home = "."; snprintf (filename, sizeof(filename), "%s/.xsmstartup", home); @@ -269,9 +269,9 @@ DoSave(int saveType, int interactStyle, Bool fast) { ClientRec *client; List *cl; - char *_saveType; - char *_shutdown; - char *_interactStyle; + const char *_saveType; + const char *_shutdown; + const char *_interactStyle; if (saveType == SmSaveLocal) _saveType = "Local"; @@ -34,14 +34,14 @@ static char session_save_file[PATH_MAX]; void -set_session_save_file_name(char *session_name) +set_session_save_file_name(const char *session_name) { - char *p; + const char *p; - p = (char *) getenv ("SM_SAVE_DIR"); + p = getenv ("SM_SAVE_DIR"); if (!p) { - p = (char *) getenv ("HOME"); + p = getenv ("HOME"); if (!p) p = "."; } @@ -53,7 +53,7 @@ set_session_save_file_name(char *session_name) int -ReadSave(char *session_name, char **sm_id) +ReadSave(const char *session_name, char **sm_id) { char *buf; int buflen; @@ -297,7 +297,7 @@ SaveClient(FILE *f, ClientRec *client) void -WriteSave(char *sm_id) +WriteSave(const char *sm_id) { ClientRec *client; FILE *f; @@ -405,21 +405,22 @@ WriteSave(char *sm_id) Status -DeleteSession(char *session_name) +DeleteSession(const char *session_name) { char *buf; int buflen; - char *p, *dir; + char *p; + const char *dir; FILE *f; int state; int foundDiscard; char filename[256]; int version_number; - dir = (char *) getenv ("SM_SAVE_DIR"); + dir = getenv ("SM_SAVE_DIR"); if (!dir) { - dir = (char *) getenv ("HOME"); + dir = getenv ("HOME"); if (!dir) dir = "."; } @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include <stdio.h> -extern void set_session_save_file_name(char *session_name); -extern int ReadSave(char *session_name, char **sm_id); -extern void WriteSave(char *sm_id); -extern Status DeleteSession(char *session_name); +extern void set_session_save_file_name(const char *session_name); +extern int ReadSave(const char *session_name, char **sm_id); +extern void WriteSave(const char *sm_id); +extern Status DeleteSession(const char *session_name); extern Bool getnextline(char **pbuf, int *plen, FILE *f); #endif @@ -399,7 +399,7 @@ PropertyChangeXtHandler(Widget w, XtPointer closure, XEvent *event, void -SetWM_DELETE_WINDOW(Widget widget, String delAction) +SetWM_DELETE_WINDOW(Widget widget, const _XtString delAction) { char translation[64]; @@ -1190,7 +1190,7 @@ NewClientProc(SmsConn smsConn, SmPointer managerData, unsigned long *maskRet, if (!newClient) { - char *str = "Memory allocation failed"; + const char *str = "Memory allocation failed"; if ((*failureReasonRet = (char *) XtMalloc (strlen (str) + 1)) != NULL) strcpy (*failureReasonRet, str); @@ -195,14 +195,14 @@ extern XtSignalId sig_term_id, sig_usr1_id; extern void fprintfhex(FILE *fp, unsigned int len, char *cp); extern Status StartSession(char *name, Bool use_default); extern void EndSession(int status); -extern void SetWM_DELETE_WINDOW(Widget widget, String delAction); +extern void SetWM_DELETE_WINDOW(Widget widget, const _XtString delAction); extern void SetAllSensitive(Bool on); extern void FreeClient(ClientRec *client, Bool freeProps); extern void CloseDownClient(ClientRec *client); /* misc.c */ -extern int strbw(char *a, char *b); +extern int strbw(const char *a, const char *b); extern void nomem(void); @@ -219,10 +219,12 @@ extern int System(char *s); #endif /* remote.c */ -extern void remote_start(char *restart_protocol, char *restart_machine, - char *program, char **args, char *cwd, char **env, - char *non_local_display_env, - char *non_local_session_env ); +extern void remote_start(const char *restart_protocol, + const char *restart_machine, + const char *program, char **args, + const char *cwd, char **env, + const char *non_local_display_env, + const char *non_local_session_env ); /* signals.c */ extern void sig_child_handler(int sig); |