diff options
Diffstat (limited to 'websvcs')
-rw-r--r-- | websvcs/lib/URL_Addr.cpp | 182 | ||||
-rw-r--r-- | websvcs/lib/URL_Addr.h | 108 | ||||
-rw-r--r-- | websvcs/lib/URL_Addr.i | 2 | ||||
-rw-r--r-- | websvcs/tests/Test_URL_Addr.cpp | 52 |
4 files changed, 172 insertions, 172 deletions
diff --git a/websvcs/lib/URL_Addr.cpp b/websvcs/lib/URL_Addr.cpp index c6dcf1b7017..43cd57389c2 100644 --- a/websvcs/lib/URL_Addr.cpp +++ b/websvcs/lib/URL_Addr.cpp @@ -9,37 +9,37 @@ ACE_RCSID(ace, URL_Addr, "$Id$") -static ASYS_TCHAR http[] = ASYS_TEXT ("http:"); +static ACE_TCHAR http[] = ACE_TEXT ("http:"); static size_t http_size = sizeof(http)/sizeof(http[0]) - 1; -static ASYS_TCHAR ftp[] = ASYS_TEXT ("ftp:"); +static ACE_TCHAR ftp[] = ACE_TEXT ("ftp:"); static size_t ftp_size = sizeof(ftp)/sizeof(ftp[0]) - 1; -static ASYS_TCHAR mailto[] = ASYS_TEXT ("mailto:"); +static ACE_TCHAR mailto[] = ACE_TEXT ("mailto:"); static size_t mailto_size = sizeof(mailto)/sizeof(mailto[0]) - 1; -static ASYS_TCHAR file[] = ASYS_TEXT ("file:"); +static ACE_TCHAR file[] = ACE_TEXT ("file:"); static size_t file_size = sizeof(file)/sizeof(file[0]) - 1; -static ASYS_TCHAR afs[] = ASYS_TEXT ("afs:"); +static ACE_TCHAR afs[] = ACE_TEXT ("afs:"); static size_t afs_size = sizeof(afs)/sizeof(afs[0]) - 1; -static ASYS_TCHAR news[] = ASYS_TEXT ("news:"); +static ACE_TCHAR news[] = ACE_TEXT ("news:"); static size_t news_size = sizeof(news)/sizeof(news[0]) - 1; -static ASYS_TCHAR nntp[] = ASYS_TEXT ("nntp:"); +static ACE_TCHAR nntp[] = ACE_TEXT ("nntp:"); static size_t nntp_size = sizeof(nntp)/sizeof(nntp[0]) - 1; -static ASYS_TCHAR cid[] = ASYS_TEXT ("cid:"); +static ACE_TCHAR cid[] = ACE_TEXT ("cid:"); static size_t cid_size = sizeof(cid)/sizeof(cid[0]) - 1; -static ASYS_TCHAR mid[] = ASYS_TEXT ("mid:"); +static ACE_TCHAR mid[] = ACE_TEXT ("mid:"); static size_t mid_size = sizeof(mid)/sizeof(mid[0]) - 1; -static ASYS_TCHAR wais[] = ASYS_TEXT ("wais:"); +static ACE_TCHAR wais[] = ACE_TEXT ("wais:"); static size_t wais_size = sizeof(wais)/sizeof(wais[0]) - 1; -static ASYS_TCHAR prospero[] = ASYS_TEXT ("prospero:"); +static ACE_TCHAR prospero[] = ACE_TEXT ("prospero:"); static size_t prospero_size = sizeof(prospero)/sizeof(prospero[0]) - 1; -static ASYS_TCHAR telnet[] = ASYS_TEXT ("telnet:"); +static ACE_TCHAR telnet[] = ACE_TEXT ("telnet:"); static size_t telnet_size = sizeof(telnet)/sizeof(telnet[0]) - 1; -static ASYS_TCHAR rlogin[] = ASYS_TEXT ("rlogin:"); +static ACE_TCHAR rlogin[] = ACE_TEXT ("rlogin:"); static size_t rlogin_size = sizeof(rlogin)/sizeof(rlogin[0]) - 1; -static ASYS_TCHAR tn3270[] = ASYS_TEXT ("tn3270:"); +static ACE_TCHAR tn3270[] = ACE_TEXT ("tn3270:"); static size_t tn3270_size = sizeof(tn3270)/sizeof(tn3270[0]) - 1; -static ASYS_TCHAR gopher[] = ASYS_TEXT ("gopher:"); +static ACE_TCHAR gopher[] = ACE_TEXT ("gopher:"); static size_t gopher_size = sizeof(gopher)/sizeof(gopher[0]) - 1; @@ -61,7 +61,7 @@ ACE_URL_Addr::set (const ACE_URL_Addr& address) } int -ACE_URL_Addr::string_to_addr (LPCTSTR address) +ACE_URL_Addr::string_to_addr (const ACE_TCHAR *address) { if (this->url_ != 0) ACE_OS::free (this->url_); @@ -72,7 +72,7 @@ ACE_URL_Addr::string_to_addr (LPCTSTR address) } int -ACE_URL_Addr::addr_to_string (LPTSTR s, +ACE_URL_Addr::addr_to_string (ACE_TCHAR *s, size_t size, int) const { @@ -90,7 +90,7 @@ ACE_URL_Addr::accept (ACE_URL_Addr_Visitor* visitor) // The factory method to create URL addresses. ACE_URL_Addr* -ACE_URL_Addr::create_address (LPCTSTR url) +ACE_URL_Addr::create_address (const ACE_TCHAR *url) { ACE_URL_Addr* addr = 0; if (ACE_OS::strncasecmp (http, url, http_size) == 0) @@ -111,7 +111,7 @@ ACE_URL_Addr::create_address (LPCTSTR url) } int -ACE_URL_Addr::known_scheme (LPCTSTR url) +ACE_URL_Addr::known_scheme (const ACE_TCHAR *url) { if (ACE_OS::strncasecmp (http, url, http_size) == 0) return 1; @@ -187,9 +187,9 @@ ACE_HTTP_Addr::ACE_HTTP_Addr (void) { } -ACE_HTTP_Addr::ACE_HTTP_Addr (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR query, +ACE_HTTP_Addr::ACE_HTTP_Addr (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *query, u_short port) : hostname_ (0), port_number_ (0), @@ -218,9 +218,9 @@ ACE_HTTP_Addr::~ACE_HTTP_Addr (void) } int -ACE_HTTP_Addr::set (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR query, +ACE_HTTP_Addr::set (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *query, u_short port) { if (host_name == 0 || path == 0) @@ -237,9 +237,9 @@ ACE_HTTP_Addr::set (LPCTSTR host_name, size_t size = this->url_size (1); - LPTSTR buffer; + ACE_TCHAR *buffer; ACE_ALLOCATOR_RETURN (buffer, - ACE_reinterpret_cast(LPTSTR, + ACE_reinterpret_cast(ACE_TCHAR *, ACE_OS::malloc (size)), -1); if (this->addr_to_string (buffer, size, 1) == -1) @@ -287,8 +287,8 @@ ACE_HTTP_Addr::url_size (int flags) const // Notice that we cannot hard-code the value because the size in // wchar's may be different. size_t size = - + sizeof (ASYS_TEXT ("http://")) - + sizeof (ASYS_TEXT ("/:?")); // separators + + sizeof (ACE_TEXT ("http://")) + + sizeof (ACE_TEXT ("/:?")); // separators size_t chars = + (this->path_?ACE_OS::strlen (this->path_):0) @@ -297,7 +297,7 @@ ACE_HTTP_Addr::url_size (int flags) const if (flags == 0) { - size += sizeof (ASYS_TEXT("255.255.255.255")); + size += sizeof (ACE_TEXT("255.255.255.255")); } else { @@ -306,25 +306,25 @@ ACE_HTTP_Addr::url_size (int flags) const if (this->port_number_ != ACE_DEFAULT_HTTP_PORT) { - size += sizeof (ASYS_TEXT(":65335")); + size += sizeof (ACE_TEXT(":65335")); } - size += chars * sizeof(ASYS_TCHAR); + size += chars * sizeof(ACE_TCHAR); return size; } inline int -path_copy (LPCTSTR begin, - LPCTSTR /* end */, - LPTSTR& target, - LPCTSTR src) +path_copy (const ACE_TCHAR *begin, + const ACE_TCHAR */* end */, + const ACE_TCHAR *& target, + const ACE_TCHAR *src) { // Copy one character at a time, if we find a /../ we go back to the // previous '/' for (; *src != 0; ++src) { - ASYS_TCHAR c = *src; + ACE_TCHAR c = *src; switch (c) { case '/': @@ -352,7 +352,7 @@ path_copy (LPCTSTR begin, } ACE_URL_Addr* -ACE_HTTP_Addr::create_relative_address (LPCTSTR url) const +ACE_HTTP_Addr::create_relative_address (const ACE_TCHAR *url) const { if (ACE_URL_Addr::known_scheme (url)) return ACE_URL_Addr::create_address (url); @@ -368,20 +368,20 @@ ACE_HTTP_Addr::create_relative_address (LPCTSTR url) const } else { - LPCTSTR path = this->get_path (); - LPTSTR buf; + const ACE_TCHAR *path = this->get_path (); + ACE_TCHAR *buf; size_t n = ACE_OS::strlen (url) + ACE_OS::strlen (path) + 2; ACE_NEW_RETURN (buf, - ASYS_TCHAR [n], + ACE_TCHAR [n], 0); // We copy the contens of <path> into <buf>; but simplifying the // path, to avoid infinite loop like: // "foo/../foo/../foo/../foo/../foo/index.html" // - LPTSTR target = buf; + ACE_TCHAR *target = buf; // Copy the path path_copy (buf, buf + n, target, path); @@ -389,7 +389,7 @@ ACE_HTTP_Addr::create_relative_address (LPCTSTR url) const if (url[0] == '#') { // Remove any # from the path - LPTSTR p = target; + ACE_TCHAR *p = target; while (p != buf && *(--p) != '#'); if (p != buf) target = p; @@ -432,7 +432,7 @@ ACE_HTTP_Addr::create_relative_address (LPCTSTR url) const } int -ACE_HTTP_Addr::string_to_addr (LPCTSTR address) +ACE_HTTP_Addr::string_to_addr (const ACE_TCHAR *address) { if (address == 0) return -1; @@ -449,20 +449,20 @@ ACE_HTTP_Addr::string_to_addr (LPCTSTR address) if (this->ACE_URL_Addr::string_to_addr (address) != 0) return -1; - LPCTSTR string = address; + ACE_TCHAR *string = address; string += http_size; string += 2; // == strlen ("//"); // Make a copy of the string to manipulate it. ACE_ALLOCATOR_RETURN (this->hostname_, ACE_OS::strdup (string), -1); - ASYS_TCHAR *path_start = ACE_OS::strchr (this->hostname_, '/'); + ACE_TCHAR *path_start = ACE_OS::strchr (this->hostname_, '/'); if (path_start != 0) { // terminate the host:port substring path_start[0] = '\0'; path_start++; - ASYS_TCHAR *query_start = ACE_OS::strchr (path_start, '?'); + ACE_TCHAR *query_start = ACE_OS::strchr (path_start, '?'); if (query_start != 0) { query_start[0] = '\0'; @@ -476,7 +476,7 @@ ACE_HTTP_Addr::string_to_addr (LPCTSTR address) // By now t is null terminated at the start of the path, find the // port (if present). - ASYS_TCHAR *port_start = ACE_OS::strchr(this->hostname_, ':'); + ACE_TCHAR *port_start = ACE_OS::strchr(this->hostname_, ':'); this->port_number_ = ACE_DEFAULT_HTTP_PORT; if (port_start != 0) { @@ -490,7 +490,7 @@ ACE_HTTP_Addr::string_to_addr (LPCTSTR address) } int -ACE_HTTP_Addr::addr_to_string (LPTSTR buffer, +ACE_HTTP_Addr::addr_to_string (ACE_TCHAR *buffer, size_t size, int flags) const { @@ -501,7 +501,7 @@ ACE_HTTP_Addr::addr_to_string (LPTSTR buffer, return -1; size_t n = ACE_OS::sprintf (buffer, - ASYS_TEXT ("http://")); + ACE_TEXT ("http://")); if (flags == 0) { ACE_INET_Addr inet = this->get_inet_address (); @@ -543,10 +543,10 @@ ACE_FTP_Addr::ACE_FTP_Addr (void) { } -ACE_FTP_Addr::ACE_FTP_Addr (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR user, - LPCTSTR passwd) +ACE_FTP_Addr::ACE_FTP_Addr (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *user, + const ACE_TCHAR *passwd) : user_ (0), passwd_ (0), hostname_ (0), @@ -571,10 +571,10 @@ ACE_FTP_Addr::~ACE_FTP_Addr (void) } int -ACE_FTP_Addr::set (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR user, - LPCTSTR passwd) +ACE_FTP_Addr::set (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *user, + const ACE_TCHAR *passwd) { if (host_name == 0 || path == 0) return -1; @@ -592,9 +592,9 @@ ACE_FTP_Addr::set (LPCTSTR host_name, size_t size = this->url_size (1); - LPTSTR buffer; + ACE_TCHAR *buffer; ACE_ALLOCATOR_RETURN (buffer, - ACE_reinterpret_cast(LPTSTR, + ACE_reinterpret_cast(ACE_TCHAR *, ACE_OS::malloc (size)), -1); if (this->addr_to_string (buffer, size, 1) == -1) @@ -641,8 +641,8 @@ ACE_FTP_Addr::url_size (int flags) const // Notice that we cannot hard-code the value because the size in // wchar's may be different. size_t size = - + sizeof (ASYS_TEXT ("ftp://")) - + sizeof (ASYS_TEXT ("@:/")); // separators + + sizeof (ACE_TEXT ("ftp://")) + + sizeof (ACE_TEXT ("@:/")); // separators size_t chars = + (this->user_?ACE_OS::strlen (this->path_):0) @@ -651,19 +651,19 @@ ACE_FTP_Addr::url_size (int flags) const if (flags == 0) { - size += sizeof (ASYS_TEXT("255.255.255.255")); + size += sizeof (ACE_TEXT("255.255.255.255")); } else { chars += ACE_OS::strlen (this->hostname_); } - size += chars * sizeof(ASYS_TCHAR); + size += chars * sizeof(ACE_TCHAR); return size; } int -ACE_FTP_Addr::addr_to_string (LPTSTR buffer, +ACE_FTP_Addr::addr_to_string (ACE_TCHAR *buffer, size_t size, int flags) const { @@ -671,7 +671,7 @@ ACE_FTP_Addr::addr_to_string (LPTSTR buffer, return -1; size_t n = ACE_OS::sprintf (buffer, - ASYS_TEXT ("ftp://")); + ACE_TEXT ("ftp://")); if (this->user_ != 0) { @@ -704,7 +704,7 @@ ACE_FTP_Addr::addr_to_string (LPTSTR buffer, } int -ACE_FTP_Addr::string_to_addr (LPCTSTR address) +ACE_FTP_Addr::string_to_addr (const ACE_TCHAR *address) { if (address == 0) return -1; @@ -720,15 +720,15 @@ ACE_FTP_Addr::string_to_addr (LPCTSTR address) // Save the original URL.... this->ACE_URL_Addr::string_to_addr (address); - LPCTSTR string = address; + const ACE_TCHAR *string = address; string += ftp_size; string += 2; // == strlen ("//"); // Make a copy of the string to manipulate it. - ASYS_TCHAR *t; + ACE_TCHAR *t; ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (string), -1); - ASYS_TCHAR *path_start = ACE_OS::strchr (t, '/'); + ACE_TCHAR *path_start = ACE_OS::strchr (t, '/'); if (path_start != 0) { // terminate the host:port substring @@ -737,7 +737,7 @@ ACE_FTP_Addr::string_to_addr (LPCTSTR address) ACE_ALLOCATOR_RETURN (this->path_, ACE_OS::strdup (path_start), -1); } - ASYS_TCHAR *host_start = ACE_OS::strchr (t, '@'); + ACE_TCHAR *host_start = ACE_OS::strchr (t, '@'); if (host_start != 0) { host_start[0] = '\0'; @@ -745,7 +745,7 @@ ACE_FTP_Addr::string_to_addr (LPCTSTR address) ACE_ALLOCATOR_RETURN (this->hostname_, ACE_OS::strdup (host_start), -1); - ASYS_TCHAR *pass_start = ACE_OS::strchr (t, ':'); + ACE_TCHAR *pass_start = ACE_OS::strchr (t, ':'); if (pass_start != 0) { pass_start[0] = '\0'; @@ -779,9 +779,9 @@ ACE_Mailto_Addr::ACE_Mailto_Addr (void) { } -ACE_Mailto_Addr::ACE_Mailto_Addr (LPCTSTR user, - LPCTSTR hostname, - LPCTSTR headers) +ACE_Mailto_Addr::ACE_Mailto_Addr (const ACE_TCHAR *user, + const ACE_TCHAR *hostname, + const ACE_TCHAR *headers) : user_ (0), hostname_ (0), headers_ (0) @@ -804,9 +804,9 @@ ACE_Mailto_Addr::~ACE_Mailto_Addr (void) } int -ACE_Mailto_Addr::set (LPCTSTR user, - LPCTSTR hostname, - LPCTSTR headers) +ACE_Mailto_Addr::set (const ACE_TCHAR *user, + const ACE_TCHAR *hostname, + const ACE_TCHAR *headers) { if (user == 0 || hostname == 0) return -1; @@ -818,9 +818,9 @@ ACE_Mailto_Addr::set (LPCTSTR user, else this->headers_ = 0; size_t size = this->url_size (1); - LPTSTR buffer; + ACE_TCHAR *buffer; ACE_ALLOCATOR_RETURN (buffer, - ACE_reinterpret_cast(LPTSTR, + ACE_reinterpret_cast(ACE_TCHAR *, ACE_OS::malloc (size)), -1); if (this->addr_to_string (buffer, size, 1) == -1) @@ -860,20 +860,20 @@ ACE_Mailto_Addr::url_size (int) const { // Notice that we cannot hard-code the value because the size in // wchar's may be different. - size_t size = sizeof (ASYS_TEXT ("mailto:")) - + sizeof (ASYS_TEXT ("@?")); // separators + size_t size = sizeof (ACE_TEXT ("mailto:")) + + sizeof (ACE_TEXT ("@?")); // separators size_t chars = + (this->user_?ACE_OS::strlen (this->user_):0) + (this->hostname_?ACE_OS::strlen (this->hostname_):0) + (this->headers_?ACE_OS::strlen (this->headers_):0); - size += chars * sizeof (ASYS_TCHAR); + size += chars * sizeof (ACE_TCHAR); return size; } int -ACE_Mailto_Addr::addr_to_string (LPTSTR buffer, +ACE_Mailto_Addr::addr_to_string (ACE_TCHAR *buffer, size_t size, int flags) const { @@ -882,11 +882,11 @@ ACE_Mailto_Addr::addr_to_string (LPTSTR buffer, if (this->user_ == 0 || this->hostname_ == 0) return -1; - size_t n = ACE_OS::sprintf (buffer, ASYS_TEXT ("mailto:%s@%s"), + size_t n = ACE_OS::sprintf (buffer, ACE_TEXT ("mailto:%s@%s"), this->user_, this->hostname_); if (this->headers_ != 0) { - n += ACE_OS::sprintf (buffer + n, ASYS_TEXT ("?%s"), + n += ACE_OS::sprintf (buffer + n, ACE_TEXT ("?%s"), this->headers_); } @@ -894,7 +894,7 @@ ACE_Mailto_Addr::addr_to_string (LPTSTR buffer, } int -ACE_Mailto_Addr::string_to_addr (LPCTSTR address) +ACE_Mailto_Addr::string_to_addr (const ACE_TCHAR *address) { if (ACE_OS::strncasecmp (mailto, address, mailto_size) != 0) return -1; @@ -908,20 +908,20 @@ ACE_Mailto_Addr::string_to_addr (LPCTSTR address) if (this->ACE_URL_Addr::string_to_addr (address) != 0) return -1; - LPCTSTR string = address; + const ACE_TCHAR *string = address; string += mailto_size; // Make a copy of the string to manipulate it. - ASYS_TCHAR *t; + ACE_TCHAR *t; ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (string), -1); - ASYS_TCHAR *host_start = ACE_OS::strchr (t, '@'); + ACE_TCHAR *host_start = ACE_OS::strchr (t, '@'); if (host_start != 0) { // terminate the host:port substring host_start[0] = '\0'; host_start++; - ASYS_TCHAR *headers_start = ACE_OS::strchr (host_start, '?'); + ACE_TCHAR *headers_start = ACE_OS::strchr (host_start, '?'); if (headers_start != 0) { headers_start[0] = '\0'; diff --git a/websvcs/lib/URL_Addr.h b/websvcs/lib/URL_Addr.h index 5dc89033da3..aae680512e8 100644 --- a/websvcs/lib/URL_Addr.h +++ b/websvcs/lib/URL_Addr.h @@ -48,18 +48,18 @@ public: virtual ~ACE_URL_Addr (void); // destructor - LPCTSTR get_url (void) const; + const ACE_TCHAR *get_url (void) const; // Get the original URL int set (const ACE_URL_Addr& address); // Essentially the copy contructor. - virtual int string_to_addr (LPCTSTR address); + virtual int string_to_addr (const ACE_TCHAR *address); // Initializes from the scheme specific address, for instance: if // the address is an http URL it will initialize the address from // an string such as "www.cs.wustl.edu/~schmidt" - virtual int addr_to_string (LPTSTR s, + virtual int addr_to_string (ACE_TCHAR *s, size_t size, int flags = 0) const; // Write the address in the scheme specific representation. @@ -70,23 +70,23 @@ public: // The accept method in the Visitor Pattern. Should return 0 on // success and not 0 on failure. - static ACE_URL_Addr* create_address (LPCTSTR url); + static ACE_URL_Addr* create_address (const ACE_TCHAR *url); // Create an address from a complete URL, such as "http://www/foo" // or "ftp://ftp.here/get_this". - static int known_scheme (LPCTSTR url); + static int known_scheme (const ACE_TCHAR *url); // Returns 1 if the URL scheme is recognized, 0 otherwise. u_long hash (void) const; // Hash function protected: - void set_url (LPTSTR url); + void set_url (ACE_TCHAR *url); // Allows the derived classes to store the compact representation of // the URL private: - LPTSTR url_; + ACE_TCHAR *url_; }; class ACE_HTTP_Addr; @@ -156,15 +156,15 @@ public: ACE_HTTP_Addr (void); // Constructor - ACE_HTTP_Addr (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR query = 0, + ACE_HTTP_Addr (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *query = 0, u_short port = ACE_DEFAULT_HTTP_PORT); // Construct an HTTP URL from the host, path, query and port. - int set (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR query = 0, + int set (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *query = 0, u_short port = ACE_DEFAULT_HTTP_PORT); // Essentially the constructor above. @@ -186,19 +186,19 @@ public: // URL can be can be refering to an hostname that cannot be // validated at this point. - LPCTSTR get_hostname (void) const; + const ACE_TCHAR *get_hostname (void) const; // Get the name of the host. u_short get_port_number (void) const; // Get the port number. - LPCTSTR get_path (void) const; + const ACE_TCHAR *get_path (void) const; // Get the path component in the URL - LPCTSTR get_query (void) const; + const ACE_TCHAR *get_query (void) const; // Get the query component in the URL - ACE_URL_Addr* create_relative_address (LPCTSTR url) const; + ACE_URL_Addr* create_relative_address (const ACE_TCHAR *url) const; // Create an address from a (possibly) relative URL, such as // "../foo.html", or "/icons/bar.gif" // If the URL is absolute (like "http://www/foo" or "ftp:host/bar") @@ -210,8 +210,8 @@ public: // and port are used. // = The ACE_URL methods, see the documentation above. - virtual int string_to_addr (LPCTSTR address); - virtual int addr_to_string (LPTSTR s, + virtual int string_to_addr (const ACE_TCHAR *address); + virtual int addr_to_string (ACE_TCHAR *s, size_t size, int flags = 0) const; virtual int accept (ACE_URL_Addr_Visitor* visitor); @@ -225,14 +225,14 @@ private: // Helper method to cleanup resources private: - LPTSTR hostname_; + ACE_TCHAR *hostname_; u_short port_number_; // The host:port component in the URL - LPTSTR path_; + ACE_TCHAR *path_; // The path component in the URL - LPTSTR query_; + ACE_TCHAR *query_; // The query component in the URL }; @@ -258,17 +258,17 @@ public: ACE_FTP_Addr (void); // Constructor - ACE_FTP_Addr (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR user = 0, - LPCTSTR passwd = 0); + ACE_FTP_Addr (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *user = 0, + const ACE_TCHAR *passwd = 0); // Construct an FTP URL from the host_name, the path, the username // and the passwd. - int set (LPCTSTR host_name, - LPCTSTR path, - LPCTSTR user = 0, - LPCTSTR passwd = 0); + int set (const ACE_TCHAR *host_name, + const ACE_TCHAR *path, + const ACE_TCHAR *user = 0, + const ACE_TCHAR *passwd = 0); // Essentially the constructor above. ACE_FTP_Addr (const ACE_FTP_Addr &addr); @@ -283,16 +283,16 @@ public: virtual ~ACE_FTP_Addr (void); // Destructor - LPCTSTR get_hostname (void) const; + const ACE_TCHAR *get_hostname (void) const; // Get the host name component in the URL - LPCTSTR get_user (void) const; + const ACE_TCHAR *get_user (void) const; // Get the username component in the URL - LPCTSTR get_passwd (void) const; + const ACE_TCHAR *get_passwd (void) const; // Get the passwd component in the URL - LPCTSTR get_path (void) const; + const ACE_TCHAR *get_path (void) const; // Get the path component in the URL ACE_INET_Addr get_inet_address (void) const; @@ -300,8 +300,8 @@ public: // obtain the host and the port. // = The ACE_Addr methods, see the documentation above. - virtual int string_to_addr (LPCTSTR address); - virtual int addr_to_string (LPTSTR s, + virtual int string_to_addr (const ACE_TCHAR *address); + virtual int addr_to_string (ACE_TCHAR *s, size_t size, int flags = 0) const; virtual int accept (ACE_URL_Addr_Visitor* visitor); @@ -315,14 +315,14 @@ private: // Helper method to release the internal resources private: - LPTSTR user_; - LPTSTR passwd_; + ACE_TCHAR *user_; + ACE_TCHAR *passwd_; // The login name - LPTSTR hostname_; + ACE_TCHAR *hostname_; // The hostname part. - LPTSTR path_; + ACE_TCHAR *path_; // The other components. }; @@ -340,14 +340,14 @@ public: ACE_Mailto_Addr (void); // Constructor - ACE_Mailto_Addr (LPCTSTR user, - LPCTSTR hostname, - LPCTSTR headers = 0); + ACE_Mailto_Addr (const ACE_TCHAR *user, + const ACE_TCHAR *hostname, + const ACE_TCHAR *headers = 0); // Construct an FTP URL from the host, path and headers. - int set (LPCTSTR user, - LPCTSTR hostname, - LPCTSTR headers = 0); + int set (const ACE_TCHAR *user, + const ACE_TCHAR *hostname, + const ACE_TCHAR *headers = 0); // Essentially the constructor above. ACE_Mailto_Addr (const ACE_Mailto_Addr &addr); @@ -362,13 +362,13 @@ public: virtual ~ACE_Mailto_Addr (void); // Destructor - LPCTSTR get_user (void) const; + const ACE_TCHAR *get_user (void) const; // Get the username component in the URL - LPCTSTR get_hostname (void) const; + const ACE_TCHAR *get_hostname (void) const; // Get the hostname component in the URL - LPCTSTR get_headers (void) const; + const ACE_TCHAR *get_headers (void) const; // Get the headers as a single string // @@ TODO A mailto: URL can contain multiple headers, an iterator @@ -376,8 +376,8 @@ public: // headers would be nice also. // = The ACE_URL methods, see the documentation above. - virtual int string_to_addr (LPCTSTR address); - virtual int addr_to_string (LPTSTR s, + virtual int string_to_addr (const ACE_TCHAR *address); + virtual int addr_to_string (ACE_TCHAR *s, size_t size, int flags = 0) const; virtual int accept (ACE_URL_Addr_Visitor* visitor); @@ -391,9 +391,9 @@ private: // Helper method to cleanup resources private: - LPTSTR user_; - LPTSTR hostname_; - LPTSTR headers_; + ACE_TCHAR *user_; + ACE_TCHAR *hostname_; + ACE_TCHAR *headers_; }; #if defined (__ACE_INLINE__) diff --git a/websvcs/lib/URL_Addr.i b/websvcs/lib/URL_Addr.i index fe07bdf5a59..be329668408 100644 --- a/websvcs/lib/URL_Addr.i +++ b/websvcs/lib/URL_Addr.i @@ -118,7 +118,7 @@ ACE_FTP_Addr::get_path (void) const ACE_INLINE ACE_INET_Addr ACE_FTP_Addr::get_inet_address (void) const { - return ACE_INET_Addr (ASYS_TEXT ("ftp"), this->hostname_); + return ACE_INET_Addr (ACE_TEXT ("ftp"), this->hostname_); } // **************************************************************** diff --git a/websvcs/tests/Test_URL_Addr.cpp b/websvcs/tests/Test_URL_Addr.cpp index 644f0ebd467..7490cc4cd59 100644 --- a/websvcs/tests/Test_URL_Addr.cpp +++ b/websvcs/tests/Test_URL_Addr.cpp @@ -19,34 +19,34 @@ int main (int, char*[]) } #define HTTP_TEST_ARRAY \ - ASYS_TEXT("http://www.cs.wustl.edu/"), \ - ASYS_TEXT("http://www.cs.wustl.edu/index.html"), \ - ASYS_TEXT("http://www.cs.wustl.edu/form?var=foo"), \ - ASYS_TEXT("http://www.notexist.com:8080/index.html"), \ - ASYS_TEXT("http://www.notexist.com:80/index.html"), \ - ASYS_TEXT("ftp://foo"), \ - ASYS_TEXT("http://www/?kkk//") + ACE_TEXT("http://www.cs.wustl.edu/"), \ + ACE_TEXT("http://www.cs.wustl.edu/index.html"), \ + ACE_TEXT("http://www.cs.wustl.edu/form?var=foo"), \ + ACE_TEXT("http://www.notexist.com:8080/index.html"), \ + ACE_TEXT("http://www.notexist.com:80/index.html"), \ + ACE_TEXT("ftp://foo"), \ + ACE_TEXT("http://www/?kkk//") #define FTP_TEST_ARRAY \ - ASYS_TEXT("ftp://www.cs.wustl.edu/"), \ - ASYS_TEXT("ftp://user@www.cs.wustl.edu/"), \ - ASYS_TEXT("ftp://user:pass@www.cs.wustl.edu/"), \ - ASYS_TEXT("ftp://user:pass@www.cs.wustl.edu/path"), \ - ASYS_TEXT("ftp://www.cs.wustl.edu"), \ - ASYS_TEXT("http://www.cs.wustl.edu/index.html") + ACE_TEXT("ftp://www.cs.wustl.edu/"), \ + ACE_TEXT("ftp://user@www.cs.wustl.edu/"), \ + ACE_TEXT("ftp://user:pass@www.cs.wustl.edu/"), \ + ACE_TEXT("ftp://user:pass@www.cs.wustl.edu/path"), \ + ACE_TEXT("ftp://www.cs.wustl.edu"), \ + ACE_TEXT("http://www.cs.wustl.edu/index.html") #define MAILTO_TEST_ARRAY \ - ASYS_TEXT("mailto:ace-users@cs.wustl.edu"), \ - ASYS_TEXT("mailto:majordomo@cs.wustl.edu?Subject: subscribe ace-users"), \ - ASYS_TEXT("mailto:nobody"), \ - ASYS_TEXT("http://www.cs.wustl.edu") + ACE_TEXT("mailto:ace-users@cs.wustl.edu"), \ + ACE_TEXT("mailto:majordomo@cs.wustl.edu?Subject: subscribe ace-users"), \ + ACE_TEXT("mailto:nobody"), \ + ACE_TEXT("http://www.cs.wustl.edu") #define URL_TEST_ARRAY \ - ASYS_TEXT("file:/etc/passwd") + ACE_TEXT("file:/etc/passwd") void test_http_addr (void) { - static LPCTSTR addresses[] = { + static const ACE_TCHAR *addresses[] = { HTTP_TEST_ARRAY }; static int naddresses = sizeof(addresses)/sizeof(addresses[0]); @@ -62,7 +62,7 @@ void test_http_addr (void) continue; } - ASYS_TCHAR buffer[BUFSIZ]; + ACE_TCHAR buffer[BUFSIZ]; if (addr.addr_to_string (buffer, BUFSIZ, i%2) == 0) { ACE_DEBUG ((LM_DEBUG, @@ -86,7 +86,7 @@ void test_http_addr (void) void test_ftp_addr (void) { - static LPCTSTR addresses[] = { + static const ACE_TCHAR *addresses[] = { FTP_TEST_ARRAY }; static int naddresses = sizeof(addresses)/sizeof(addresses[0]); @@ -102,7 +102,7 @@ void test_ftp_addr (void) continue; } - ASYS_TCHAR buffer[BUFSIZ]; + ACE_TCHAR buffer[BUFSIZ]; if (addr.addr_to_string (buffer, BUFSIZ, i%2) == 0) { ACE_DEBUG ((LM_DEBUG, @@ -127,7 +127,7 @@ void test_ftp_addr (void) void test_mailto_addr (void) { - static LPCTSTR addresses[] = { + static const ACE_TCHAR *addresses[] = { MAILTO_TEST_ARRAY }; static int naddresses = sizeof(addresses)/sizeof(addresses[0]); @@ -143,7 +143,7 @@ void test_mailto_addr (void) continue; } - ASYS_TCHAR buffer[BUFSIZ]; + ACE_TCHAR buffer[BUFSIZ]; if (addr.addr_to_string (buffer, BUFSIZ, i%2) == 0) { ACE_DEBUG ((LM_DEBUG, @@ -168,7 +168,7 @@ void test_mailto_addr (void) void test_url_addr (void) { - static LPCTSTR addresses[] = { + static const ACE_TCHAR *addresses[] = { HTTP_TEST_ARRAY, FTP_TEST_ARRAY, MAILTO_TEST_ARRAY, @@ -188,7 +188,7 @@ void test_url_addr (void) continue; } - ASYS_TCHAR buffer[BUFSIZ]; + ACE_TCHAR buffer[BUFSIZ]; if (addr->addr_to_string (buffer, BUFSIZ, i%2) == 0) { ACE_DEBUG ((LM_DEBUG, |