summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-19 11:29:03 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-19 11:29:07 -0800
commit24d38c420d5d60c988f07dd25f7fa81171dac64f (patch)
tree47d34022ccbff9515e85ed47cf34794c19454df2
parente17c2f59266528dce1cfb71798dc6075b74839a3 (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.c10
-rw-r--r--choose.c6
-rw-r--r--info.c4
-rw-r--r--misc.c2
-rw-r--r--popup.c2
-rw-r--r--popup.h2
-rw-r--r--printhex.c4
-rw-r--r--remote.c7
-rw-r--r--restart.c9
-rw-r--r--save.c6
-rw-r--r--saveutil.c21
-rw-r--r--saveutil.h8
-rw-r--r--xsm.c4
-rw-r--r--xsm.h14
14 files changed, 52 insertions, 47 deletions
diff --git a/auth.c b/auth.c
index da2cbb6..c8bc653 100644
--- a/auth.c
+++ b/auth.c
@@ -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 = ".";
}
diff --git a/choose.c b/choose.c
index b8cc946..6459b61 100644
--- a/choose.c
+++ b/choose.c
@@ -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 = ".";
}
diff --git a/info.c b/info.c
index 6825765..9de747a 100644
--- a/info.c
+++ b/info.c
@@ -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;
diff --git a/misc.c b/misc.c
index 90e4e6c..3c4c636 100644
--- a/misc.c
+++ b/misc.c
@@ -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));
}
diff --git a/popup.c b/popup.c
index 5c0ef97..17d81b7 100644
--- a/popup.c
+++ b/popup.c
@@ -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)
{
diff --git a/popup.h b/popup.h
index 5bb8181..4a95430 100644
--- a/popup.h
+++ b/popup.h
@@ -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
diff --git a/printhex.c b/printhex.c
index f14ab8b..2b3a79a 100644
--- a/printhex.c
+++ b/printhex.c
@@ -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);
}
diff --git a/remote.c b/remote.c
index 76cde30..54d95ac 100644
--- a/remote.c
+++ b/remote.c
@@ -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];
diff --git a/restart.c b/restart.c
index 0cd7714..57663a5 100644
--- a/restart.c
+++ b/restart.c
@@ -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);
diff --git a/save.c b/save.c
index a6e0757..fc6f4e0 100644
--- a/save.c
+++ b/save.c
@@ -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";
diff --git a/saveutil.c b/saveutil.c
index 19c051b..091763a 100644
--- a/saveutil.c
+++ b/saveutil.c
@@ -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 = ".";
}
diff --git a/saveutil.h b/saveutil.h
index 31af135..ccef344 100644
--- a/saveutil.h
+++ b/saveutil.h
@@ -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
diff --git a/xsm.c b/xsm.c
index 4de4075..18e54fc 100644
--- a/xsm.c
+++ b/xsm.c
@@ -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);
diff --git a/xsm.h b/xsm.h
index c9412f7..dbd3a1d 100644
--- a/xsm.h
+++ b/xsm.h
@@ -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);