diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-04-09 20:29:46 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-04-09 20:29:46 +0000 |
commit | 5c72c70268d9966794ec1e525e2a8f97b7451d7f (patch) | |
tree | 510cb376bc5303401a8531a884b272e82b221830 /lib/libICE/src | |
parent | 34effda01103f55888704a1c1cca2d2c558be93b (diff) |
Update to libICE 1.0.5.
Main change: ansification.
Bumped major since some symbols which were not part of the public API
have been changed to 'static'.
Diffstat (limited to 'lib/libICE/src')
-rw-r--r-- | lib/libICE/src/ICElibint.h | 3 | ||||
-rw-r--r-- | lib/libICE/src/Makefile.am | 10 | ||||
-rw-r--r-- | lib/libICE/src/accept.c | 16 | ||||
-rw-r--r-- | lib/libICE/src/authutil.c | 110 | ||||
-rw-r--r-- | lib/libICE/src/connect.c | 38 | ||||
-rw-r--r-- | lib/libICE/src/error.c | 194 | ||||
-rw-r--r-- | lib/libICE/src/getauth.c | 79 | ||||
-rw-r--r-- | lib/libICE/src/globals.h | 17 | ||||
-rw-r--r-- | lib/libICE/src/iceauth.c | 103 | ||||
-rw-r--r-- | lib/libICE/src/icetrans.c | 8 | ||||
-rw-r--r-- | lib/libICE/src/listen.c | 65 | ||||
-rw-r--r-- | lib/libICE/src/listenwk.c | 17 | ||||
-rw-r--r-- | lib/libICE/src/locking.c | 19 | ||||
-rw-r--r-- | lib/libICE/src/misc.c | 212 | ||||
-rw-r--r-- | lib/libICE/src/ping.c | 11 | ||||
-rw-r--r-- | lib/libICE/src/process.c | 267 | ||||
-rw-r--r-- | lib/libICE/src/protosetup.c | 27 | ||||
-rw-r--r-- | lib/libICE/src/register.c | 86 | ||||
-rw-r--r-- | lib/libICE/src/replywait.c | 36 | ||||
-rw-r--r-- | lib/libICE/src/setauth.c | 27 | ||||
-rw-r--r-- | lib/libICE/src/shutdown.c | 39 | ||||
-rw-r--r-- | lib/libICE/src/watch.c | 32 |
22 files changed, 597 insertions, 819 deletions
diff --git a/lib/libICE/src/ICElibint.h b/lib/libICE/src/ICElibint.h index fd84fdebf..ca6155321 100644 --- a/lib/libICE/src/ICElibint.h +++ b/lib/libICE/src/ICElibint.h @@ -37,6 +37,9 @@ Author: Ralph Mor, X Consortium #include <X11/ICE/ICEproto.h> #include <X11/ICE/ICEconn.h> #include <X11/ICE/ICEmsg.h> +#ifdef WIN32 +#include <X11/Xwindows.h> +#endif #include <stdlib.h> #include <stddef.h> diff --git a/lib/libICE/src/Makefile.am b/lib/libICE/src/Makefile.am index b549ede14..dc4a0f5cc 100644 --- a/lib/libICE/src/Makefile.am +++ b/lib/libICE/src/Makefile.am @@ -1,7 +1,7 @@ lib_LTLIBRARIES=libICE.la AM_CFLAGS= -I${top_srcdir}/include $(ICE_CFLAGS) $(XTRANS_CFLAGS) \ - -DICE_t -DTRANS_CLIENT -DTRANS_SERVER + -DICE_t -DTRANS_CLIENT -DTRANS_SERVER $(CWARNFLAGS) libICE_la_LDFLAGS = -version-number 6:3:0 -no-undefined @@ -38,3 +38,11 @@ iceinclude_HEADERS=\ $(top_srcdir)/include/X11/ICE/ICEmsg.h \ $(top_srcdir)/include/X11/ICE/ICEproto.h \ $(top_srcdir)/include/X11/ICE/ICEutil.h + +if LINT +ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) + +lint: + $(LINT) $(ALL_LINT_FLAGS) $(libICE_la_SOURCES) $(XINERAMA_LIBS) +endif LINT diff --git a/lib/libICE/src/accept.c b/lib/libICE/src/accept.c index df2b258c5..150d8bd85 100644 --- a/lib/libICE/src/accept.c +++ b/lib/libICE/src/accept.c @@ -36,11 +36,10 @@ Author: Ralph Mor, X Consortium IceConn -IceAcceptConnection (listenObj, statusRet) - -IceListenObj listenObj; -IceAcceptStatus *statusRet; - +IceAcceptConnection ( + IceListenObj listenObj, + IceAcceptStatus *statusRet +) { IceConn iceConn; XtransConnInfo newconn; @@ -51,7 +50,7 @@ IceAcceptStatus *statusRet; * Accept the connection. */ - if ((newconn = _IceTransAccept (listenObj->trans_conn, &status)) == 0) + if ((newconn = _IceTransAccept (listenObj->trans_conn, &status)) == NULL) { if (status == TRANS_ACCEPT_BAD_MALLOC) *statusRet = IceAcceptBadMalloc; @@ -92,8 +91,7 @@ IceAcceptStatus *statusRet; iceConn->send_sequence = 0; iceConn->receive_sequence = 0; - iceConn->connection_string = (char *) malloc ( - strlen (listenObj->network_id) + 1); + iceConn->connection_string = strdup(listenObj->network_id); if (iceConn->connection_string == NULL) { @@ -102,8 +100,6 @@ IceAcceptStatus *statusRet; *statusRet = IceAcceptBadMalloc; return (NULL); } - else - strcpy (iceConn->connection_string, listenObj->network_id); iceConn->vendor = NULL; iceConn->release = NULL; diff --git a/lib/libICE/src/authutil.c b/lib/libICE/src/authutil.c index 1cc58d8a4..2191f06ae 100644 --- a/lib/libICE/src/authutil.c +++ b/lib/libICE/src/authutil.c @@ -55,12 +55,12 @@ extern unsigned sleep (); #endif #endif -static Status read_short (); -static Status read_string (); -static Status read_counted_string (); -static Status write_short (); -static Status write_string (); -static Status write_counted_string (); +static Status read_short (FILE *file, unsigned short *shortp); +static Status read_string (FILE *file, char **stringp); +static Status read_counted_string (FILE *file, unsigned short *countp, char **stringp); +static Status write_short (FILE *file, unsigned short s); +static Status write_string (FILE *file, char *string); +static Status write_counted_string (FILE *file, unsigned short count, char *string); @@ -71,8 +71,7 @@ static Status write_counted_string (); */ char * -IceAuthFileName () - +IceAuthFileName (void) { static char slashDotICEauthority[] = "/.ICEauthority"; char *name; @@ -101,7 +100,7 @@ IceAuthFileName () if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) { len1 = strlen (ptr1); len2 = strlen (ptr2); - } else if (ptr2 = getenv("USERNAME")) { + } else if ((ptr2 = getenv("USERNAME"))) { len1 = strlen (ptr1 = "/users/"); len2 = strlen (ptr2); } @@ -140,13 +139,12 @@ IceAuthFileName () int -IceLockAuthFile (file_name, retries, timeout, dead) - -char *file_name; -int retries; -int timeout; -long dead; - +IceLockAuthFile ( + char *file_name, + int retries, + int timeout, + long dead +) { char creat_name[1025], link_name[1025]; struct stat statb; @@ -217,10 +215,9 @@ long dead; void -IceUnlockAuthFile (file_name) - -char *file_name; - +IceUnlockAuthFile ( + char *file_name +) { #ifndef WIN32 char creat_name[1025]; @@ -246,10 +243,9 @@ char *file_name; IceAuthFileEntry * -IceReadAuthFileEntry (auth_file) - -FILE *auth_file; - +IceReadAuthFileEntry ( + FILE *auth_file +) { IceAuthFileEntry local; IceAuthFileEntry *ret; @@ -298,10 +294,9 @@ FILE *auth_file; void -IceFreeAuthFileEntry (auth) - -IceAuthFileEntry *auth; - +IceFreeAuthFileEntry ( + IceAuthFileEntry *auth +) { if (auth) { @@ -317,11 +312,10 @@ IceAuthFileEntry *auth; Status -IceWriteAuthFileEntry (auth_file, auth) - -FILE *auth_file; -IceAuthFileEntry *auth; - +IceWriteAuthFileEntry ( + FILE *auth_file, + IceAuthFileEntry *auth +) { if (!write_string (auth_file, auth->protocol_name)) return (0); @@ -346,12 +340,11 @@ IceAuthFileEntry *auth; IceAuthFileEntry * -IceGetAuthFileEntry (protocol_name, network_id, auth_name) - -char *protocol_name; -char *network_id; -char *auth_name; - +IceGetAuthFileEntry ( + char *protocol_name, + char *network_id, + char *auth_name +) { FILE *auth_file; char *filename; @@ -393,11 +386,7 @@ char *auth_name; */ static Status -read_short (file, shortp) - -FILE *file; -unsigned short *shortp; - +read_short (FILE *file, unsigned short *shortp) { unsigned char file_short[2]; @@ -410,10 +399,7 @@ unsigned short *shortp; static Status -read_string (file, stringp) - -FILE *file; -char **stringp; +read_string (FILE *file, char **stringp) { unsigned short len; @@ -445,12 +431,7 @@ char **stringp; static Status -read_counted_string (file, countp, stringp) - -FILE *file; -unsigned short *countp; -char **stringp; - +read_counted_string (FILE *file, unsigned short *countp, char **stringp) { unsigned short len; char *data; @@ -460,7 +441,7 @@ char **stringp; if (len == 0) { - data = 0; + data = NULL; } else { @@ -484,11 +465,7 @@ char **stringp; static Status -write_short (file, s) - -FILE *file; -unsigned short s; - +write_short (FILE *file, unsigned short s) { unsigned char file_short[2]; @@ -503,11 +480,7 @@ unsigned short s; static Status -write_string (file, string) - -FILE *file; -char *string; - +write_string (FILE *file, char *string) { unsigned short count = strlen (string); @@ -522,12 +495,7 @@ char *string; static Status -write_counted_string (file, count, string) - -FILE *file; -unsigned short count; -char *string; - +write_counted_string (FILE *file, unsigned short count, char *string) { if (!write_short (file, count)) return (0); diff --git a/lib/libICE/src/connect.c b/lib/libICE/src/connect.c index e06aa04bc..f948a0a5a 100644 --- a/lib/libICE/src/connect.c +++ b/lib/libICE/src/connect.c @@ -36,21 +36,20 @@ Author: Ralph Mor, X Consortium #include <X11/Xtrans/Xtrans.h> #include "globals.h" -static XtransConnInfo ConnectToPeer(); +static XtransConnInfo ConnectToPeer(char *networkIdsList, + char **actualConnectionRet); #define Strstr strstr IceConn -IceOpenConnection (networkIdsList, context, mustAuthenticate, majorOpcodeCheck, - errorLength, errorStringRet) - -char *networkIdsList; -IcePointer context; -Bool mustAuthenticate; -int majorOpcodeCheck; -int errorLength; -char *errorStringRet; - +IceOpenConnection ( + char *networkIdsList, + IcePointer context, + Bool mustAuthenticate, + int majorOpcodeCheck, + int errorLength, + char *errorStringRet +) { IceConn iceConn; int extra, i, j; @@ -431,10 +430,9 @@ char *errorStringRet; IcePointer -IceGetConnectionContext (iceConn) - -IceConn iceConn; - +IceGetConnectionContext ( + IceConn iceConn +) { return (iceConn->context); } @@ -449,11 +447,7 @@ IceConn iceConn; static XtransConnInfo -ConnectToPeer (networkIdsList, actualConnectionRet) - -char *networkIdsList; -char **actualConnectionRet; - +ConnectToPeer (char *networkIdsList, char **actualConnectionRet) { char addrbuf[256]; char* address; @@ -527,9 +521,7 @@ char **actualConnectionRet; * We need to return the actual network connection string */ - *actualConnectionRet = (char *) malloc (strlen (address) + 1); - strcpy (*actualConnectionRet, address); - + *actualConnectionRet = strdup(address); /* * Return the file descriptor diff --git a/lib/libICE/src/error.c b/lib/libICE/src/error.c index 8021ad4cc..44b885378 100644 --- a/lib/libICE/src/error.c +++ b/lib/libICE/src/error.c @@ -40,13 +40,12 @@ Author: Ralph Mor, X Consortium void -_IceErrorBadMinor (iceConn, majorOpcode, offendingMinor, severity) - -IceConn iceConn; -int majorOpcode; -int offendingMinor; -int severity; - +_IceErrorBadMinor ( + IceConn iceConn, + int majorOpcode, + int offendingMinor, + int severity +) { IceErrorHeader (iceConn, majorOpcode, offendingMinor, @@ -60,13 +59,12 @@ int severity; void -_IceErrorBadState (iceConn, majorOpcode, offendingMinor, severity) - -IceConn iceConn; -int majorOpcode; -int offendingMinor; -int severity; - +_IceErrorBadState ( + IceConn iceConn, + int majorOpcode, + int offendingMinor, + int severity +) { IceErrorHeader (iceConn, majorOpcode, offendingMinor, @@ -80,13 +78,12 @@ int severity; void -_IceErrorBadLength (iceConn, majorOpcode, offendingMinor, severity) - -IceConn iceConn; -int majorOpcode; -int offendingMinor; -int severity; - +_IceErrorBadLength ( + IceConn iceConn, + int majorOpcode, + int offendingMinor, + int severity +) { IceErrorHeader (iceConn, majorOpcode, offendingMinor, @@ -100,15 +97,14 @@ int severity; void -_IceErrorBadValue (iceConn, majorOpcode, offendingMinor, offset, length, value) - -IceConn iceConn; -int majorOpcode; -int offendingMinor; -int offset; -int length; /* in bytes */ -IcePointer value; - +_IceErrorBadValue ( + IceConn iceConn, + int majorOpcode, + int offendingMinor, + int offset, + int length, /* in bytes */ + IcePointer value +) { IceErrorHeader (iceConn, majorOpcode, offendingMinor, @@ -129,11 +125,10 @@ IcePointer value; void -_IceErrorNoAuthentication (iceConn, offendingMinor) - -IceConn iceConn; -int offendingMinor; - +_IceErrorNoAuthentication ( + IceConn iceConn, + int offendingMinor +) { int severity = (offendingMinor == ICE_ConnectionSetup) ? IceFatalToConnection : IceFatalToProtocol; @@ -150,11 +145,10 @@ int offendingMinor; void -_IceErrorNoVersion (iceConn, offendingMinor) - -IceConn iceConn; -int offendingMinor; - +_IceErrorNoVersion ( + IceConn iceConn, + int offendingMinor +) { int severity = (offendingMinor == ICE_ConnectionSetup) ? IceFatalToConnection : IceFatalToProtocol; @@ -171,12 +165,11 @@ int offendingMinor; void -_IceErrorSetupFailed (iceConn, offendingMinor, reason) - -IceConn iceConn; -int offendingMinor; -char *reason; - +_IceErrorSetupFailed ( + IceConn iceConn, + int offendingMinor, + char *reason +) { char *pBuf, *pStart; int bytes; @@ -203,12 +196,11 @@ char *reason; void -_IceErrorAuthenticationRejected (iceConn, offendingMinor, reason) - -IceConn iceConn; -int offendingMinor; -char *reason; - +_IceErrorAuthenticationRejected ( + IceConn iceConn, + int offendingMinor, + char *reason +) { char *pBuf, *pStart; int bytes; @@ -233,12 +225,11 @@ char *reason; void -_IceErrorAuthenticationFailed (iceConn, offendingMinor, reason) - -IceConn iceConn; -int offendingMinor; -char *reason; - +_IceErrorAuthenticationFailed ( + IceConn iceConn, + int offendingMinor, + char *reason +) { char *pBuf, *pStart; int bytes; @@ -263,11 +254,10 @@ char *reason; void -_IceErrorProtocolDuplicate (iceConn, protocolName) - -IceConn iceConn; -char *protocolName; - +_IceErrorProtocolDuplicate ( + IceConn iceConn, + char *protocolName +) { char *pBuf, *pStart; int bytes; @@ -292,11 +282,10 @@ char *protocolName; void -_IceErrorMajorOpcodeDuplicate (iceConn, majorOpcode) - -IceConn iceConn; -int majorOpcode; - +_IceErrorMajorOpcodeDuplicate ( + IceConn iceConn, + int majorOpcode +) { char mOp = (char) majorOpcode; @@ -313,11 +302,10 @@ int majorOpcode; void -_IceErrorUnknownProtocol (iceConn, protocolName) - -IceConn iceConn; -char *protocolName; - +_IceErrorUnknownProtocol ( + IceConn iceConn, + char *protocolName +) { char *pBuf, *pStart; int bytes; @@ -342,13 +330,12 @@ char *protocolName; void -_IceErrorBadMajor (iceConn, offendingMajor, offendingMinor, severity) - -IceConn iceConn; -int offendingMajor; -int offendingMinor; -int severity; - +_IceErrorBadMajor ( + IceConn iceConn, + int offendingMajor, + int offendingMinor, + int severity +) { char maj = (char) offendingMajor; @@ -369,18 +356,16 @@ int severity; * Default error handler. */ -void -_IceDefaultErrorHandler (iceConn, swap, - offendingMinorOpcode, offendingSequence, errorClass, severity, values) - -IceConn iceConn; -Bool swap; -int offendingMinorOpcode; -unsigned long offendingSequence; -int errorClass; -int severity; -IcePointer values; - +static void +_IceDefaultErrorHandler ( + IceConn iceConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + IcePointer values +) { char *str; char *pData = (char *) values; @@ -578,6 +563,7 @@ IcePointer values; exit (1); } +IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler; /* @@ -587,10 +573,9 @@ IcePointer values; */ IceErrorHandler -IceSetErrorHandler (handler) - -IceErrorHandler handler; - +IceSetErrorHandler ( + IceErrorHandler handler +) { IceErrorHandler oldHandler = _IceErrorHandler; @@ -608,11 +593,10 @@ IceErrorHandler handler; * Default IO error handler. */ -void -_IceDefaultIOErrorHandler (iceConn) - -IceConn iceConn; - +static void +_IceDefaultIOErrorHandler ( + IceConn iceConn +) { fprintf (stderr, "ICE default IO error handler doing an exit(), pid = %ld, errno = %d\n", @@ -621,6 +605,7 @@ IceConn iceConn; exit (1); } +IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler; /* @@ -631,10 +616,9 @@ IceConn iceConn; */ IceIOErrorHandler -IceSetIOErrorHandler (handler) - -IceIOErrorHandler handler; - +IceSetIOErrorHandler ( + IceIOErrorHandler handler +) { IceIOErrorHandler oldHandler = _IceIOErrorHandler; diff --git a/lib/libICE/src/getauth.c b/lib/libICE/src/getauth.c index 73fcd8aec..664151246 100644 --- a/lib/libICE/src/getauth.c +++ b/lib/libICE/src/getauth.c @@ -35,7 +35,8 @@ Author: Ralph Mor, X Consortium #include "ICElibint.h" #include <X11/ICE/ICEutil.h> -static Bool auth_valid (); +static Bool auth_valid (const char *auth_name, int num_auth_names, + char **auth_names, int *index_ret); extern int _IcePaAuthDataEntryCount; extern IceAuthDataEntry _IcePaAuthDataEntries[]; @@ -59,15 +60,13 @@ extern IceAuthDataEntry _IcePaAuthDataEntries[]; */ void -_IceGetPoAuthData (protocolName, networkId, authName, - authDataLenRet, authDataRet) - -char *protocolName; -char *networkId; -char *authName; -unsigned short *authDataLenRet; -char **authDataRet; - +_IceGetPoAuthData ( + char *protocolName, + char *networkId, + char *authName, + unsigned short *authDataLenRet, + char **authDataRet +) { IceAuthFileEntry *entry; @@ -92,15 +91,13 @@ char **authDataRet; void -_IceGetPaAuthData (protocolName, networkId, authName, - authDataLenRet, authDataRet) - -char *protocolName; -char *networkId; -char *authName; -unsigned short *authDataLenRet; -char **authDataRet; - +_IceGetPaAuthData ( + char *protocolName, + char *networkId, + char *authName, + unsigned short *authDataLenRet, + char **authDataRet +) { IceAuthDataEntry *entry = NULL; int found = 0; @@ -133,16 +130,14 @@ char **authDataRet; void -_IceGetPoValidAuthIndices (protocol_name, network_id, - num_auth_names, auth_names, num_indices_ret, indices_ret) - -char *protocol_name; -char *network_id; -int num_auth_names; -char **auth_names; -int *num_indices_ret; -int *indices_ret; /* in/out arg */ - +_IceGetPoValidAuthIndices ( + char *protocol_name, + char *network_id, + int num_auth_names, + char **auth_names, + int *num_indices_ret, + int *indices_ret /* in/out arg */ +) { FILE *auth_file; char *filename; @@ -194,16 +189,14 @@ int *indices_ret; /* in/out arg */ void -_IceGetPaValidAuthIndices (protocol_name, network_id, - num_auth_names, auth_names, num_indices_ret, indices_ret) - -char *protocol_name; -char *network_id; -int num_auth_names; -char **auth_names; -int *num_indices_ret; -int *indices_ret; /* in/out arg */ - +_IceGetPaValidAuthIndices ( + char *protocol_name, + char *network_id, + int num_auth_names, + char **auth_names, + int *num_indices_ret, + int *indices_ret /* in/out arg */ +) { int index_ret; int i, j; @@ -244,12 +237,8 @@ int *indices_ret; /* in/out arg */ */ static Bool -auth_valid (auth_name, num_auth_names, auth_names, index_ret) - -char *auth_name; -int num_auth_names; -char **auth_names; -int *index_ret; +auth_valid (const char *auth_name, int num_auth_names, + char **auth_names, int *index_ret) { /* diff --git a/lib/libICE/src/globals.h b/lib/libICE/src/globals.h index 0532f5565..f3d095545 100644 --- a/lib/libICE/src/globals.h +++ b/lib/libICE/src/globals.h @@ -28,14 +28,6 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ /* $XFree86: xc/lib/ICE/globals.h,v 1.4 2001/12/14 19:53:35 dawes Exp $ */ -extern void _IceDefaultErrorHandler (); -extern void _IceDefaultIOErrorHandler (); - -extern IcePoAuthStatus _IcePoMagicCookie1Proc (); -extern IcePaAuthStatus _IcePaMagicCookie1Proc (); - -extern void _IceProcessCoreMessage (); - #ifndef __UNIXOS2__ IceConn _IceConnectionObjs[256]; char *_IceConnectionStrings[256]; @@ -51,14 +43,5 @@ int _IceLastMajorOpcode = 0; int _IceAuthCount = 1; char *_IceAuthNames[] = {"MIT-MAGIC-COOKIE-1"}; -IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc}; -IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc}; - -int _IceVersionCount = 1; -_IceVersion _IceVersions[] = { - {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}}; _IceWatchProc *_IceWatchProcs = NULL; - -IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler; -IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler; diff --git a/lib/libICE/src/iceauth.c b/lib/libICE/src/iceauth.c index 01c73ced3..40f1fff56 100644 --- a/lib/libICE/src/iceauth.c +++ b/lib/libICE/src/iceauth.c @@ -38,8 +38,6 @@ Author: Ralph Mor, X Consortium #include <time.h> #define Time_t time_t -static int binaryEqual (); - static int was_called_state; /* @@ -49,10 +47,9 @@ static int was_called_state; char * -IceGenerateMagicCookie (len) - -int len; - +IceGenerateMagicCookie ( + int len +) { char *auth; long ldata[2]; @@ -94,19 +91,17 @@ int len; IcePoAuthStatus -_IcePoMagicCookie1Proc (iceConn, authStatePtr, cleanUp, swap, - authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet) - -IceConn iceConn; -IcePointer *authStatePtr; -Bool cleanUp; -Bool swap; -int authDataLen; -IcePointer authData; -int *replyDataLenRet; -IcePointer *replyDataRet; -char **errorStringRet; - +_IcePoMagicCookie1Proc ( + IceConn iceConn, + IcePointer *authStatePtr, + Bool cleanUp, + Bool swap, + int authDataLen, + IcePointer authData, + int *replyDataLenRet, + IcePointer *replyDataRet, + char **errorStringRet +) { if (cleanUp) { @@ -135,12 +130,10 @@ char **errorStringRet; if (!data) { - char *tempstr = + const char *tempstr = "Could not find correct MIT-MAGIC-COOKIE-1 authentication"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePoAuthFailed); } @@ -161,31 +154,29 @@ char **errorStringRet; * a single pass authentication method. */ - char *tempstr = "MIT-MAGIC-COOKIE-1 authentication internal error"; + const char *tempstr = + "MIT-MAGIC-COOKIE-1 authentication internal error"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePoAuthFailed); } } +IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc}; IcePaAuthStatus -_IcePaMagicCookie1Proc (iceConn, authStatePtr, swap, - authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet) - -IceConn iceConn; -IcePointer *authStatePtr; -Bool swap; -int authDataLen; -IcePointer authData; -int *replyDataLenRet; -IcePointer *replyDataRet; -char **errorStringRet; - +_IcePaMagicCookie1Proc ( + IceConn iceConn, + IcePointer *authStatePtr, + Bool swap, + int authDataLen, + IcePointer authData, + int *replyDataLenRet, + IcePointer *replyDataRet, + char **errorStringRet +) { *errorStringRet = NULL; *replyDataLenRet = 0; @@ -220,17 +211,16 @@ char **errorStringRet; IcePaAuthStatus stat; if (authDataLen == length && - binaryEqual ((char *) authData, data, authDataLen)) + memcmp (authData, data, authDataLen) == 0) { stat = IcePaAuthAccepted; } else { - char *tempstr = "MIT-MAGIC-COOKIE-1 authentication rejected"; + const char *tempstr + = "MIT-MAGIC-COOKIE-1 authentication rejected"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); stat = IcePaAuthRejected; } @@ -246,33 +236,14 @@ char **errorStringRet; * always find a valid entry. */ - char *tempstr = + const char *tempstr = "MIT-MAGIC-COOKIE-1 authentication internal error"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePaAuthFailed); } } } - - -/* - * local routines - */ - -static int -binaryEqual (a, b, len) - -register char *a, *b; -register unsigned len; - -{ - while (len--) - if (*a++ != *b++) - return 0; - return 1; -} +IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc}; diff --git a/lib/libICE/src/icetrans.c b/lib/libICE/src/icetrans.c index 704756fac..52e432b37 100644 --- a/lib/libICE/src/icetrans.c +++ b/lib/libICE/src/icetrans.c @@ -1,6 +1,4 @@ /* - * $Id: icetrans.c,v 1.1 2006/11/25 16:45:58 matthieu Exp $ - * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -26,8 +24,8 @@ #include <config.h> #endif -#define ICE_t -#define TRANS_CLIENT -#define TRANS_SERVER +#define ICE_t 1 +#define TRANS_CLIENT 1 +#define TRANS_SERVER 1 #include <X11/Xtrans/transport.c> diff --git a/lib/libICE/src/listen.c b/lib/libICE/src/listen.c index 7708cfe02..eb46f87f5 100644 --- a/lib/libICE/src/listen.c +++ b/lib/libICE/src/listen.c @@ -37,13 +37,12 @@ Author: Ralph Mor, X Consortium Status -IceListenForConnections (countRet, listenObjsRet, errorLength, errorStringRet) - -int *countRet; -IceListenObj **listenObjsRet; -int errorLength; -char *errorStringRet; - +IceListenForConnections ( + int *countRet, + IceListenObj **listenObjsRet, + int errorLength, + char *errorStringRet +) { struct _IceListenObj *listenObjs; char *networkId; @@ -123,8 +122,10 @@ char *errorStringRet; free ((char *) (*listenObjsRet)[j]); free ((char *) *listenObjsRet); + *listenObjsRet = NULL; status = 0; + break; } else { @@ -159,10 +160,9 @@ char *errorStringRet; int -IceGetListenConnectionNumber (listenObj) - -IceListenObj listenObj; - +IceGetListenConnectionNumber ( + IceListenObj listenObj +) { return (_IceTransGetConnectionNumber (listenObj->trans_conn)); } @@ -170,29 +170,20 @@ IceListenObj listenObj; char * -IceGetListenConnectionString (listenObj) - -IceListenObj listenObj; - +IceGetListenConnectionString ( + IceListenObj listenObj +) { - char *networkId; - - networkId = (char *) malloc (strlen (listenObj->network_id) + 1); - - if (networkId) - strcpy (networkId, listenObj->network_id); - - return (networkId); + return strdup(listenObj->network_id); } char * -IceComposeNetworkIdList (count, listenObjs) - -int count; -IceListenObj *listenObjs; - +IceComposeNetworkIdList ( + int count, + IceListenObj *listenObjs +) { char *list; int len = 0; @@ -246,11 +237,10 @@ IceListenObj *listenObjs; void -IceFreeListenObjs (count, listenObjs) - -int count; -IceListenObj *listenObjs; - +IceFreeListenObjs ( + int count, + IceListenObj *listenObjs +) { int i; @@ -273,11 +263,10 @@ IceListenObj *listenObjs; */ void -IceSetHostBasedAuthProc (listenObj, hostBasedAuthProc) - -IceListenObj listenObj; -IceHostBasedAuthProc hostBasedAuthProc; - +IceSetHostBasedAuthProc ( + IceListenObj listenObj, + IceHostBasedAuthProc hostBasedAuthProc +) { listenObj->host_based_auth_proc = hostBasedAuthProc; } diff --git a/lib/libICE/src/listenwk.c b/lib/libICE/src/listenwk.c index f97aa44af..f5061c45a 100644 --- a/lib/libICE/src/listenwk.c +++ b/lib/libICE/src/listenwk.c @@ -40,14 +40,13 @@ in this Software without prior written authorization from The Open Group. Status -IceListenForWellKnownConnections (port, countRet, listenObjsRet, errorLength, errorStringRet) - -char *port; -int *countRet; -IceListenObj **listenObjsRet; -int errorLength; -char *errorStringRet; - +IceListenForWellKnownConnections ( + char *port, + int *countRet, + IceListenObj **listenObjsRet, + int errorLength, + char *errorStringRet +) { struct _IceListenObj *listenObjs; char *networkId; @@ -127,8 +126,10 @@ char *errorStringRet; free ((char *) (*listenObjsRet)[j]); free ((char *) *listenObjsRet); + *listenObjsRet = NULL; status = 0; + break; } else { diff --git a/lib/libICE/src/locking.c b/lib/libICE/src/locking.c index 510803030..e504e3f03 100644 --- a/lib/libICE/src/locking.c +++ b/lib/libICE/src/locking.c @@ -40,28 +40,27 @@ Author: Ralph Mor, X Consortium Status -IceInitThreads () - +IceInitThreads ( + void +) { return (0); } void -IceAppLockConn (iceConn) - -IceConn iceConn; - +IceAppLockConn ( + IceConn iceConn +) { IceLockConn (iceConn); } void -IceAppUnlockConn (iceConn) - -IceConn iceConn; - +IceAppUnlockConn ( + IceConn iceConn +) { IceUnlockConn (iceConn); } diff --git a/lib/libICE/src/misc.c b/lib/libICE/src/misc.c index 45c1f7ea0..ea8bbdedb 100644 --- a/lib/libICE/src/misc.c +++ b/lib/libICE/src/misc.c @@ -49,11 +49,10 @@ Author: Ralph Mor, X Consortium */ char * -IceAllocScratch (iceConn, size) - -IceConn iceConn; -unsigned long size; - +IceAllocScratch ( + IceConn iceConn, + unsigned long size +) { if (!iceConn->scratch || size > iceConn->scratch_size) { @@ -74,10 +73,9 @@ unsigned long size; */ int -IceFlush (iceConn) - -IceConn iceConn; - +IceFlush ( + IceConn iceConn +) { _IceWrite (iceConn, (unsigned long) (iceConn->outbufptr - iceConn->outbuf), @@ -89,20 +87,18 @@ IceConn iceConn; int -IceGetOutBufSize (iceConn) - -IceConn iceConn; - +IceGetOutBufSize ( + IceConn iceConn +) { return (iceConn->outbufmax - iceConn->outbuf); } int -IceGetInBufSize (iceConn) - -IceConn iceConn; - +IceGetInBufSize ( + IceConn iceConn +) { return (iceConn->inbufmax - iceConn->inbuf); } @@ -114,90 +110,67 @@ IceConn iceConn; */ IceConnectStatus -IceConnectionStatus (iceConn) - -IceConn iceConn; - +IceConnectionStatus ( + IceConn iceConn +) { return (iceConn->connection_status); } char * -IceVendor (iceConn) - -IceConn iceConn; - +IceVendor ( + IceConn iceConn +) { - char *string = (char *) malloc (strlen (iceConn->vendor) + 1); - - if (string) - strcpy (string, iceConn->vendor); - - return (string); + return strdup(iceConn->vendor); } char * -IceRelease (iceConn) - -IceConn iceConn; - +IceRelease ( + IceConn iceConn +) { - char *string = (char *) malloc (strlen (iceConn->release) + 1); - - if (string) - strcpy (string, iceConn->release); - - return (string); + return strdup(iceConn->release); } int -IceProtocolVersion (iceConn) - -IceConn iceConn; - +IceProtocolVersion ( + IceConn iceConn +) { return (_IceVersions[iceConn->my_ice_version_index].major_version); } int -IceProtocolRevision (iceConn) - -IceConn iceConn; - +IceProtocolRevision ( + IceConn iceConn +) { return (_IceVersions[iceConn->my_ice_version_index].minor_version); } int -IceConnectionNumber (iceConn) - -IceConn iceConn; - +IceConnectionNumber ( + IceConn iceConn +) { return (_IceTransGetConnectionNumber (iceConn->trans_conn)); } char * -IceConnectionString (iceConn) - -IceConn iceConn; - +IceConnectionString ( + IceConn iceConn +) { if (iceConn->connection_string) { - char *string = (char *) malloc ( - strlen (iceConn->connection_string) + 1); - - if (string) - strcpy (string, iceConn->connection_string); - - return (string); + return strdup(iceConn->connection_string); } else return (NULL); @@ -205,30 +178,27 @@ IceConn iceConn; unsigned long -IceLastSentSequenceNumber (iceConn) - -IceConn iceConn; - +IceLastSentSequenceNumber ( + IceConn iceConn +) { return (iceConn->send_sequence); } unsigned long -IceLastReceivedSequenceNumber (iceConn) - -IceConn iceConn; - +IceLastReceivedSequenceNumber ( + IceConn iceConn +) { return (iceConn->receive_sequence); } Bool -IceSwapping (iceConn) - -IceConn iceConn; - +IceSwapping ( + IceConn iceConn +) { return (iceConn->swap); } @@ -243,12 +213,11 @@ IceConn iceConn; */ Status -_IceRead (iceConn, nbytes, ptr) - -register IceConn iceConn; -unsigned long nbytes; -register char *ptr; - +_IceRead ( + register IceConn iceConn, + unsigned long nbytes, + register char *ptr +) { register unsigned long nleft; @@ -343,11 +312,10 @@ register char *ptr; */ void -_IceReadSkip (iceConn, nbytes) - -register IceConn iceConn; -register unsigned long nbytes; - +_IceReadSkip ( + register IceConn iceConn, + register unsigned long nbytes +) { char temp[512]; @@ -367,12 +335,11 @@ register unsigned long nbytes; */ void -_IceWrite (iceConn, nbytes, ptr) - -register IceConn iceConn; -unsigned long nbytes; -register char *ptr; - +_IceWrite ( + register IceConn iceConn, + unsigned long nbytes, + register char *ptr +) { register unsigned long nleft; @@ -443,12 +410,11 @@ register char *ptr; #ifdef WORD64 -IceWriteData16 (iceConn, nbytes, data) - -IceConn iceConn; -unsigned long nbytes; -short *data; - +IceWriteData16 ( + IceConn iceConn, + unsigned long nbytes, + short *data +) { int numShorts = nbytes / 2; int index = 0; @@ -474,12 +440,11 @@ short *data; } -IceWriteData32 (iceConn, nbytes, data) - -IceConn iceConn; -unsigned long nbytes; -int *data; - +IceWriteData32 ( + IceConn iceConn, + unsigned long nbytes, + int *data +) { int numLongs = nbytes / 4; int index = 0; @@ -505,25 +470,23 @@ int *data; } -IceReadData16 (iceConn, swap, nbytes, data) - -IceConn iceConn; -Bool swap; -unsigned long nbytes; -short *data; - +IceReadData16 ( + IceConn iceConn, + Bool swap, + unsigned long nbytes, + short *data +) { /* NOT IMPLEMENTED YET */ } -IceReadData32 (iceConn, swap, nbytes, data) - -IceConn iceConn; -Bool swap; -unsigned long nbytes; -int *data; - +IceReadData32 ( + IceConn iceConn, + Bool swap, + unsigned long nbytes, + int *data +) { /* NOT IMPLEMENTED YET */ } @@ -533,12 +496,11 @@ int *data; void -_IceAddOpcodeMapping (iceConn, hisOpcode, myOpcode) - -IceConn iceConn; -int hisOpcode; -int myOpcode; - +_IceAddOpcodeMapping ( + IceConn iceConn, + int hisOpcode, + int myOpcode +) { if (hisOpcode <= 0 || hisOpcode > 255) { diff --git a/lib/libICE/src/ping.c b/lib/libICE/src/ping.c index 45329b6f5..04fe73571 100644 --- a/lib/libICE/src/ping.c +++ b/lib/libICE/src/ping.c @@ -34,12 +34,11 @@ Author: Ralph Mor, X Consortium #include "ICElibint.h" Status -IcePing (iceConn, pingReplyProc, clientData) - -IceConn iceConn; -IcePingReplyProc pingReplyProc; -IcePointer clientData; - +IcePing ( + IceConn iceConn, + IcePingReplyProc pingReplyProc, + IcePointer clientData +) { _IcePingWait *newping = (_IcePingWait *) malloc (sizeof (_IcePingWait)); _IcePingWait *ptr = iceConn->ping_waits; diff --git a/lib/libICE/src/process.c b/lib/libICE/src/process.c index 2a97dcbe8..77976418c 100644 --- a/lib/libICE/src/process.c +++ b/lib/libICE/src/process.c @@ -124,12 +124,11 @@ Author: Ralph Mor, X Consortium */ IceProcessMessagesStatus -IceProcessMessages (iceConn, replyWait, replyReadyRet) - -IceConn iceConn; -IceReplyWaitInfo *replyWait; -Bool *replyReadyRet; - +IceProcessMessages ( + IceConn iceConn, + IceReplyWaitInfo *replyWait, + Bool *replyReadyRet +) { iceMsg *header; Bool replyReady = False; @@ -390,13 +389,12 @@ Bool *replyReadyRet; static void -AuthRequired (iceConn, authIndex, authDataLen, authData) - -IceConn iceConn; -int authIndex; -int authDataLen; -IcePointer authData; - +AuthRequired ( + IceConn iceConn, + int authIndex, + int authDataLen, + IcePointer authData +) { iceAuthRequiredMsg *pMsg; @@ -418,12 +416,11 @@ IcePointer authData; static void -AuthReply (iceConn, authDataLen, authData) - -IceConn iceConn; -int authDataLen; -IcePointer authData; - +AuthReply ( + IceConn iceConn, + int authDataLen, + IcePointer authData +) { iceAuthReplyMsg *pMsg; @@ -444,12 +441,11 @@ IcePointer authData; static void -AuthNextPhase (iceConn, authDataLen, authData) - -IceConn iceConn; -int authDataLen; -IcePointer authData; - +AuthNextPhase ( + IceConn iceConn, + int authDataLen, + IcePointer authData +) { iceAuthNextPhaseMsg *pMsg; @@ -470,11 +466,10 @@ IcePointer authData; static void -AcceptConnection (iceConn, versionIndex) - -IceConn iceConn; -int versionIndex; - +AcceptConnection ( + IceConn iceConn, + int versionIndex +) { iceConnectionReplyMsg *pMsg; char *pData; @@ -499,15 +494,14 @@ int versionIndex; static void -AcceptProtocol (iceConn, hisOpcode, myOpcode, versionIndex, vendor, release) - -IceConn iceConn; -int hisOpcode; -int myOpcode; -int versionIndex; -char *vendor; -char *release; - +AcceptProtocol ( + IceConn iceConn, + int hisOpcode, + int myOpcode, + int versionIndex, + char *vendor, + char *release +) { iceProtocolReplyMsg *pMsg; char *pData; @@ -540,10 +534,9 @@ char *release; static void -PingReply (iceConn) - -IceConn iceConn; - +PingReply ( + IceConn iceConn +) { IceSimpleMessage (iceConn, 0, ICE_PingReply); IceFlush (iceConn); @@ -552,13 +545,12 @@ IceConn iceConn; static Bool -ProcessError (iceConn, length, swap, replyWait) - -IceConn iceConn; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; - +ProcessError ( + IceConn iceConn, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait +) { int invokeHandler = 0; Bool errorReturned = False; @@ -615,7 +607,7 @@ IceReplyWaitInfo *replyWait; _IceConnectionError *errorReply = &(((_IceReply *) (replyWait->reply))->connection_error); char *errorStr = NULL; - char *tempstr; + const char *tempstr; char *prefix, *temp; invokeHandler = 0; @@ -627,16 +619,14 @@ IceReplyWaitInfo *replyWait; tempstr = "None of the ICE versions specified are supported"; - errorStr = (char *) malloc (strlen (tempstr) + 1); - strcpy (errorStr, tempstr); + errorStr = strdup(tempstr); break; case IceNoAuth: tempstr = "None of the authentication protocols specified are supported"; - errorStr = (char *) malloc (strlen (tempstr) + 1); - strcpy (errorStr, tempstr); + errorStr = strdup(tempstr); break; case IceSetupFailed: @@ -697,16 +687,14 @@ IceReplyWaitInfo *replyWait; temp = "None of the protocol versions specified are supported"; - errorStr = (char *) malloc (strlen (temp) + 1); - strcpy (errorStr, temp); + errorStr = strdup(temp); break; case IceNoAuth: temp = "None of the authentication protocols specified are supported"; - errorStr = (char *) malloc (strlen (temp) + 1); - strcpy (errorStr, temp); + errorStr = strdup(temp); break; case IceSetupFailed: @@ -826,12 +814,11 @@ IceReplyWaitInfo *replyWait; static int -ProcessConnectionSetup (iceConn, length, swap) - -IceConn iceConn; -unsigned long length; -Bool swap; - +ProcessConnectionSetup ( + IceConn iceConn, + unsigned long length, + Bool swap +) { iceConnectionSetupMsg *message; int myVersionCount, hisVersionCount; @@ -1081,13 +1068,12 @@ Bool swap; static Bool -ProcessAuthRequired (iceConn, length, swap, replyWait) - -IceConn iceConn; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; - +ProcessAuthRequired ( + IceConn iceConn, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait +) { iceAuthRequiredMsg *message; int authDataLen; @@ -1129,11 +1115,11 @@ IceReplyWaitInfo *replyWait; _IceConnectionError *errorReply = &(((_IceReply *) (replyWait->reply))->connection_error); - char *tempstr = "Received bad authIndex in the AuthRequired message"; + const char *tempstr + = "Received bad authIndex in the AuthRequired message"; char errIndex = (int) message->authIndex; - errorString = (char *) malloc (strlen (tempstr) + 1); - strcpy (errorString, tempstr); + errorString = strdup(tempstr); errorReply->type = ICE_CONNECTION_ERROR; errorReply->error_message = errorString; @@ -1159,11 +1145,11 @@ IceReplyWaitInfo *replyWait; _IceProtocolError *errorReply = &(((_IceReply *) (replyWait->reply))->protocol_error); - char *tempstr = "Received bad authIndex in the AuthRequired message"; + const char *tempstr + = "Received bad authIndex in the AuthRequired message"; char errIndex = (int) message->authIndex; - errorString = (char *) malloc (strlen (tempstr) + 1); - strcpy (errorString, tempstr); + errorString = strdup(tempstr); errorReply->type = ICE_PROTOCOL_ERROR; errorReply->error_message = errorString; @@ -1276,12 +1262,11 @@ IceReplyWaitInfo *replyWait; static int -ProcessAuthReply (iceConn, length, swap) - -IceConn iceConn; -unsigned long length; -Bool swap; - +ProcessAuthReply ( + IceConn iceConn, + unsigned long length, + Bool swap +) { iceAuthReplyMsg *message; int replyDataLen; @@ -1572,13 +1557,12 @@ Bool swap; static Bool -ProcessAuthNextPhase (iceConn, length, swap, replyWait) - -IceConn iceConn; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; - +ProcessAuthNextPhase ( + IceConn iceConn, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait +) { iceAuthNextPhaseMsg *message; int authDataLen; @@ -1705,13 +1689,12 @@ IceReplyWaitInfo *replyWait; static Bool -ProcessConnectionReply (iceConn, length, swap, replyWait) - -IceConn iceConn; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; - +ProcessConnectionReply ( + IceConn iceConn, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait +) { iceConnectionReplyMsg *message; char *pData, *pStart, *pEnd; @@ -1808,12 +1791,11 @@ IceReplyWaitInfo *replyWait; static int -ProcessProtocolSetup (iceConn, length, swap) - -IceConn iceConn; -unsigned long length; -Bool swap; - +ProcessProtocolSetup ( + IceConn iceConn, + unsigned long length, + Bool swap +) { iceProtocolSetupMsg *message; _IcePaProtocol *myProtocol; @@ -2206,13 +2188,12 @@ Bool swap; static Bool -ProcessProtocolReply (iceConn, length, swap, replyWait) - -IceConn iceConn; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; - +ProcessProtocolReply ( + IceConn iceConn, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait +) { iceProtocolReplyMsg *message; char *pData, *pStart, *pEnd; @@ -2321,11 +2302,10 @@ IceReplyWaitInfo *replyWait; static int -ProcessPing (iceConn, length) - -IceConn iceConn; -unsigned long length; - +ProcessPing ( + IceConn iceConn, + unsigned long length +) { CHECK_SIZE_MATCH (iceConn, ICE_Ping, length, SIZEOF (icePingMsg), IceFatalToConnection, 0); @@ -2338,11 +2318,10 @@ unsigned long length; static int -ProcessPingReply (iceConn, length) - -IceConn iceConn; -unsigned long length; - +ProcessPingReply ( + IceConn iceConn, + unsigned long length +) { CHECK_SIZE_MATCH (iceConn, ICE_PingReply, length, SIZEOF (icePingReplyMsg), IceFatalToConnection, 0); @@ -2368,12 +2347,11 @@ unsigned long length; static int -ProcessWantToClose (iceConn, length, connectionClosedRet) - -IceConn iceConn; -unsigned long length; -Bool *connectionClosedRet; - +ProcessWantToClose ( + IceConn iceConn, + unsigned long length, + Bool *connectionClosedRet +) { *connectionClosedRet = False; @@ -2428,11 +2406,10 @@ Bool *connectionClosedRet; static int -ProcessNoClose (iceConn, length) - -IceConn iceConn; -unsigned long length; - +ProcessNoClose ( + IceConn iceConn, + unsigned long length +) { CHECK_SIZE_MATCH (iceConn, ICE_NoClose, length, SIZEOF (iceNoCloseMsg), IceFatalToConnection, 0); @@ -2456,18 +2433,16 @@ unsigned long length; -void -_IceProcessCoreMessage (iceConn, opcode, length, swap, - replyWait, replyReadyRet, connectionClosedRet) - -IceConn iceConn; -int opcode; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; -Bool *replyReadyRet; -Bool *connectionClosedRet; - +static void +_IceProcessCoreMessage ( + IceConn iceConn, + int opcode, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait, + Bool *replyReadyRet, + Bool *connectionClosedRet +) { Bool replyReady = False; @@ -2546,3 +2521,7 @@ Bool *connectionClosedRet; *replyReadyRet = replyReady; } +int _IceVersionCount = 1; +_IceVersion _IceVersions[] = { + {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}}; + diff --git a/lib/libICE/src/protosetup.c b/lib/libICE/src/protosetup.c index 7a21e2e1d..c6f19e14c 100644 --- a/lib/libICE/src/protosetup.c +++ b/lib/libICE/src/protosetup.c @@ -36,21 +36,18 @@ Author: Ralph Mor, X Consortium IceProtocolSetupStatus -IceProtocolSetup (iceConn, myOpcode, clientData, mustAuthenticate, - majorVersionRet, minorVersionRet, vendorRet, releaseRet, - errorLength, errorStringRet) - -IceConn iceConn; -int myOpcode; -IcePointer clientData; -Bool mustAuthenticate; -int *majorVersionRet; -int *minorVersionRet; -char **vendorRet; -char **releaseRet; -int errorLength; -char *errorStringRet; - +IceProtocolSetup ( + IceConn iceConn, + int myOpcode, + IcePointer clientData, + Bool mustAuthenticate, + int *majorVersionRet, + int *minorVersionRet, + char **vendorRet, + char **releaseRet, + int errorLength, + char *errorStringRet +) { iceProtocolSetupMsg *pMsg; char *pData; diff --git a/lib/libICE/src/register.c b/lib/libICE/src/register.c index 20e60dfdf..ac04df53f 100644 --- a/lib/libICE/src/register.c +++ b/lib/libICE/src/register.c @@ -34,19 +34,17 @@ Author: Ralph Mor, X Consortium #include "ICElibint.h" int -IceRegisterForProtocolSetup (protocolName, vendor, release, - versionCount, versionRecs, authCount, authNames, authProcs, IOErrorProc) - -char *protocolName; -char *vendor; -char *release; -int versionCount; -IcePoVersionRec *versionRecs; -int authCount; -char **authNames; -IcePoAuthProc *authProcs; -IceIOErrorProc IOErrorProc; - +IceRegisterForProtocolSetup ( + char *protocolName, + char *vendor, + char *release, + int versionCount, + IcePoVersionRec *versionRecs, + int authCount, + const char **authNames, + IcePoAuthProc *authProcs, + IceIOErrorProc IOErrorProc +) { _IcePoProtocol *p; int opcodeRet, i; @@ -85,8 +83,7 @@ IceIOErrorProc IOErrorProc; char *name; _IceProtocols[_IceLastMajorOpcode].protocol_name = name = - (char *) malloc (strlen (protocolName) + 1); - strcpy (name, protocolName); + strdup(protocolName); p = _IceProtocols[_IceLastMajorOpcode].orig_client = (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol)); @@ -96,11 +93,8 @@ IceIOErrorProc IOErrorProc; opcodeRet = ++_IceLastMajorOpcode; } - p->vendor = (char *) malloc (strlen (vendor) + 1); - strcpy (p->vendor, vendor); - - p->release = (char *) malloc (strlen (release) + 1); - strcpy (p->release, release); + p->vendor = strdup(vendor); + p->release = strdup(release); p->version_count = versionCount; @@ -119,10 +113,7 @@ IceIOErrorProc IOErrorProc; for (i = 0; i < authCount; i++) { - p->auth_names[i] = - (char *) malloc (strlen (authNames[i]) + 1); - strcpy (p->auth_names[i], authNames[i]); - + p->auth_names[i] = strdup(authNames[i]); p->auth_procs[i] = authProcs[i]; } } @@ -140,24 +131,20 @@ IceIOErrorProc IOErrorProc; int -IceRegisterForProtocolReply (protocolName, vendor, release, - versionCount, versionRecs, authCount, authNames, authProcs, - hostBasedAuthProc, protocolSetupProc, protocolActivateProc, - IOErrorProc) - -char *protocolName; -char *vendor; -char *release; -int versionCount; -IcePaVersionRec *versionRecs; -int authCount; -char **authNames; -IcePaAuthProc *authProcs; -IceHostBasedAuthProc hostBasedAuthProc; -IceProtocolSetupProc protocolSetupProc; -IceProtocolActivateProc protocolActivateProc; -IceIOErrorProc IOErrorProc; - +IceRegisterForProtocolReply ( + char *protocolName, + char *vendor, + char *release, + int versionCount, + IcePaVersionRec *versionRecs, + int authCount, + const char **authNames, + IcePaAuthProc *authProcs, + IceHostBasedAuthProc hostBasedAuthProc, + IceProtocolSetupProc protocolSetupProc, + IceProtocolActivateProc protocolActivateProc, + IceIOErrorProc IOErrorProc +) { _IcePaProtocol *p; int opcodeRet, i; @@ -197,8 +184,7 @@ IceIOErrorProc IOErrorProc; char *name; _IceProtocols[_IceLastMajorOpcode].protocol_name = name = - (char *) malloc (strlen (protocolName) + 1); - strcpy (name, protocolName); + strdup(protocolName); _IceProtocols[_IceLastMajorOpcode].orig_client = NULL; @@ -208,11 +194,8 @@ IceIOErrorProc IOErrorProc; opcodeRet = ++_IceLastMajorOpcode; } - p->vendor = (char *) malloc (strlen (vendor) + 1); - strcpy (p->vendor, vendor); - - p->release = (char *) malloc (strlen (release) + 1); - strcpy (p->release, release); + p->vendor = strdup(vendor); + p->release = strdup(release); p->version_count = versionCount; @@ -234,10 +217,7 @@ IceIOErrorProc IOErrorProc; for (i = 0; i < authCount; i++) { - p->auth_names[i] = - (char *) malloc (strlen (authNames[i]) + 1); - strcpy (p->auth_names[i], authNames[i]); - + p->auth_names[i] = strdup(authNames[i]); p->auth_procs[i] = authProcs[i]; } } diff --git a/lib/libICE/src/replywait.c b/lib/libICE/src/replywait.c index e00eb9285..4e9ee1663 100644 --- a/lib/libICE/src/replywait.c +++ b/lib/libICE/src/replywait.c @@ -35,11 +35,10 @@ Author: Ralph Mor, X Consortium void -_IceAddReplyWait (iceConn, replyWait) - -IceConn iceConn; -IceReplyWaitInfo *replyWait; - +_IceAddReplyWait ( + IceConn iceConn, + IceReplyWaitInfo *replyWait +) { /* * Add this replyWait to the end of the list (only if the @@ -77,11 +76,10 @@ IceReplyWaitInfo *replyWait; IceReplyWaitInfo * -_IceSearchReplyWaits (iceConn, majorOpcode) - -IceConn iceConn; -int majorOpcode; - +_IceSearchReplyWaits ( + IceConn iceConn, + int majorOpcode +) { /* * Return the first replyWait in the list with the given majorOpcode @@ -101,11 +99,10 @@ int majorOpcode; void -_IceSetReplyReady (iceConn, replyWait) - -IceConn iceConn; -IceReplyWaitInfo *replyWait; - +_IceSetReplyReady ( + IceConn iceConn, + IceReplyWaitInfo *replyWait +) { /* * The replyWait specified has a reply ready. @@ -123,11 +120,10 @@ IceReplyWaitInfo *replyWait; Bool -_IceCheckReplyReady (iceConn, replyWait) - -IceConn iceConn; -IceReplyWaitInfo *replyWait; - +_IceCheckReplyReady ( + IceConn iceConn, + IceReplyWaitInfo *replyWait +) { _IceSavedReplyWait *savedReplyWait = iceConn->saved_reply_waits; _IceSavedReplyWait *prev = NULL; diff --git a/lib/libICE/src/setauth.c b/lib/libICE/src/setauth.c index 4fd77182a..e20af09f7 100644 --- a/lib/libICE/src/setauth.c +++ b/lib/libICE/src/setauth.c @@ -60,11 +60,10 @@ IceAuthDataEntry _IcePaAuthDataEntries[ICE_MAX_AUTH_DATA_ENTRIES] = {0}; void -IceSetPaAuthData (numEntries, entries) - -int numEntries; -IceAuthDataEntry *entries; - +IceSetPaAuthData ( + int numEntries, + IceAuthDataEntry *entries +) { /* * _IcePaAuthDataEntries should really be a linked list. @@ -96,20 +95,14 @@ IceAuthDataEntry *entries; _IcePaAuthDataEntryCount++; } - _IcePaAuthDataEntries[j].protocol_name = (char *) malloc ( - strlen (entries[i].protocol_name) + 1); - strcpy (_IcePaAuthDataEntries[j].protocol_name, - entries[i].protocol_name); + _IcePaAuthDataEntries[j].protocol_name + = strdup(entries[i].protocol_name); - _IcePaAuthDataEntries[j].network_id = (char *) malloc ( - strlen (entries[i].network_id) + 1); - strcpy (_IcePaAuthDataEntries[j].network_id, - entries[i].network_id); + _IcePaAuthDataEntries[j].network_id + = strdup(entries[i].network_id); - _IcePaAuthDataEntries[j].auth_name = (char *) malloc ( - strlen (entries[i].auth_name) + 1); - strcpy (_IcePaAuthDataEntries[j].auth_name, - entries[i].auth_name); + _IcePaAuthDataEntries[j].auth_name + = strdup(entries[i].auth_name); _IcePaAuthDataEntries[j].auth_data_length = entries[i].auth_data_length; diff --git a/lib/libICE/src/shutdown.c b/lib/libICE/src/shutdown.c index 5c957c7bb..e928be280 100644 --- a/lib/libICE/src/shutdown.c +++ b/lib/libICE/src/shutdown.c @@ -37,11 +37,10 @@ Author: Ralph Mor, X Consortium Status -IceProtocolShutdown (iceConn, majorOpcode) - -IceConn iceConn; -int majorOpcode; - +IceProtocolShutdown ( + IceConn iceConn, + int majorOpcode +) { if (iceConn->proto_ref_count == 0 || iceConn->process_msg_info == NULL || majorOpcode < 1 || majorOpcode > _IceLastMajorOpcode) @@ -87,11 +86,10 @@ int majorOpcode; void -IceSetShutdownNegotiation (iceConn, negotiate) - -IceConn iceConn; -Bool negotiate; - +IceSetShutdownNegotiation ( + IceConn iceConn, + Bool negotiate +) { iceConn->skip_want_to_close = negotiate ? False : True; } @@ -99,10 +97,9 @@ Bool negotiate; Bool -IceCheckShutdownNegotiation (iceConn) - -IceConn iceConn; - +IceCheckShutdownNegotiation ( + IceConn iceConn +) { return (iceConn->skip_want_to_close ? False : True); } @@ -110,10 +107,9 @@ IceConn iceConn; IceCloseStatus -IceCloseConnection (iceConn) - -IceConn iceConn; - +IceCloseConnection ( + IceConn iceConn +) { int refCountReachedZero; IceCloseStatus status; @@ -253,10 +249,9 @@ IceConn iceConn; void -_IceFreeConnection (iceConn) - -IceConn iceConn; - +_IceFreeConnection ( + IceConn iceConn +) { if (iceConn->listen_obj == NULL) { diff --git a/lib/libICE/src/watch.c b/lib/libICE/src/watch.c index ec90d78e4..00897ee75 100644 --- a/lib/libICE/src/watch.c +++ b/lib/libICE/src/watch.c @@ -35,11 +35,10 @@ Author: Ralph Mor, X Consortium Status -IceAddConnectionWatch (watchProc, clientData) - -IceWatchProc watchProc; -IcePointer clientData; - +IceAddConnectionWatch ( + IceWatchProc watchProc, + IcePointer clientData +) { /* * watchProc will be called each time an ICE connection is @@ -94,11 +93,10 @@ IcePointer clientData; void -IceRemoveConnectionWatch (watchProc, clientData) - -IceWatchProc watchProc; -IcePointer clientData; - +IceRemoveConnectionWatch ( + IceWatchProc watchProc, + IcePointer clientData +) { _IceWatchProc *currWatchProc = _IceWatchProcs; _IceWatchProc *prevWatchProc = NULL; @@ -135,10 +133,9 @@ IcePointer clientData; void -_IceConnectionOpened (iceConn) - -IceConn iceConn; - +_IceConnectionOpened ( + IceConn iceConn +) { _IceWatchProc *watchProc = _IceWatchProcs; @@ -170,10 +167,9 @@ IceConn iceConn; void -_IceConnectionClosed (iceConn) - -IceConn iceConn; - +_IceConnectionClosed ( + IceConn iceConn +) { _IceWatchProc *watchProc = _IceWatchProcs; |