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>
This commit is contained in:
Alan Coopersmith
2011-09-25 11:18:26 -07:00
parent 4e610d4bbc
commit eb9a8904fb
6 changed files with 17 additions and 16 deletions

View File

@@ -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;

View File

@@ -304,7 +304,7 @@ int TRANS(CreateListener)(
);
int TRANS(NoListen) (
char* /* protocol*/
const char* /* protocol*/
);
int TRANS(ResetListener)(

View File

@@ -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 */

View File

@@ -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

View File

@@ -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",

View File

@@ -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)
{