diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-10-31 03:18:31 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-10-31 03:18:31 +0000 |
commit | 2b7e3509d5cf93ca46a4861801ea447d64da0b1b (patch) | |
tree | b50b9ac47fc714d9b821e09332d82437959ed542 | |
parent | 3c45b78c0cb643a6240ac64095fa783937472372 (diff) | |
download | ATCD-2b7e3509d5cf93ca46a4861801ea447d64da0b1b.tar.gz |
ChangeLogTag:Mon Oct 30 18:56:33 2000 Darrell Brunsch <brunsch@uci.edu>
-rw-r--r-- | ChangeLog | 50 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 50 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 50 | ||||
-rw-r--r-- | ace/INET_Addr.cpp | 148 | ||||
-rw-r--r-- | ace/INET_Addr.h | 79 | ||||
-rw-r--r-- | ace/INET_Addr.i | 41 | ||||
-rw-r--r-- | ace/MEM_Addr.cpp | 2 | ||||
-rw-r--r-- | ace/MEM_Addr.h | 4 | ||||
-rw-r--r-- | ace/MEM_Addr.i | 2 | ||||
-rw-r--r-- | ace/OS.cpp | 4 | ||||
-rw-r--r-- | ace/OS.h | 38 | ||||
-rw-r--r-- | ace/OS.i | 64 | ||||
-rw-r--r-- | ace/Object_Manager.cpp | 4 | ||||
-rw-r--r-- | ace/SOCK_Dgram_Mcast.cpp | 6 | ||||
-rw-r--r-- | ace/SOCK_Dgram_Mcast_QoS.cpp | 3 |
15 files changed, 432 insertions, 113 deletions
diff --git a/ChangeLog b/ChangeLog index e4602ee307e..30e0a355323 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +Mon Oct 30 18:56:33 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + + Changed several of the socket calls to use char instead + of ACE_TCHAR, seeing that no OS supports anything but char. + But I am keeping the ACE_TCHAR or dual char/wchar_t + interfaces on classes higher up the stream. + + methods changed are: + + - gethostbyaddr + - gethostbyname + - gethostbyname2 + - gethostbyaddr_r + - gethostbyname_r + - getprotobyname + - getprotobyname_r + - getservbyname + - getservbyname_r + - inet_addr + - inet_ntoa + - inet_aton + - inet_ntop + - inet_pton + + * ace/INET_Addr.cpp: + * ace/INET_Addr.h: + * ace/INET_Addr.i: + + Fixed references to interface changes and added dual + char/wchar_t interfaces to replace some ACE_TCHAR ones. + + * ace/MEM_Addr.cpp: + * ace/MEM_Addr.h: + * ace/MEM_Addr.i: + + Changed get_host_name and get_host_name to return char * + + * ace/SOCK_Dgram_Mcast.cpp: + * ace/SOCK_Dgram_Mcast_QoS.cpp: + + Fixed all the references to the interface changes. + + * ace/Object_Manager.cpp: + + Added ERROR to the output for AV's and Unhandled Exceptions. + Mon Oct 30 18:51:40 2000 Darrell Brunsch <brunsch@uci.edu> * examples/IPC_SAP/SSL_SAP/SSL-client.dsp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index e4602ee307e..30e0a355323 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,53 @@ +Mon Oct 30 18:56:33 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + + Changed several of the socket calls to use char instead + of ACE_TCHAR, seeing that no OS supports anything but char. + But I am keeping the ACE_TCHAR or dual char/wchar_t + interfaces on classes higher up the stream. + + methods changed are: + + - gethostbyaddr + - gethostbyname + - gethostbyname2 + - gethostbyaddr_r + - gethostbyname_r + - getprotobyname + - getprotobyname_r + - getservbyname + - getservbyname_r + - inet_addr + - inet_ntoa + - inet_aton + - inet_ntop + - inet_pton + + * ace/INET_Addr.cpp: + * ace/INET_Addr.h: + * ace/INET_Addr.i: + + Fixed references to interface changes and added dual + char/wchar_t interfaces to replace some ACE_TCHAR ones. + + * ace/MEM_Addr.cpp: + * ace/MEM_Addr.h: + * ace/MEM_Addr.i: + + Changed get_host_name and get_host_name to return char * + + * ace/SOCK_Dgram_Mcast.cpp: + * ace/SOCK_Dgram_Mcast_QoS.cpp: + + Fixed all the references to the interface changes. + + * ace/Object_Manager.cpp: + + Added ERROR to the output for AV's and Unhandled Exceptions. + Mon Oct 30 18:51:40 2000 Darrell Brunsch <brunsch@uci.edu> * examples/IPC_SAP/SSL_SAP/SSL-client.dsp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index e4602ee307e..30e0a355323 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,53 @@ +Mon Oct 30 18:56:33 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + + Changed several of the socket calls to use char instead + of ACE_TCHAR, seeing that no OS supports anything but char. + But I am keeping the ACE_TCHAR or dual char/wchar_t + interfaces on classes higher up the stream. + + methods changed are: + + - gethostbyaddr + - gethostbyname + - gethostbyname2 + - gethostbyaddr_r + - gethostbyname_r + - getprotobyname + - getprotobyname_r + - getservbyname + - getservbyname_r + - inet_addr + - inet_ntoa + - inet_aton + - inet_ntop + - inet_pton + + * ace/INET_Addr.cpp: + * ace/INET_Addr.h: + * ace/INET_Addr.i: + + Fixed references to interface changes and added dual + char/wchar_t interfaces to replace some ACE_TCHAR ones. + + * ace/MEM_Addr.cpp: + * ace/MEM_Addr.h: + * ace/MEM_Addr.i: + + Changed get_host_name and get_host_name to return char * + + * ace/SOCK_Dgram_Mcast.cpp: + * ace/SOCK_Dgram_Mcast_QoS.cpp: + + Fixed all the references to the interface changes. + + * ace/Object_Manager.cpp: + + Added ERROR to the output for AV's and Unhandled Exceptions. + Mon Oct 30 18:51:40 2000 Darrell Brunsch <brunsch@uci.edu> * examples/IPC_SAP/SSL_SAP/SSL-client.dsp: diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 193cefad21b..93f27515a29 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -35,9 +35,9 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], { ACE_OS::sprintf (s, ACE_LIB_TEXT ("%s:%d"), - (ipaddr_format == 0 - ? this->get_host_name () - : this->get_host_addr ()), + ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0 + ? this->get_host_name () + : this->get_host_addr ()), this->get_port_number ()); return 0; } @@ -113,21 +113,21 @@ ACE_INET_Addr::set (const ACE_INET_Addr &sa) // Transform the string into the current addressing format. int -ACE_INET_Addr::string_to_addr (const ACE_TCHAR s[]) +ACE_INET_Addr::string_to_addr (const char s[]) { ACE_TRACE ("ACE_INET_Addr::string_to_addr"); int result; - ACE_TCHAR *t; + char *t; // Need to make a duplicate since we'll be overwriting the string. ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (s), -1); - ACE_TCHAR *ip_addr = ACE_OS::strchr (t, ':'); + char *ip_addr = ACE_OS::strchr (t, ':'); if (ip_addr == 0) // Assume it's a port number. { - if (ACE_OS::strspn (t, ACE_LIB_TEXT ("1234567890")) + if (ACE_OS::strspn (t, "1234567890") == ACE_OS::strlen (t)) { // port number u_short port = (u_short) ACE_OS::atoi (t); @@ -142,8 +142,7 @@ ACE_INET_Addr::string_to_addr (const ACE_TCHAR s[]) { *ip_addr = '\0'; ++ip_addr; // skip over ':' - if (ACE_OS::strspn (ip_addr, - ACE_LIB_TEXT ("1234567890")) == + if (ACE_OS::strspn (ip_addr, "1234567890") == ACE_OS::strlen (ip_addr)) { u_short port = @@ -159,19 +158,29 @@ ACE_INET_Addr::string_to_addr (const ACE_TCHAR s[]) } int -ACE_INET_Addr::set (const ACE_TCHAR address[]) +ACE_INET_Addr::set (const char address[]) { ACE_TRACE ("ACE_INET_Addr::set"); return this->string_to_addr (address); } -ACE_INET_Addr::ACE_INET_Addr (const ACE_TCHAR address[]) +ACE_INET_Addr::ACE_INET_Addr (const char address[]) : ACE_Addr (AF_INET, sizeof this->inet_addr_) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->set (address); } +#if defined (ACE_HAS_WCHAR) +ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[]) + : ACE_Addr (AF_INET, sizeof this->inet_addr_) +{ + ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); + this->set (address); +} + +#endif /* ACE_HAS_WCHAR */ + // Copy constructor. ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa) @@ -217,7 +226,7 @@ ACE_INET_Addr::set (u_short port_number, int ACE_INET_Addr::set (u_short port_number, - const ACE_TCHAR host_name[], + const char host_name[], int encode) { ACE_TRACE ("ACE_INET_Addr::set"); @@ -272,9 +281,9 @@ ACE_INET_Addr::set (u_short port_number, // <host_name>. int -ACE_INET_Addr::set (const ACE_TCHAR port_name[], - const ACE_TCHAR host_name[], - const ACE_TCHAR protocol[]) +ACE_INET_Addr::set (const char port_name[], + const char host_name[], + const char protocol[]) { ACE_TRACE ("ACE_INET_Addr::set"); @@ -302,9 +311,9 @@ ACE_INET_Addr::set (const ACE_TCHAR port_name[], // address. int -ACE_INET_Addr::set (const ACE_TCHAR port_name[], +ACE_INET_Addr::set (const char port_name[], ACE_UINT32 inet_address, - const ACE_TCHAR protocol[]) + const char protocol[]) { ACE_TRACE ("ACE_INET_Addr::set"); @@ -333,7 +342,28 @@ ACE_INET_Addr::set (const ACE_TCHAR port_name[], ACE_INET_Addr::ACE_INET_Addr (u_short port_number, - const ACE_TCHAR host_name[]) + const char host_name[]) +{ + ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); + if (this->set (port_number, + host_name) == -1) +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_ERROR ((LM_ERROR, + (char *)"ACE_INET_Addr::ACE_INET_Addr: %p\n", + (((char *) host_name == 0) ? + ((char *) "<unknown>") : + ((char *) (host_name))))); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), + ACE_TEXT_CHAR_TO_TCHAR ((host_name == 0) ? + "<unknown>" : host_name))); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ +} + +#if defined (ACE_HAS_WCHAR) +ACE_INET_Addr::ACE_INET_Addr (u_short port_number, + const wchar_t host_name[]) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); if (this->set (port_number, @@ -347,11 +377,12 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, #else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - ((host_name == 0) ? - (ACE_LIB_TEXT ("<unknown>")) : - host_name))); + ACE_TEXT_WCHAR_TO_TCHAR ((host_name == 0) ? + ACE_TEXT_WIDE ("<unknown>") : + host_name))); #endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ } +#endif /* ACE_HAS_WCHAR */ // Creates a ACE_INET_Addr from a sockaddr_in structure. @@ -401,9 +432,9 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, // Creates a ACE_INET_Addr from a PORT_NAME and the remote // HOST_NAME. -ACE_INET_Addr::ACE_INET_Addr (const ACE_TCHAR port_name[], - const ACE_TCHAR host_name[], - const ACE_TCHAR protocol[]) +ACE_INET_Addr::ACE_INET_Addr (const char port_name[], + const char host_name[], + const char protocol[]) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); if (this->set (port_name, @@ -413,12 +444,26 @@ ACE_INET_Addr::ACE_INET_Addr (const ACE_TCHAR port_name[], ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } +#if defined (ACE_HAS_WCHAR) +ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], + const wchar_t host_name[], + const wchar_t protocol[]) +{ + ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); + if (this->set (port_name, + host_name, + protocol) == -1) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); +} +#endif /* ACE_HAS_WCHAR */ + // Creates a ACE_INET_Addr from a PORT_NAME and an Internet address. -ACE_INET_Addr::ACE_INET_Addr (const ACE_TCHAR port_name[], +ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_UINT32 inet_address, - const ACE_TCHAR protocol[]) + const char protocol[]) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); if (this->set (port_name, @@ -428,8 +473,22 @@ ACE_INET_Addr::ACE_INET_Addr (const ACE_TCHAR port_name[], ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } +#if defined (ACE_HAS_WCHAR) +ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], + ACE_UINT32 inet_address, + const wchar_t protocol[]) +{ + ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); + if (this->set (port_name, + inet_address, + protocol) == -1) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); +} +#endif /* ACE_HAS_WCHAR */ + int -ACE_INET_Addr::get_host_name (ACE_TCHAR hostname[], +ACE_INET_Addr::get_host_name (char hostname[], size_t len) const { ACE_TRACE ("ACE_INET_Addr::get_host_name"); @@ -474,7 +533,7 @@ ACE_INET_Addr::get_host_name (ACE_TCHAR hostname[], hostent hentry; ACE_HOSTENT_DATA buf; hostent *hp = - ACE_OS::gethostbyaddr_r (ACE_TEXT_CHAR_TO_TCHAR ((char *)&this->inet_addr_.sin_addr), + ACE_OS::gethostbyaddr_r ((char *)&this->inet_addr_.sin_addr, a_len, this->addr_type_, &hentry, @@ -497,22 +556,47 @@ ACE_INET_Addr::get_host_name (ACE_TCHAR hostname[], return -1; } - ACE_OS::strcpy (hostname, ACE_TEXT_CHAR_TO_TCHAR (hp->h_name)); + ACE_OS::strcpy (hostname, hp->h_name); return 0; #endif /* VXWORKS */ } } +#if defined (ACE_HAS_WCHAR) +int +ACE_INET_Addr::get_host_name (wchar_t hostname[], + size_t len) const +{ + ACE_TRACE ("ACE_INET_Addr::get_host_name"); + + char char_hostname [MAXHOSTNAMELEN + 1]; + + // We have a build in limitation of MAXHOSTNAMELEN + if (len > MAXHOSTNAMELEN + 1) + len = MAXHOSTNAMELEN + 1; + + // Call the char version + int result = this->get_host_name (char_hostname, len); + + // And copy it over, if successful + if (result == 0) + ACE_OS_String::strcpy (hostname, + ACE_Ascii_To_Wide (char_hostname).wchar_rep ()); + + return result; +} +#endif /* ACE_HAS_WCHAR */ + // Return the character representation of the hostname. -const ACE_TCHAR * +const char * ACE_INET_Addr::get_host_name (void) const { ACE_TRACE ("ACE_INET_Addr::get_host_name"); - static ACE_TCHAR name[MAXHOSTNAMELEN + 1]; + static char name[MAXHOSTNAMELEN + 1]; if (this->get_host_name (name, MAXHOSTNAMELEN + 1) == -1) - ACE_OS::strcpy (name, ACE_LIB_TEXT ("<unknown>")); + ACE_OS::strcpy (name, "<unknown>"); return name; } diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h index a55c0b6ae66..fbb9f42527f 100644 --- a/ace/INET_Addr.h +++ b/ace/INET_Addr.h @@ -43,11 +43,11 @@ public: // Creates an <ACE_INET_Addr> from a sockaddr_in structure. ACE_INET_Addr (u_short port_number, - const ACE_TCHAR host_name[]); + const char host_name[]); // Creates an <ACE_INET_Addr> from a <port_number> and the remote // <host_name>. - ACE_EXPLICIT ACE_INET_Addr (const ACE_TCHAR address[]); + ACE_EXPLICIT ACE_INET_Addr (const char address[]); // Initializes an <ACE_INET_Addr> from the <address>, which can be // "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or // "128.252.166.57:1234"). If there is no ':' in the <address> it @@ -60,19 +60,34 @@ public: // <ip_addr>. This method assumes that <port_number> and <ip_addr> // are in host byte order. - ACE_INET_Addr (const ACE_TCHAR port_name[], - const ACE_TCHAR host_name[], - const ACE_TCHAR protocol[] = ACE_LIB_TEXT ("tcp")); + ACE_INET_Addr (const char port_name[], + const char host_name[], + const char protocol[] = "tcp"); // Uses <getservbyname> to create an <ACE_INET_Addr> from a // <port_name>, the remote <host_name>, and the <protocol>. - ACE_INET_Addr (const ACE_TCHAR port_name[], + ACE_INET_Addr (const char port_name[], ACE_UINT32 ip_addr, - const ACE_TCHAR protocol[] = ACE_LIB_TEXT ("tcp")); + const char protocol[] = "tcp"); // Uses <getservbyname> to create an <ACE_INET_Addr> from a // <port_name>, an Internet <ip_addr>, and the <protocol>. This // method assumes that <ip_addr> is in host byte order. +#if defined (ACE_HAS_WCHAR) + ACE_INET_Addr (u_short port_number, + const wchar_t host_name[]); + + ACE_EXPLICIT ACE_INET_Addr (const wchar_t address[]); + + ACE_INET_Addr (const wchar_t port_name[], + const wchar_t host_name[], + const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); + + ACE_INET_Addr (const wchar_t port_name[], + ACE_UINT32 ip_addr, + const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); +#endif /* ACE_HAS_WCHAR */ + ~ACE_INET_Addr (void); // Default dtor. @@ -84,7 +99,7 @@ public: // Initializes from another <ACE_INET_Addr>. int set (u_short port_number, - const ACE_TCHAR host_name[], + const char host_name[], int encode = 1); // Initializes an <ACE_INET_Addr> from a <port_number> and the // remote <host_name>. If <encode> is enabled then <port_number> is @@ -100,20 +115,20 @@ public: // they are assumed to be in network byte order already and are // passed straight through. - int set (const ACE_TCHAR port_name[], - const ACE_TCHAR host_name[], - const ACE_TCHAR protocol[] = ACE_LIB_TEXT ("tcp")); + int set (const char port_name[], + const char host_name[], + const char protocol[] = "tcp"); // Uses <getservbyname> to initialize an <ACE_INET_Addr> from a // <port_name>, the remote <host_name>, and the <protocol>. - int set (const ACE_TCHAR port_name[], + int set (const char port_name[], ACE_UINT32 ip_addr, - const ACE_TCHAR protocol[] = ACE_LIB_TEXT ("tcp")); + const char protocol[] = "tcp"); // Uses <getservbyname> to initialize an <ACE_INET_Addr> from a // <port_name>, an <ip_addr>, and the <protocol>. This assumes that // <ip_addr> is already in network byte order. - int set (const ACE_TCHAR addr[]); + int set (const char addr[]); // Initializes an <ACE_INET_Addr> from the <addr>, which can be // "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or // "128.252.166.57:1234"). If there is no ':' in the <address> it @@ -124,6 +139,22 @@ public: int len); // Creates an <ACE_INET_Addr> from a sockaddr_in structure. +#if defined (ACE_HAS_WCHAR) + int set (u_short port_number, + const wchar_t host_name[], + int encode = 1); + + int set (const wchar_t port_name[], + const wchar_t host_name[], + const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); + + int set (const wchar_t port_name[], + ACE_UINT32 ip_addr, + const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); + + int set (const wchar_t addr[]); +#endif /* ACE_HAS_WCHAR */ + virtual void *get_addr (void) const; // Return a pointer to the underlying network address. @@ -140,7 +171,7 @@ public: // "tango.cs.wustl.edu:1234"). Returns -1 if the <size> of the // <buffer> is too small, else 0. - virtual int string_to_addr (const ACE_TCHAR address[]); + virtual int string_to_addr (const char address[]); // Initializes an <ACE_INET_Addr> from the <address>, which can be // "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), // "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), @@ -149,6 +180,13 @@ public: // is no ':' in the <address> it is assumed to be a port number, // with the IP address being INADDR_ANY. +#if defined (ACE_HAS_WCHAR) + /* + virtual int string_to_addr (const char address[]); + */ +#endif /* ACE_HAS_WCHAR */ + + void set_port_number (u_short, int encode = 1); // Sets the port number without affecting the host name. If @@ -159,18 +197,23 @@ public: u_short get_port_number (void) const; // Return the port number, converting it into host byte order. - int get_host_name (ACE_TCHAR hostname[], + int get_host_name (char hostname[], size_t hostnamelen) const; // Return the character representation of the name of the host, // storing it in the <hostname> (which is assumed to be // <hostnamelen> bytes long). This version is reentrant. - const ACE_TCHAR *get_host_name (void) const; +#if defined (ACE_HAS_WCHAR) + int get_host_name (wchar_t hostname[], + size_t hostnamelen) const; +#endif /* ACE_HAS_WCHAR */ + + const char *get_host_name (void) const; // Return the character representation of the hostname (this version // is non-reentrant since it returns a pointer to a static data // area). - const ACE_TCHAR *get_host_addr (void) const; + const char *get_host_addr (void) const; // Return the "dotted decimal" Internet address. ACE_UINT32 get_ip_address (void) const; diff --git a/ace/INET_Addr.i b/ace/INET_Addr.i index 4bb7dd4d5ae..f19a4a0cfab 100644 --- a/ace/INET_Addr.i +++ b/ace/INET_Addr.i @@ -29,7 +29,7 @@ ACE_INET_Addr::get_addr (void) const // Return the dotted Internet address. -ACE_INLINE const ACE_TCHAR * +ACE_INLINE const char * ACE_INET_Addr::get_host_addr (void) const { ACE_TRACE ("ACE_INET_Addr::get_host_addr"); @@ -58,3 +58,42 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) || (this->get_ip_address () == rhs.get_ip_address () && this->get_port_number () < rhs.get_port_number ()); } + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE int +ACE_INET_Addr::set (u_short port_number, + const wchar_t host_name[], + int encode) +{ + return this->set (port_number, + ACE_Wide_To_Ascii (host_name).char_rep (), + encode); +} + +ACE_INLINE int +ACE_INET_Addr::set (const wchar_t port_name[], + const wchar_t host_name[], + const wchar_t protocol[]) +{ + return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), + ACE_Wide_To_Ascii (host_name).char_rep (), + ACE_Wide_To_Ascii (protocol).char_rep ()); +} + +ACE_INLINE int +ACE_INET_Addr::set (const wchar_t port_name[], + ACE_UINT32 ip_addr, + const wchar_t protocol[]) +{ + return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), + ip_addr, + ACE_Wide_To_Ascii (protocol).char_rep ()); +} + +ACE_INLINE int +ACE_INET_Addr::set (const wchar_t addr[]) +{ + return this->set (ACE_Wide_To_Ascii (addr).char_rep ()); +} + +#endif /* ACE_HAS_WCHAR */ diff --git a/ace/MEM_Addr.cpp b/ace/MEM_Addr.cpp index 952834b9d61..43da9c3164f 100644 --- a/ace/MEM_Addr.cpp +++ b/ace/MEM_Addr.cpp @@ -124,7 +124,7 @@ ACE_MEM_Addr::get_host_name (ACE_TCHAR hostname[], // Return the character representation of the hostname. -const ACE_TCHAR * +const char * ACE_MEM_Addr::get_host_name (void) const { ACE_TRACE ("ACE_MEM_Addr::get_host_name"); diff --git a/ace/MEM_Addr.h b/ace/MEM_Addr.h index 6e3a28e0950..743587e9a62 100644 --- a/ace/MEM_Addr.h +++ b/ace/MEM_Addr.h @@ -96,12 +96,12 @@ public: size_t hostnamelen) const; // Return the character representation of the hostname. - const ACE_TCHAR *get_host_name (void) const; + const char *get_host_name (void) const; // Return the character representation of the hostname (this version // is non-reentrant since it returns a pointer to a static data // area). - const ACE_TCHAR *get_host_addr (void) const; + const char *get_host_addr (void) const; // Return the "dotted decimal" external address. ACE_UINT32 get_ip_address (void) const; diff --git a/ace/MEM_Addr.i b/ace/MEM_Addr.i index 579481e2ce6..73cb2af2e05 100644 --- a/ace/MEM_Addr.i +++ b/ace/MEM_Addr.i @@ -47,7 +47,7 @@ ACE_MEM_Addr::get_port_number (void) const // Return the dotted Internet address. -ACE_INLINE const ACE_TCHAR * +ACE_INLINE const char * ACE_MEM_Addr::get_host_addr (void) const { ACE_TRACE ("ACE_MEM_Addr::get_host_addr"); diff --git a/ace/OS.cpp b/ace/OS.cpp index b2d9dcbeca3..b2ee27bd9fc 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -4863,13 +4863,13 @@ ACE_OS::inet_ntoa (const struct in_addr addr) #endif /* defined (ACE_PSOS) */ int -ACE_OS::inet_aton (const ACE_TCHAR *host_name, struct in_addr *addr) +ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) { ACE_UINT32 ip_addr = ACE_OS::inet_addr (host_name); if (ip_addr == (ACE_UINT32) htonl ((ACE_UINT32) ~0) // Broadcast addresses are weird... - && ACE_OS::strcmp (host_name, ACE_LIB_TEXT ("255.255.255.255")) != 0) + && ACE_OS::strcmp (host_name, "255.255.255.255") != 0) return 0; else if (addr == 0) return 0; @@ -5645,36 +5645,36 @@ public: // <qos_params> are ignored and the BSD-style <connect> is called. static int closesocket (ACE_HANDLE s); - static struct hostent *gethostbyaddr (const ACE_TCHAR *addr, + static struct hostent *gethostbyaddr (const char *addr, int length, int type); - static struct hostent *gethostbyname (const ACE_TCHAR *name); - static struct hostent *gethostbyname2 (const ACE_TCHAR *name, int type); - static struct hostent *gethostbyaddr_r (const ACE_TCHAR *addr, + static struct hostent *gethostbyname (const char *name); + static struct hostent *gethostbyname2 (const char *name, int type); + static struct hostent *gethostbyaddr_r (const char *addr, int length, int type, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop); - static struct hostent *gethostbyname_r (const ACE_TCHAR *name, + static struct hostent *gethostbyname_r (const char *name, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop); static int getpeername (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen); - static struct protoent *getprotobyname (const ACE_TCHAR *name); - static struct protoent *getprotobyname_r (const ACE_TCHAR *name, + static struct protoent *getprotobyname (const char *name); + static struct protoent *getprotobyname_r (const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer); static struct protoent *getprotobynumber (int proto); static struct protoent *getprotobynumber_r (int proto, struct protoent *result, ACE_PROTOENT_DATA buffer); - static struct servent *getservbyname (const ACE_TCHAR *svc, - const ACE_TCHAR *proto); - static struct servent *getservbyname_r (const ACE_TCHAR *svc, - const ACE_TCHAR *proto, + static struct servent *getservbyname (const char *svc, + const char *proto); + static struct servent *getservbyname_r (const char *svc, + const char *proto, struct servent *result, ACE_SERVENT_DATA buf); static int getsockname (ACE_HANDLE handle, @@ -5685,16 +5685,16 @@ public: int optname, char *optval, int *optlen); - static long inet_addr (const ACE_TCHAR *name); - static ACE_TCHAR *inet_ntoa (const struct in_addr addr); - static int inet_aton (const ACE_TCHAR *strptr, + static long inet_addr (const char *name); + static char *inet_ntoa (const struct in_addr addr); + static int inet_aton (const char *strptr, struct in_addr *addr); - static const ACE_TCHAR *inet_ntop (int family, - const void *addrptr, - ACE_TCHAR *strptr, - size_t len); + static const char *inet_ntop (int family, + const void *addrptr, + char *strptr, + size_t len); static int inet_pton (int family, - const ACE_TCHAR *strptr, + const char *strptr, void *addrptr); static int enum_protocols (int *protocols, ACE_Protocol_Info *protocol_buffer, @@ -1436,7 +1436,7 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen) result = user; } - delete char_user; + delete [] char_user; return result; # endif /* ACE_WIN32 */ @@ -5551,7 +5551,7 @@ ACE_OS::connect (ACE_HANDLE handle, #if !defined (VXWORKS) ACE_INLINE struct hostent * -ACE_OS::gethostbyname (const ACE_TCHAR *name) +ACE_OS::gethostbyname (const char *name) { ACE_OS_TRACE ("ACE_OS::gethostbyname"); # if defined (ACE_PSOS) @@ -5562,14 +5562,14 @@ ACE_OS::gethostbyname (const ACE_TCHAR *name) struct hostent *, 0); # else - ACE_SOCKCALL_RETURN (::gethostbyname (ACE_TEXT_ALWAYS_CHAR (name)), + ACE_SOCKCALL_RETURN (::gethostbyname (name), struct hostent *, 0); # endif /* ACE_HAS_NONCONST_GETBY */ } ACE_INLINE struct hostent * -ACE_OS::gethostbyname2 (const ACE_TCHAR *name, int family) +ACE_OS::gethostbyname2 (const char *name, int family) { ACE_OS_TRACE ("ACE_OS::gethostbyname2"); # if defined (ACE_PSOS) @@ -5583,7 +5583,7 @@ ACE_OS::gethostbyname2 (const ACE_TCHAR *name, int family) struct hostent *, 0); # else - ACE_SOCKCALL_RETURN (::gethostbyname2 (ACE_TEXT_ALWAYS_CHAR (name), family), + ACE_SOCKCALL_RETURN (::gethostbyname2 (name, family), struct hostent *, 0); # endif /* ACE_HAS_NONCONST_GETBY */ @@ -5597,7 +5597,7 @@ ACE_OS::gethostbyname2 (const ACE_TCHAR *name, int family) } ACE_INLINE struct hostent * -ACE_OS::gethostbyaddr (const ACE_TCHAR *addr, int length, int type) +ACE_OS::gethostbyaddr (const char *addr, int length, int type) { ACE_OS_TRACE ("ACE_OS::gethostbyaddr"); # if defined (ACE_PSOS) @@ -5612,7 +5612,7 @@ ACE_OS::gethostbyaddr (const ACE_TCHAR *addr, int length, int type) struct hostent *, 0); # else - ACE_SOCKCALL_RETURN (::gethostbyaddr (ACE_TEXT_ALWAYS_CHAR (addr), + ACE_SOCKCALL_RETURN (::gethostbyaddr (addr, (ACE_SOCKET_LEN) length, type), struct hostent *, @@ -5898,7 +5898,7 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr, } ACE_INLINE struct protoent * -ACE_OS::getprotobyname (const ACE_TCHAR *name) +ACE_OS::getprotobyname (const char *name) { #if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) ACE_UNUSED_ARG (name); @@ -5908,14 +5908,14 @@ ACE_OS::getprotobyname (const ACE_TCHAR *name) struct protoent *, 0); #else - ACE_SOCKCALL_RETURN (::getprotobyname (ACE_TEXT_ALWAYS_CHAR (name)), + ACE_SOCKCALL_RETURN (::getprotobyname (name), struct protoent *, 0); #endif /* VXWORKS */ } ACE_INLINE struct protoent * -ACE_OS::getprotobyname_r (const ACE_TCHAR *name, +ACE_OS::getprotobyname_r (const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer) { @@ -5953,7 +5953,7 @@ ACE_OS::getprotobyname_r (const ACE_TCHAR *name, ACE_UNUSED_ARG (buffer); ACE_UNUSED_ARG (result); - ACE_SOCKCALL_RETURN (::getprotobyname (ACE_TEXT_ALWAYS_CHAR (name)), + ACE_SOCKCALL_RETURN (::getprotobyname (name), struct protoent *, 0); #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) !defined (UNIXWARE) */ @@ -6008,7 +6008,7 @@ ACE_OS::getprotobynumber_r (int proto, } ACE_INLINE struct servent * -ACE_OS::getservbyname (const ACE_TCHAR *svc, const ACE_TCHAR *proto) +ACE_OS::getservbyname (const char *svc, const char *proto) { ACE_OS_TRACE ("ACE_OS::getservbyname"); #if defined (ACE_LACKS_GETSERVBYNAME) @@ -6021,8 +6021,8 @@ ACE_OS::getservbyname (const ACE_TCHAR *svc, const ACE_TCHAR *proto) struct servent *, 0); #else - ACE_SOCKCALL_RETURN (::getservbyname (ACE_TEXT_ALWAYS_CHAR (svc), - ACE_TEXT_ALWAYS_CHAR (proto)), + ACE_SOCKCALL_RETURN (::getservbyname (svc, + proto), struct servent *, 0); #endif /* ACE_HAS_NONCONST_GETBY */ @@ -6551,7 +6551,7 @@ ACE_OS::getpwnam_r (const char *name, struct passwd *pwent, #if !defined (VXWORKS) ACE_INLINE struct hostent * -ACE_OS::gethostbyaddr_r (const ACE_TCHAR *addr, +ACE_OS::gethostbyaddr_r (const char *addr, int length, int type, hostent *result, @@ -6607,7 +6607,7 @@ ACE_OS::gethostbyaddr_r (const ACE_TCHAR *addr, ACE_UNUSED_ARG (buffer); ACE_UNUSED_ARG (result); - ACE_SOCKCALL_RETURN (::gethostbyaddr (ACE_TEXT_ALWAYS_CHAR (addr), + ACE_SOCKCALL_RETURN (::gethostbyaddr (addr, (ACE_SOCKET_LEN) length, type), struct hostent *, @@ -6616,7 +6616,7 @@ ACE_OS::gethostbyaddr_r (const ACE_TCHAR *addr, } ACE_INLINE struct hostent * -ACE_OS::gethostbyname_r (const ACE_TCHAR *name, +ACE_OS::gethostbyname_r (const char *name, hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop) @@ -6675,7 +6675,7 @@ ACE_OS::gethostbyname_r (const ACE_TCHAR *name, ACE_UNUSED_ARG (buffer); ACE_UNUSED_ARG (h_errnop); - ACE_SOCKCALL_RETURN (::gethostbyname (ACE_TEXT_ALWAYS_CHAR (name)), + ACE_SOCKCALL_RETURN (::gethostbyname (name), struct hostent *, 0); # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */ @@ -6696,8 +6696,8 @@ ACE_OS::gets (char *str) #endif /* 0 */ ACE_INLINE struct servent * -ACE_OS::getservbyname_r (const ACE_TCHAR *svc, - const ACE_TCHAR *proto, +ACE_OS::getservbyname_r (const char *svc, + const char *proto, struct servent *result, ACE_SERVENT_DATA buf) { @@ -6739,15 +6739,15 @@ ACE_OS::getservbyname_r (const ACE_TCHAR *svc, ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (result); - ACE_SOCKCALL_RETURN (::getservbyname (ACE_TEXT_ALWAYS_CHAR (svc), - ACE_TEXT_ALWAYS_CHAR (proto)), + ACE_SOCKCALL_RETURN (::getservbyname (svc, + proto), struct servent *, 0); #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */ } ACE_INLINE long -ACE_OS::inet_addr (const ACE_TCHAR *name) +ACE_OS::inet_addr (const char *name) { ACE_OS_TRACE ("ACE_OS::inet_addr"); #if defined (VXWORKS) || defined (ACE_PSOS) @@ -6786,24 +6786,24 @@ ACE_OS::inet_addr (const ACE_TCHAR *name) #elif defined (ACE_HAS_NONCONST_GETBY) return ::inet_addr ((char *) name); #else - return ::inet_addr (ACE_TEXT_ALWAYS_CHAR (name)); + return ::inet_addr (name); #endif /* ACE_HAS_NONCONST_GETBY */ } // For pSOS, this function is in OS.cpp #if !defined (ACE_PSOS) -ACE_INLINE ACE_TCHAR * +ACE_INLINE char * ACE_OS::inet_ntoa (const struct in_addr addr) { ACE_OS_TRACE ("ACE_OS::inet_ntoa"); - ACE_OSCALL_RETURN (ACE_TEXT_CHAR_TO_TCHAR (::inet_ntoa (addr)), - ACE_TCHAR *, + ACE_OSCALL_RETURN (::inet_ntoa (addr), + char *, 0); } #endif /* defined (ACE_PSOS) */ ACE_INLINE int -ACE_OS::inet_pton (int family, const ACE_TCHAR *strptr, void *addrptr) +ACE_OS::inet_pton (int family, const char *strptr, void *addrptr) { ACE_OS_TRACE ("ACE_OS::inet_pton"); @@ -6827,8 +6827,8 @@ ACE_OS::inet_pton (int family, const ACE_TCHAR *strptr, void *addrptr) #endif /* ACE_HAS_IP6 */ } -ACE_INLINE const ACE_TCHAR * -ACE_OS::inet_ntop (int family, const void *addrptr, ACE_TCHAR *strptr, size_t len) +ACE_INLINE const char * +ACE_OS::inet_ntop (int family, const void *addrptr, char *strptr, size_t len) { ACE_OS_TRACE ("ACE_OS::inet_ntop"); @@ -6840,13 +6840,13 @@ ACE_OS::inet_ntop (int family, const void *addrptr, ACE_TCHAR *strptr, size_t le if (family == AF_INET) { - ACE_TCHAR temp[INET_ADDRSTRLEN]; + char temp[INET_ADDRSTRLEN]; // Stevens uses snprintf() in his implementation but snprintf() // doesn't appear to be very portable. For now, hope that using // sprintf() will not cause any string/memory overrun problems. ACE_OS::sprintf (temp, - ACE_LIB_TEXT ("%d.%d.%d.%d"), + "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); if (ACE_OS::strlen (temp) >= len) diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 106c99057ff..8a5637d3647 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -194,9 +194,9 @@ LONG _stdcall ACE_UnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo) DWORD dwExceptionCode = pExceptionInfo->ExceptionRecord->ExceptionCode; if (dwExceptionCode == EXCEPTION_ACCESS_VIOLATION) - ACE_ERROR ((LM_ERROR, "\nERROR: ACCESS VIOLATION\n")); + ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("\nERROR: ACCESS VIOLATION\n"))); else - ACE_ERROR ((LM_ERROR, "\nERROR: UNHANDLED EXCEPTION\n")); + ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("\nERROR: UNHANDLED EXCEPTION\n"))); return EXCEPTION_EXECUTE_HANDLER; } diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp index a677a516411..2d57b9a86cc 100644 --- a/ace/SOCK_Dgram_Mcast.cpp +++ b/ace/SOCK_Dgram_Mcast.cpp @@ -142,7 +142,8 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, continue; if (this->subscribe (mcast_addr, reuse_addr, - if_addrs[if_cnt].get_host_addr(), + ACE_TEXT_CHAR_TO_TCHAR + (if_addrs[if_cnt].get_host_addr()), protocol_family, protocol) == 0) ++nr_subscribed; @@ -273,7 +274,8 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, if (if_addrs[if_cnt].get_ip_address() == INADDR_LOOPBACK) continue; if (this->unsubscribe (mcast_addr, - if_addrs[if_cnt].get_host_addr(), + ACE_TEXT_CHAR_TO_TCHAR + (if_addrs[if_cnt].get_host_addr()), protocol_family, protocol) == 0) ++nr_unsubscribed; diff --git a/ace/SOCK_Dgram_Mcast_QoS.cpp b/ace/SOCK_Dgram_Mcast_QoS.cpp index ba251964c1d..3168c3c9727 100644 --- a/ace/SOCK_Dgram_Mcast_QoS.cpp +++ b/ace/SOCK_Dgram_Mcast_QoS.cpp @@ -151,7 +151,8 @@ ACE_SOCK_Dgram_Mcast_QoS::subscribe_ifs (const ACE_INET_Addr &mcast_addr, if (this->subscribe (mcast_addr, qos_params, reuse_addr, - if_addrs[if_cnt].get_host_addr(), + ACE_TEXT_CHAR_TO_TCHAR + (if_addrs[if_cnt].get_host_addr()), protocol_family, protocol, protocolinfo) == 0) |