[PATCH:libICE] Constify protocol, vendor & release string args to IceRegisterForProtocol*

Jeremy Huddleston jeremyhu at apple.com
Mon Nov 21 21:22:33 PST 2011


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Nov 19, 2011, at 09:43, Alan Coopersmith wrote:

> Needed to resolve gcc -Wwrite-strings warnings in callers.
> These functions only pass the strings to strcmp before calling
> strdup to make their own private copy for storing away.
> 
> While fixing the API docs to match, also fix them to match the existing
> function prototypes, where there were several errors before (including
> just plain missing most of the args to IceRegisterForProtocolReply).
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> doc/ICElib.xml           |   26 ++++++++++++++++++--------
> include/X11/ICE/ICElib.h |   12 ++++++------
> src/register.c           |   12 ++++++------
> 3 files changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/doc/ICElib.xml b/doc/ICElib.xml
> index 60d9dbe..dfa4c8b 100644
> --- a/doc/ICElib.xml
> +++ b/doc/ICElib.xml
> @@ -208,16 +208,15 @@ function should be called for the client that initiates a
> <funcsynopsis id='IceRegisterForProtocolSetup'>
> <funcprototype>
>   <funcdef>int <function>IceRegisterForProtocolSetup</function></funcdef>
> -    <paramdef>char<parameter> *protocol_name</parameter></paramdef>
> -    <paramdef>char<parameter> *vendor</parameter></paramdef>
> -    <paramdef>char<parameter> *release</parameter></paramdef>
> -    <paramdef>int<parameter> *version_count</parameter></paramdef>
> -    <paramdef>int<parameter> *version_count</parameter></paramdef>
> +    <paramdef>const char<parameter> *protocol_name</parameter></paramdef>
> +    <paramdef>const char<parameter> *vendor</parameter></paramdef>
> +    <paramdef>const char<parameter> *release</parameter></paramdef>
> +    <paramdef>int<parameter> version_count</parameter></paramdef>
>     <paramdef>IcePoVersionRec<parameter> *version_recs</parameter></paramdef>
> -    <paramdef>int<parameter> auth_names</parameter></paramdef>
> +    <paramdef>int<parameter> auth_count</parameter></paramdef>
>     <paramdef>char<parameter> **auth_names</parameter></paramdef>
>     <paramdef>IcePoAuthProc<parameter> *auth_procs</parameter></paramdef>
> -    <paramdef>IceIOErrorProc<parameter> *io_error_proc</parameter></paramdef>
> +    <paramdef>IceIOErrorProc<parameter> io_error_proc</parameter></paramdef>
> </funcprototype>
> </funcsynopsis>
> 
> @@ -351,7 +350,18 @@ with a
> <funcsynopsis id='IceRegisterForProtocolReply'>
> <funcprototype>
>   <funcdef>Bool <function>IceRegisterForProtocolReply</function></funcdef>
> -    <paramdef>char<parameter> *host_name</parameter></paramdef>
> +    <paramdef>const char<parameter> *protocol_name</parameter></paramdef>
> +    <paramdef>const char<parameter> *vendor</parameter></paramdef>
> +    <paramdef>const char<parameter> *release</parameter></paramdef>
> +    <paramdef>int<parameter> version_count</parameter></paramdef>
> +    <paramdef>IcePoVersionRec<parameter> *version_recs</parameter></paramdef>
> +    <paramdef>int<parameter> auth_count</parameter></paramdef>
> +    <paramdef>const char<parameter> **auth_names</parameter></paramdef>
> +    <paramdef>IcePoAuthProc<parameter> *auth_procs</parameter></paramdef>
> +    <paramdef>IceHostBasedAuthProc<parameter> host_based_auth_proc</parameter></paramdef>
> +    <paramdef>IceProtocolSetupProc<parameter> protocol_setup_proc</parameter></paramdef>
> +    <paramdef>IceProtocolActivateProc<parameter> protocol_activate_proc</parameter></paramdef>
> +    <paramdef>IceIOErrorProc<parameter> io_error_proc</parameter></paramdef>
> </funcprototype>
> </funcsynopsis>
> 
> diff --git a/include/X11/ICE/ICElib.h b/include/X11/ICE/ICElib.h
> index ba42119..402cbc8 100644
> --- a/include/X11/ICE/ICElib.h
> +++ b/include/X11/ICE/ICElib.h
> @@ -206,9 +206,9 @@ typedef void (*IceIOErrorHandler) (
> _XFUNCPROTOBEGIN
> 
> extern int IceRegisterForProtocolSetup (
> -    char *			/* protocolName */,
> -    char *			/* vendor */,
> -    char *			/* release */,
> +    const char *		/* protocolName */,
> +    const char *		/* vendor */,
> +    const char *		/* release */,
>     int				/* versionCount */,
>     IcePoVersionRec *		/* versionRecs */,
>     int				/* authCount */,
> @@ -218,9 +218,9 @@ extern int IceRegisterForProtocolSetup (
> );
> 
> extern int IceRegisterForProtocolReply (
> -    char *			/* protocolName */,
> -    char *			/* vendor */,
> -    char *			/* release */,
> +    const char *		/* protocolName */,
> +    const char *		/* vendor */,
> +    const char *		/* release */,
>     int				/* versionCount */,
>     IcePaVersionRec *		/* versionRecs */,
>     int				/* authCount */,
> diff --git a/src/register.c b/src/register.c
> index f1b76fb..20a6ad0 100644
> --- a/src/register.c
> +++ b/src/register.c
> @@ -34,9 +34,9 @@ Author: Ralph Mor, X Consortium
> 
> int
> IceRegisterForProtocolSetup (
> -	char			*protocolName,
> -	char			*vendor,
> -	char			*release,
> +	const char		*protocolName,
> +	const char		*vendor,
> +	const char		*release,
> 	int			versionCount,
> 	IcePoVersionRec		*versionRecs,
> 	int			authCount,
> @@ -131,9 +131,9 @@ IceRegisterForProtocolSetup (
> 
> int
> IceRegisterForProtocolReply (
> -	char				*protocolName,
> -	char				*vendor,
> -	char				*release,
> +	const char			*protocolName,
> +	const char			*vendor,
> +	const char			*release,
> 	int				versionCount,
> 	IcePaVersionRec			*versionRecs,
> 	int				authCount,
> -- 
> 1.7.3.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list