summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-25 11:18:26 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-01 08:55:53 -0700
commiteb9a8904fbef61a57ff01c90627ead57055ed62b (patch)
tree1cd0de80e0b9db38aa1b33cf4f6c9dc9bc4e2e5f
parent4e610d4bbcf29cca9dc5dbad29ca820996aaa8c7 (diff)
Add const attributes to fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--Xtrans.c7
-rw-r--r--Xtrans.h2
-rw-r--r--Xtransint.h4
-rw-r--r--Xtranslcl.c8
-rw-r--r--Xtranssock.c10
-rw-r--r--Xtransutil.c2
6 files changed, 17 insertions, 16 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 379cf33..522e543 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -150,7 +150,7 @@ TRANS(FreeConnInfo) (XtransConnInfo ciptr)
#define PROTOBUFSIZE 20
static Xtransport *
-TRANS(SelectTransport) (char *protocol)
+TRANS(SelectTransport) (const char *protocol)
{
char protobuf[PROTOBUFSIZE];
@@ -203,7 +203,8 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*/
char *mybuf, *tmpptr;
- char *_protocol, *_host, *_port;
+ const char *_protocol;
+ char *_host, *_port;
char hostnamebuf[256];
int _host_len;
@@ -759,7 +760,7 @@ TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
}
int
-TRANS(NoListen) (char * protocol)
+TRANS(NoListen) (const char * protocol)
{
Xtransport *trans;
diff --git a/Xtrans.h b/Xtrans.h
index 582b21c..2945b2a 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -304,7 +304,7 @@ int TRANS(CreateListener)(
);
int TRANS(NoListen) (
- char* /* protocol*/
+ const char* /* protocol*/
);
int TRANS(ResetListener)(
diff --git a/Xtransint.h b/Xtransint.h
index 1052777..3bce8dc 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -144,7 +144,7 @@ struct _XtransConnInfo {
typedef struct _Xtransport {
- char *TransName;
+ const char *TransName;
int flags;
#ifdef TRANS_CLIENT
@@ -159,7 +159,7 @@ typedef struct _Xtransport {
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
- char ** nolisten;
+ const char ** nolisten;
XtransConnInfo (*OpenCOTSServer)(
struct _Xtransport *, /* transport */
char *, /* protocol */
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 7acc907..e5b3833 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -1382,7 +1382,7 @@ TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
*/
typedef struct _LOCALtrans2dev {
- char *transname;
+ const char *transname;
#ifdef TRANS_CLIENT
@@ -1643,7 +1643,7 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev))
-static char *XLOCAL=NULL;
+static const char *XLOCAL=NULL;
static char *workingXLOCAL=NULL;
static char *freeXLOCAL=NULL;
@@ -1658,7 +1658,7 @@ static char *freeXLOCAL=NULL;
#endif
static void
-TRANS(LocalInitTransports)(char *protocol)
+TRANS(LocalInitTransports)(const char *protocol)
{
prmsg(3,"LocalInitTransports(%s)\n", protocol);
@@ -2318,7 +2318,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
*/
#ifdef TRANS_SERVER
-static char * local_aliases[] = {
+static const char * local_aliases[] = {
# ifdef LOCAL_TRANS_PTS
"pts",
# endif
diff --git a/Xtranssock.c b/Xtranssock.c
index 775a7f9..1275196 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -172,7 +172,7 @@ from the copyright holders.
*/
typedef struct _Sockettrans2dev {
- char *transname;
+ const char *transname;
int family;
int devcotsname;
int devcltsname;
@@ -254,7 +254,7 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
*/
static int
-TRANS(SocketSelectFamily) (int first, char *family)
+TRANS(SocketSelectFamily) (int first, const char *family)
{
int i;
@@ -538,8 +538,8 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
- char *host, char *port, int previndex)
+TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol,
+ const char *host, const char *port, int previndex)
{
XtransConnInfo ciptr;
int i = previndex;
@@ -2248,7 +2248,7 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
#ifdef TCPCONN
# ifdef TRANS_SERVER
-static char* tcp_nolisten[] = {
+static const char* tcp_nolisten[] = {
"inet",
#if defined(IPv6) && defined(AF_INET6)
"inet6",
diff --git a/Xtransutil.c b/Xtransutil.c
index bf52b37..5dd2453 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -242,7 +242,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
char *addr = ciptr->addr;
char hostnamebuf[256];
char *networkId = NULL;
- char *transName = ciptr->transptr->TransName;
+ const char *transName = ciptr->transptr->TransName;
if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0)
{