From 509bceb0f731f580903a32e4861b863a512dfd0b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 16 Apr 2012 15:45:01 -0700 Subject: Add const qualifiers to clear gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith --- config.c | 8 +++----- config.h | 8 ++++---- main.c | 10 +++++----- pmint.h | 6 +++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/config.c b/config.c index 021eb74..8315f17 100644 --- a/config.c +++ b/config.c @@ -73,9 +73,7 @@ FILE *f) #ifdef NEED_STRCASECMP int -ncasecmp (str1, str2, n) - char *str1, *str2; - int n; +ncasecmp (const char *str1, const char *str2, int n) { char buf1[512],buf2[512]; char c, *s; @@ -104,8 +102,8 @@ ncasecmp (str1, str2, n) Status GetConfig ( - char *configFile, - char *serviceName, + const char *configFile, + const char *serviceName, Bool *managed, char **startCommand, char **proxyAddress) diff --git a/config.h b/config.h index 13b7f96..26c616e 100644 --- a/config.h +++ b/config.h @@ -28,8 +28,8 @@ from The Open Group. Status GetConfig ( - char *configFile, - char *proxyService, + const char *configFile, + const char *serviceName, Bool *managed, char **startCommand, char **proxyAddress); @@ -37,8 +37,8 @@ GetConfig ( #ifdef NEED_STRCASECMP int ncasecmp ( - char *str1, - char *str2, + const char *str1, + const char *str2, int n); #else #include diff --git a/main.c b/main.c index 64ae1fd..d4ffc78 100644 --- a/main.c +++ b/main.c @@ -60,8 +60,8 @@ static IcePaVersionRec PMReplyVersions[] = {{PM_MAJOR_VERSION, PM_MINOR_VERSION, static IcePoVersionRec PMSetupVersions[] = {{PM_MAJOR_VERSION, PM_MINOR_VERSION, PMSetupProcessMessages}}; -char *PM_VENDOR_STRING = XVENDORNAME; -char *PM_VENDOR_RELEASE = XORG_RELEASE; +const char *PM_VENDOR_STRING = XVENDORNAME; +const char *PM_VENDOR_RELEASE = XORG_RELEASE; int verbose = 0; @@ -69,7 +69,7 @@ static XtAppContext appContext; #define PM_PORT "6500" -static char *configFile = NULL; +static const char *configFile = NULL; void Usage(void) @@ -355,8 +355,8 @@ void SendGetProxyAddrReply ( PMconn *requestor, int status, - char *addr, - char *error) + const char *addr, + const char *error) { int len = STRING_BYTES (addr) + STRING_BYTES (error); diff --git a/pmint.h b/pmint.h index 8d81552..9f08187 100644 --- a/pmint.h +++ b/pmint.h @@ -41,8 +41,8 @@ from The Open Group. #define True 1 #define False 0 -extern char *PM_VENDOR_STRING; -extern char *PM_VENDOR_RELEASE; +extern const char *PM_VENDOR_STRING; +extern const char *PM_VENDOR_RELEASE; extern int verbose; @@ -66,7 +66,7 @@ extern void MyIoErrorHandler ( IceConn ice_conn ); extern void NewConnectionXtProc ( XtPointer client_data, int *source, XtInputId *id ); extern void PMReplyProcessMessages ( IceConn iceConn, IcePointer clientData, int opcode, unsigned long length, int swap ); extern void PMSetupProcessMessages ( IceConn iceConn, IcePointer clientData, int opcode, unsigned long length, int swap, IceReplyWaitInfo *replyWait, int *replyReadyRet ); -extern void SendGetProxyAddrReply ( PMconn *requestor, int status, char *addr, char *error ); +extern void SendGetProxyAddrReply ( PMconn *requestor, int status, const char *addr, const char *error ); extern void SetCloseOnExec ( int fd ); extern void Usage ( void ); extern void _XtIceWatchProc ( IceConn ice_conn, IcePointer client_data, int opening, IcePointer *watch_data ); -- cgit v1.2.3