diff options
-rw-r--r-- | ACEXML/common/FileCharStream.cpp | 8 | ||||
-rw-r--r-- | ACEXML/common/FileCharStream.h | 3 | ||||
-rw-r--r-- | ACEXML/common/HttpCharStream.cpp | 16 | ||||
-rw-r--r-- | ACEXML/common/HttpCharStream.h | 3 | ||||
-rw-r--r-- | ACEXML/common/Makefile.bor | 5 | ||||
-rw-r--r-- | ACEXML/common/Mem_Map_Stream.cpp | 2 | ||||
-rw-r--r-- | ACEXML/common/URL_Addr.cpp | 36 | ||||
-rw-r--r-- | ACEXML/common/URL_Addr.h | 26 | ||||
-rw-r--r-- | ACEXML/common/XML_Codecs.cpp | 12 | ||||
-rw-r--r-- | ACEXML/tests/HttpCharStream_Test.cpp | 27 | ||||
-rw-r--r-- | ACEXML/tests/Makefile.bor | 3 | ||||
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 32 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 32 | ||||
-rw-r--r-- | tests/Codecs_Test.cpp | 4 |
15 files changed, 160 insertions, 81 deletions
diff --git a/ACEXML/common/FileCharStream.cpp b/ACEXML/common/FileCharStream.cpp index 51aa8d6c210..885ba18f0ad 100644 --- a/ACEXML/common/FileCharStream.cpp +++ b/ACEXML/common/FileCharStream.cpp @@ -9,14 +9,6 @@ ACEXML_FileCharStream::ACEXML_FileCharStream (void) { } -ACEXML_FileCharStream::ACEXML_FileCharStream (const ACEXML_Char *name) - : filename_ (), - infile_ (NULL) -{ - this->open (name); -} - - ACEXML_FileCharStream::~ACEXML_FileCharStream (void) { if (this->infile_ != NULL) diff --git a/ACEXML/common/FileCharStream.h b/ACEXML/common/FileCharStream.h index 8b4b133a4dc..0e968b9e818 100644 --- a/ACEXML/common/FileCharStream.h +++ b/ACEXML/common/FileCharStream.h @@ -27,9 +27,6 @@ public: /// Default constructor. ACEXML_FileCharStream (void); - /// Construct and opening a file. - ACEXML_FileCharStream (const ACEXML_Char *name); - /// Destructor virtual ~ACEXML_FileCharStream (void); diff --git a/ACEXML/common/HttpCharStream.cpp b/ACEXML/common/HttpCharStream.cpp index a6ae27b7ba2..0c8b99af5ce 100644 --- a/ACEXML/common/HttpCharStream.cpp +++ b/ACEXML/common/HttpCharStream.cpp @@ -2,9 +2,10 @@ #include "ace/ACE.h" #include "ace/Auto_Ptr.h" - #include "ACEXML/common/HttpCharStream.h" +ACE_RCSID (common, HttpCharStream, "$Id$") + /* Header FSM states. */ static const int HDST_LINE1_PROTOCOL = 0; static const int HDST_LINE1_WHITESPACE = 1; @@ -26,17 +27,6 @@ ACEXML_HttpCharStream::ACEXML_HttpCharStream (void) } -ACEXML_HttpCharStream::ACEXML_HttpCharStream (const ACEXML_Char *url) - : url_(0), - url_addr_(0), - stream_(0), - connector_(0), - size_(0) -{ - this->open (url); -} - - ACEXML_HttpCharStream::~ACEXML_HttpCharStream (void) { this->close (); @@ -86,7 +76,7 @@ ACEXML_HttpCharStream::get_url (size_t& len) { int header_state = HDST_LINE1_PROTOCOL; int status = 0; - size_t b; + size_t b = 0; ACEXML_Char* buf = 0; size_t buflen = BUFSIZ; for (;;) diff --git a/ACEXML/common/HttpCharStream.h b/ACEXML/common/HttpCharStream.h index b74210907a0..02c9b5599ff 100644 --- a/ACEXML/common/HttpCharStream.h +++ b/ACEXML/common/HttpCharStream.h @@ -33,9 +33,6 @@ public: /// Default constructor. ACEXML_HttpCharStream (void); - /// Construct and open an URL. - ACEXML_HttpCharStream (const ACEXML_Char *url); - /// Destructor virtual ~ACEXML_HttpCharStream (void); diff --git a/ACEXML/common/Makefile.bor b/ACEXML/common/Makefile.bor index 2b182b02afb..98975191068 100644 --- a/ACEXML/common/Makefile.bor +++ b/ACEXML/common/Makefile.bor @@ -19,7 +19,10 @@ OBJFILES = \ $(OBJDIR)\StrCharStream.obj \ $(OBJDIR)\Transcode.obj \ $(OBJDIR)\Validator.obj \ - $(OBJDIR)\XMLFilterImpl.obj + $(OBJDIR)\XMLFilterImpl.obj \ + $(OBJDIR)\Mem_Map_Stream.obj \ + $(OBJDIR)\HttpCharStream.obj \ + $(OBJDIR)\URL_Addr.obj CFLAGS = \ $(ACE_CFLAGS) \ diff --git a/ACEXML/common/Mem_Map_Stream.cpp b/ACEXML/common/Mem_Map_Stream.cpp index 052c6033a33..36ef4dfd940 100644 --- a/ACEXML/common/Mem_Map_Stream.cpp +++ b/ACEXML/common/Mem_Map_Stream.cpp @@ -4,7 +4,7 @@ #include "ace/Auto_Ptr.h" #include "ACEXML/common/Mem_Map_Stream.h" -ACE_RCSID(common, Mem_Map_Stream, "$Id$"); +ACE_RCSID(common, Mem_Map_Stream, "$Id$") ACEXML_Mem_Map_Stream::ACEXML_Mem_Map_Stream (void) { diff --git a/ACEXML/common/URL_Addr.cpp b/ACEXML/common/URL_Addr.cpp index 7afd365e687..e1c9d9ebab6 100644 --- a/ACEXML/common/URL_Addr.cpp +++ b/ACEXML/common/URL_Addr.cpp @@ -5,7 +5,7 @@ #include "ACEXML/common/URL_Addr.h" -ACE_RCSID(common, ACEXML_URL_Addr, "$Id$"); +ACE_RCSID(common, ACEXML_URL_Addr, "$Id$") ACEXML_URL_Addr::ACEXML_URL_Addr (void) : path_name_ (0), @@ -15,7 +15,7 @@ ACEXML_URL_Addr::ACEXML_URL_Addr (void) } int -ACEXML_URL_Addr::addr_to_string (ACE_TCHAR *s, +ACEXML_URL_Addr::addr_to_string (ACEXML_Char *s, size_t size, int ipaddr_format) const { @@ -43,7 +43,7 @@ ACEXML_URL_Addr::addr_to_string (ACE_TCHAR *s, } } -const ACE_TCHAR * +const ACEXML_Char * ACEXML_URL_Addr::addr_to_string (int ipaddr_format) const { ACEXML_URL_Addr *this_ptr = ACE_const_cast (ACEXML_URL_Addr *, @@ -62,7 +62,7 @@ ACEXML_URL_Addr::addr_to_string (int ipaddr_format) const if (size > this->addr_string_len_) { ACE_ALLOCATOR_RETURN (this_ptr->addr_string_, - (ACE_TCHAR *) ACE_OS::realloc ((void *) this->addr_string_, + (ACEXML_Char *) ACE_OS::realloc ((void *) this->addr_string_, size), 0); this_ptr->addr_string_len_ = size; @@ -78,7 +78,7 @@ ACEXML_URL_Addr::addr_to_string (int ipaddr_format) const } int -ACEXML_URL_Addr::string_to_addr (const ACE_TCHAR *s) +ACEXML_URL_Addr::string_to_addr (const ACEXML_Char *s) { if (s == 0) return -1; @@ -90,7 +90,7 @@ ACEXML_URL_Addr::string_to_addr (const ACE_TCHAR *s) if (ACE_OS::strncmp (http, s, http_len) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Invalid URL %s\n", s), -1); - const ACE_TCHAR* url = 0; + const ACEXML_Char* url = 0; // Get the host name for (url = s + http_len; *url != '\0' && *url != ':' && *url != '/'; ++url) ; @@ -98,16 +98,16 @@ ACEXML_URL_Addr::string_to_addr (const ACE_TCHAR *s) int host_len = url - s; host_len -= http_len; - ACE_TCHAR* host_name = 0; - ACE_NEW_RETURN (host_name, ACE_TCHAR[host_len + 1], -1); + ACEXML_Char* host_name = 0; + ACE_NEW_RETURN (host_name, ACEXML_Char[host_len + 1], -1); ACE_OS::strncpy (host_name, s + http_len, host_len); host_name[host_len] = '\0'; - ACE_Auto_Array_Ptr<ACE_TCHAR> cleanup_host_name (host_name); + ACE_Auto_Basic_Array_Ptr<ACEXML_Char> cleanup_host_name (host_name); // Get the port number (if any) - u_short port = ACE_DEFAULT_HTTP_PORT; + unsigned short port = ACE_DEFAULT_HTTP_PORT; if (*url == ':') - port = (u_short) ACE_OS::atoi (++url); // Skip over ':' + port = (unsigned short) ACE_OS::atoi (++url); // Skip over ':' // Set the addr int result = this->ACE_INET_Addr::set (port, host_name); @@ -116,7 +116,7 @@ ACEXML_URL_Addr::string_to_addr (const ACE_TCHAR *s) return -1; // Get the path name - const ACE_TCHAR* path_name = 0; + const ACEXML_Char* path_name = 0; if (*url == '\0') path_name = "/"; else @@ -199,9 +199,9 @@ ACEXML_URL_Addr::operator!= (const ACEXML_URL_Addr &addr) const return !(*this == addr); } -ACEXML_URL_Addr::ACEXML_URL_Addr (const ACE_TCHAR *host_name, - const ACE_TCHAR *path_name, - u_short port) +ACEXML_URL_Addr::ACEXML_URL_Addr (const ACEXML_Char *host_name, + const ACEXML_Char *path_name, + unsigned short port) : ACE_INET_Addr (port, host_name), path_name_ (ACE_OS::strdup (path_name)), addr_string_ (0), @@ -209,7 +209,7 @@ ACEXML_URL_Addr::ACEXML_URL_Addr (const ACE_TCHAR *host_name, { } -const ACE_TCHAR * +const ACEXML_Char * ACEXML_URL_Addr::get_path_name (void) const { return this->path_name_; @@ -218,10 +218,10 @@ ACEXML_URL_Addr::get_path_name (void) const ACEXML_URL_Addr::~ACEXML_URL_Addr (void) { ACE_OS::free (ACE_reinterpret_cast (void *, - ACE_const_cast (ACE_TCHAR *, + ACE_const_cast (ACEXML_Char *, this->path_name_))); ACE_OS::free (ACE_reinterpret_cast (void *, - ACE_const_cast (ACE_TCHAR *, + ACE_const_cast (ACEXML_Char *, this->addr_string_))); this->path_name_ = 0; } diff --git a/ACEXML/common/URL_Addr.h b/ACEXML/common/URL_Addr.h index faa267b9e0d..668d07f2318 100644 --- a/ACEXML/common/URL_Addr.h +++ b/ACEXML/common/URL_Addr.h @@ -12,29 +12,29 @@ #ifndef _ACEXML_URL_ADDR_H #define _ACEXML_URL_ADDR_H -#include "ace/INET_Addr.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) #define ACE_LACKS_PRAGMA_ONCE #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/ACE.h" +#include "ace/INET_Addr.h" +#include "ACEXML/common/XML_Types.h" +#include "ACEXML/common/ACEXML_Export.h" /** * @class ACEXML_URL_Addr URL_Addr.h "ACEXML/common/URL_Addr.h" * * Defines a URL address family address format. */ -class ACEXML_URL_Addr : public ACE_INET_Addr +class ACEXML_Export ACEXML_URL_Addr : public ACE_INET_Addr { public: /// Initialization and termination methods. ACEXML_URL_Addr (void); /// Constructor. - ACEXML_URL_Addr (const ACE_TCHAR *host_name, - const ACE_TCHAR *path_name, - u_short port = ACE_DEFAULT_HTTP_PORT); + ACEXML_URL_Addr (const ACEXML_Char *host_name, + const ACEXML_Char *path_name, + unsigned short port = ACE_DEFAULT_HTTP_PORT); /// Copy constructor. ACEXML_URL_Addr (const ACEXML_URL_Addr &addr); @@ -50,7 +50,7 @@ public: * <address> it is assumed to be an ip-number or ip-address number, with * the port number <ACE_DEFAULT_HTTP_PORT>. */ - virtual int string_to_addr (const ACE_TCHAR *address); + virtual int string_to_addr (const ACEXML_Char *address); /** * Transform the current <ACE_INET_Addr> address into string format. If @@ -61,7 +61,7 @@ public: * "www.cs.wustl.edu:80/~schmidt/"). Returns -1 if the <size> of the * <buffer> is too small, else 0. */ - virtual int addr_to_string (ACE_TCHAR *s, + virtual int addr_to_string (ACEXML_Char *s, size_t size, int ipaddr_format = 1) const; @@ -75,7 +75,7 @@ public: * allocated on demand and deallocated when the object is destroyed. * Returns -1 if dynamic memory fails, else 0. */ - virtual const ACE_TCHAR *addr_to_string (int ipaddr_format = 1) const; + virtual const ACEXML_Char *addr_to_string (int ipaddr_format = 1) const; /// Assignment operator. void operator= (const ACEXML_URL_Addr &addr); @@ -96,16 +96,16 @@ public: virtual u_long hash (void) const; /// Return the path name. - const ACE_TCHAR *get_path_name (void) const; + const ACEXML_Char *get_path_name (void) const; /// Commit suicide. int destroy (void); private: - ACE_TCHAR *path_name_; + ACEXML_Char *path_name_; // Our path name. - ACE_TCHAR *addr_string_; + ACEXML_Char *addr_string_; // The dynamically created address string that's used for the // <addr_to_string> method. diff --git a/ACEXML/common/XML_Codecs.cpp b/ACEXML/common/XML_Codecs.cpp index cf3b27af97d..300ffdd5d4e 100644 --- a/ACEXML/common/XML_Codecs.cpp +++ b/ACEXML/common/XML_Codecs.cpp @@ -11,43 +11,35 @@ ACEXML_Base64::encode (const ACEXML_Char* input, { if (!input) return 0; - size_t len = ACE_OS::strlen (input); ACE_Byte* buf = 0; - ACE_NEW_RETURN (buf, ACE_Byte[len], 0); - - ACE_Auto_Array_Ptr<ACE_Byte> cleanup_buf (buf); + ACE_Auto_Basic_Array_Ptr<ACE_Byte> cleanup_buf (buf); for (size_t i = 0; i < len; ++i) buf[i] = (ACE_Byte)input[i]; - buf[len] = 0; size_t encode_len = 0; - ACE_Byte* encodedBuf = ACE_Base64::encode (buf, len, &encode_len); if (!encodedBuf) return 0; ACEXML_Char* result = 0; - ACE_NEW_RETURN (result, ACEXML_Char[encode_len+1], 0); for (size_t j = 0; j < encode_len; ++j) result[j] = (ACEXML_Char)encodedBuf[j]; - result[encode_len] = 0; *output_len = encode_len; delete[] encodedBuf; - return result; } @@ -67,7 +59,7 @@ ACEXML_Base64::decode (const ACEXML_Char* input, ACE_Byte[len], 0); - ACE_Auto_Array_Ptr<ACE_Byte> cleanup (buf); + ACE_Auto_Basic_Array_Ptr<ACE_Byte> cleanup (buf); for (size_t i = 0; i < len; ++i) buf[i] = (ACE_Byte)input[i]; diff --git a/ACEXML/tests/HttpCharStream_Test.cpp b/ACEXML/tests/HttpCharStream_Test.cpp index fd46b10aeb3..0ee67722b88 100644 --- a/ACEXML/tests/HttpCharStream_Test.cpp +++ b/ACEXML/tests/HttpCharStream_Test.cpp @@ -4,21 +4,32 @@ int ACE_TMAIN (int, ACE_TCHAR *[]) { - const ACEXML_Char* godfather = "http://www.cs.wustl.edu/~nanbor/"; + const ACEXML_Char* test = "http://www.cs.wustl.edu/~nanbor/"; - const ACEXML_Char* shishya = "http://www.cs.wustl.edu/~kitty/"; - - ACEXML_HttpCharStream stream (godfather); + const ACEXML_Char* simple = "http://www.cs.wustl.edu/~kitty/"; + ACEXML_HttpCharStream stream; ACEXML_Char ch; - while (stream.get (ch) != -1) - ACE_OS::printf ("%c", ch); - stream.close(); + if (stream.open (test) != -1) + { + while (stream.get (ch) != -1) + ACE_OS::printf ("%c", ch); + stream.close(); + } + else + { + ACE_ERROR ((LM_ERROR, "Error in opening stream : %m\n")); + } - if (stream.open (shishya) != -1) + if (stream.open (simple) != -1) { while (stream.get (ch) != -1) ACE_OS::printf ("%c", ch); } + else + { + ACE_ERROR ((LM_ERROR, "Error in opening stream : %m\n")); + } + return 0; } diff --git a/ACEXML/tests/Makefile.bor b/ACEXML/tests/Makefile.bor index 0742a1add18..b7de8ddaea5 100644 --- a/ACEXML/tests/Makefile.bor +++ b/ACEXML/tests/Makefile.bor @@ -5,7 +5,8 @@ NAMES = \ NamespaceSupport_Test \ - Transcoder_Test + Transcoder_Test \ + HttpCharStream_Test OBJFILES = $(OBJDIR)\$(NAME).obj diff --git a/ChangeLog b/ChangeLog index 9b98d506e4e..d42e9db729b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Tue Jun 04 16:02:11 2002 Krishnakumar B <kitty@cs.wustl.edu> + + * ACEXML/common/HttpCharStream.h: + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/common/Filecharstream.h: + * ACEXML/common/Filecharstream.cpp: + + Removed the constructor which accepted a string containing + either a filename or a URL from these files. Problem was it was + relying on calling open to do the work, but if open fails there + was no way to report the error without throwing exceptions. So + don't allow people to use this constructor and always insist on + using open. + + * ACEXML/common/Mem_Map_Stream.cpp: + * ACEXML/common/URL_Addr.h: + * ACEXML/common/URL_Addr.cpp: + * ACEXML/common/XML_Codecs.cpp: + * tests/Codecs_Test.cpp: + + Other miscellaneous fixes including using + ACE_Auto_Basic_Array_Ptr instead of ACE_Auto_Array_Ptr. + + * ACEXML/common/Makefile.bor: + * ACEXML/tests/Makefile.bor: + + Added new files. + + * ACEXML/tests/HttpCharStream_Test.cpp: + + Cosmetic fixes. + Tue Jun 04 14:18:56 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/tests/HttpCharStream_Test.dsp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 9b98d506e4e..d42e9db729b 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,35 @@ +Tue Jun 04 16:02:11 2002 Krishnakumar B <kitty@cs.wustl.edu> + + * ACEXML/common/HttpCharStream.h: + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/common/Filecharstream.h: + * ACEXML/common/Filecharstream.cpp: + + Removed the constructor which accepted a string containing + either a filename or a URL from these files. Problem was it was + relying on calling open to do the work, but if open fails there + was no way to report the error without throwing exceptions. So + don't allow people to use this constructor and always insist on + using open. + + * ACEXML/common/Mem_Map_Stream.cpp: + * ACEXML/common/URL_Addr.h: + * ACEXML/common/URL_Addr.cpp: + * ACEXML/common/XML_Codecs.cpp: + * tests/Codecs_Test.cpp: + + Other miscellaneous fixes including using + ACE_Auto_Basic_Array_Ptr instead of ACE_Auto_Array_Ptr. + + * ACEXML/common/Makefile.bor: + * ACEXML/tests/Makefile.bor: + + Added new files. + + * ACEXML/tests/HttpCharStream_Test.cpp: + + Cosmetic fixes. + Tue Jun 04 14:18:56 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/tests/HttpCharStream_Test.dsp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 9b98d506e4e..d42e9db729b 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,35 @@ +Tue Jun 04 16:02:11 2002 Krishnakumar B <kitty@cs.wustl.edu> + + * ACEXML/common/HttpCharStream.h: + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/common/Filecharstream.h: + * ACEXML/common/Filecharstream.cpp: + + Removed the constructor which accepted a string containing + either a filename or a URL from these files. Problem was it was + relying on calling open to do the work, but if open fails there + was no way to report the error without throwing exceptions. So + don't allow people to use this constructor and always insist on + using open. + + * ACEXML/common/Mem_Map_Stream.cpp: + * ACEXML/common/URL_Addr.h: + * ACEXML/common/URL_Addr.cpp: + * ACEXML/common/XML_Codecs.cpp: + * tests/Codecs_Test.cpp: + + Other miscellaneous fixes including using + ACE_Auto_Basic_Array_Ptr instead of ACE_Auto_Array_Ptr. + + * ACEXML/common/Makefile.bor: + * ACEXML/tests/Makefile.bor: + + Added new files. + + * ACEXML/tests/HttpCharStream_Test.cpp: + + Cosmetic fixes. + Tue Jun 04 14:18:56 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/tests/HttpCharStream_Test.dsp: diff --git a/tests/Codecs_Test.cpp b/tests/Codecs_Test.cpp index c053d548645..3309f83a56d 100644 --- a/tests/Codecs_Test.cpp +++ b/tests/Codecs_Test.cpp @@ -52,7 +52,7 @@ encode_decode_stream (const ACE_Byte* stream, size_t length) encodeBuf)); - ACE_Auto_Array_Ptr<ACE_Byte> cleanup_encodeBuf (encodeBuf); + ACE_Auto_Basic_Array_Ptr<ACE_Byte> cleanup_encodeBuf (encodeBuf); size_t decode_len = 0; ACE_Byte* decodeBuf = ACE_Base64::decode (encodeBuf, &decode_len); @@ -64,7 +64,7 @@ encode_decode_stream (const ACE_Byte* stream, size_t length) return -1; } - ACE_Auto_Array_Ptr<ACE_Byte> cleanup_decodeBuf (decodeBuf); + ACE_Auto_Basic_Array_Ptr<ACE_Byte> cleanup_decodeBuf (decodeBuf); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Decoded Base64 encoded stream = %s\n"), |