From 14c468aa6681df233ce2ee885b6cfb51010ef7eb Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 10 May 1994 09:49:18 +0000 Subject: Removed useless default impl of virtual functions replaced TRUE/FALSE by true/false --- comm/Address.cc | 58 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'comm/Address.cc') diff --git a/comm/Address.cc b/comm/Address.cc index e86d9bb..af2e1ae 100644 --- a/comm/Address.cc +++ b/comm/Address.cc @@ -20,7 +20,21 @@ #include #include #include +#ifdef __osf__ +extern "C" { +#endif #include +#ifdef __osf__ +} +#endif + +#ifdef __osf__ +extern "C" { + unsigned short htons (unsigned short); + unsigned short ntohs (unsigned short); + int gethostname (char*, int); +} +#endif /*?class UchAddress This class is a virtual base class: no objects of this class are ever created. @@ -41,7 +55,7 @@ pointed to objects for an automatic reclaim of dynamically allocated objects. Construct an invalid address. ?*/ UchAddress :: UchAddress () -: Valid (FALSE) +: Valid (false) { } @@ -50,8 +64,16 @@ UchAddress :: ~UchAddress () { } -// virtual functions for class address -// +#ifdef DOC +// fake entries for inline functions + +/*? +Return true if the address is valid. +?*/ +bool +UchAddress :: IsValid () +{ +} /*? Return one of \var{AF\_UNSPEC}, \var{AF\_UNIX} or \var{AF\_INET}. @@ -60,14 +82,12 @@ Other values may be defined if supported by the system. int UchAddress :: Family () { - return AF_UNSPEC; } /*?nextdoc?*/ int UchAddress :: Length () { - return 0; } /*? @@ -77,16 +97,14 @@ Return the address structure and its length. SockAddr* UchAddress :: GetSockAddr () { - return 0; } /*?nodoc?*/ char* UchAddress :: StrRepr (char* buf) { - strcpy (buf, "virtual address !"); - return buf; } +#endif /* DOC */ #ifdef UNIX_SOCK @@ -100,7 +118,6 @@ UchAddress :: StrRepr (char* buf) UchUnixAddress :: UchUnixAddress () : UchAddress () { - // nothing } /*? @@ -113,8 +130,9 @@ UchUnixAddress :: UchUnixAddress (const char* filename) { Addr.sun_family = AF_UNIX; strcpy (Addr.sun_path, filename); - Valid = TRUE; // should check access to file ??? - // unlink if already there ? + Valid = true; + // should check access to file ??? + // unlink if already there ? } /*?nodoc?*/ @@ -167,7 +185,6 @@ UchUnixAddress :: StrRepr (char* buf) UchInetAddress :: UchInetAddress () : UchAddress () { - // nothing } /*? @@ -180,10 +197,8 @@ If the port number is 0, it will be allocated by the system. UchInetAddress :: UchInetAddress (const char* name, sword port) : UchAddress () { - struct hostent *host; - if (name && *name) { - host = gethostbyname (name); + struct hostent *host = gethostbyname (name); if (! host) return; memcpy (&Addr.sin_addr, host->h_addr, host->h_length); @@ -191,7 +206,7 @@ UchInetAddress :: UchInetAddress (const char* name, sword port) Addr.sin_addr.s_addr = name ? INADDR_LOOPBACK : INADDR_ANY; Addr.sin_family = AF_INET; Addr.sin_port = htons (port); - Valid = TRUE; + Valid = true; } /*? @@ -208,7 +223,7 @@ UchInetAddress :: UchInetAddress (lword host, sword port) Addr.sin_family = AF_INET; Addr.sin_port = htons (port); Addr.sin_addr.s_addr = host; - Valid = TRUE; + Valid = true; } /*?nodoc?*/ @@ -323,15 +338,6 @@ UchInetAddress :: LoopBack () } #ifdef DOC -// fake entries for inline functions - -/*? -Return TRUE if the address is valid. -?*/ -bool -UchAddress :: IsValid () -{} - /*? Return the host number of the address. ?*/ -- cgit v1.1