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/misc.c | |
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/misc.c')
-rw-r--r-- | lib/libICE/src/misc.c | 212 |
1 files changed, 87 insertions, 125 deletions
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) { |