From 575892bd574cd622c99d0c2febeeea6f63b27b6a Mon Sep 17 00:00:00 2001 From: Phil Mesnier Date: Mon, 16 Dec 2002 21:32:16 +0000 Subject: ChangeLog tag: Mon Dec 16 13:14:34 2002 Phil Mesnier --- ChangeLog | 36 +++++++++++ ChangeLogs/ChangeLog-03a | 36 +++++++++++ ace/CDR_Stream.cpp | 161 ++++++++++++++++++++++++++++++++++------------- ace/CDR_Stream.h | 69 ++++++++++++++++++++ ace/CDR_Stream.i | 128 +++++++++++++++++++++++++++++++++++++ 5 files changed, 386 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba2a09335b2..8a1bdb43686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +Mon Dec 16 13:14:34 2002 Phil Mesnier + + * ace/CDR_Stream.cpp: + * ace/CDR_Stream.h: + * ace/CDR_Stream.i: + Preparing for codeset negotiation. The ACE input/output CDR streams' + support for wide character IO is enhanced by adding a flag to allow + or disallow wchar i/o regardless of whether a translator is present. + There are times when wchar is not allowed, such as GIOP 1.0, or when + a native codeset for wchar was not specified. In CORBA, a native wchar + codeset must be specified, it may not be defaulted. Within the ACE + CDR streams, wchar i/o is allowed by default, to ensure backwards + compatibility. + + I fixed a few of the reading and writing methods to ensure that the + good_bit_ flag is cleared if an error occurs. This was not happening in + all cases, leading to errors elsewhere. + + I have extended the definition of the ACE_[W]Char_Codeset_Translator + classes to make them reference counted objects. There are some codesets + that support shifting and may be stateful. By using reference counting, + the CDR streams don't have to worry about ownership of stateful + translators. + + Finally, the translators now have pure virtual methods that return the + native and translated codeset ID values. These values refer to entries + in the DCE Code and Character Set Registry, which is the reference for + CORBA codeset ids. Anyone implementing a char or wchar codeset will + have to supply a numeric value for the native codeset (ncs) and the + translated codeset (tcs). NCS refers to the codeset of the text on the + application side of the stream, and TCS refers to the codset of the + text on the "wire" side of the stream. + + These changes are not everything that is required to support codeset + negotiation, but it is all the changes required to the CDR streams. + Sat Dec 14 08:56:23 2002 Douglas C. Schmidt * ace/Timer_Queue_T.cpp (timeout): Commented out the change below diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index ba2a09335b2..8a1bdb43686 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,39 @@ +Mon Dec 16 13:14:34 2002 Phil Mesnier + + * ace/CDR_Stream.cpp: + * ace/CDR_Stream.h: + * ace/CDR_Stream.i: + Preparing for codeset negotiation. The ACE input/output CDR streams' + support for wide character IO is enhanced by adding a flag to allow + or disallow wchar i/o regardless of whether a translator is present. + There are times when wchar is not allowed, such as GIOP 1.0, or when + a native codeset for wchar was not specified. In CORBA, a native wchar + codeset must be specified, it may not be defaulted. Within the ACE + CDR streams, wchar i/o is allowed by default, to ensure backwards + compatibility. + + I fixed a few of the reading and writing methods to ensure that the + good_bit_ flag is cleared if an error occurs. This was not happening in + all cases, leading to errors elsewhere. + + I have extended the definition of the ACE_[W]Char_Codeset_Translator + classes to make them reference counted objects. There are some codesets + that support shifting and may be stateful. By using reference counting, + the CDR streams don't have to worry about ownership of stateful + translators. + + Finally, the translators now have pure virtual methods that return the + native and translated codeset ID values. These values refer to entries + in the DCE Code and Character Set Registry, which is the reference for + CORBA codeset ids. Anyone implementing a char or wchar codeset will + have to supply a numeric value for the native codeset (ncs) and the + translated codeset (tcs). NCS refers to the codeset of the text on the + application side of the stream, and TCS refers to the codset of the + text on the "wire" side of the stream. + + These changes are not everything that is required to support codeset + negotiation, but it is all the changes required to the CDR streams. + Sat Dec 14 08:56:23 2002 Douglas C. Schmidt * ace/Timer_Queue_T.cpp (timeout): Commented out the change below diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index 8b056cf544b..0c98d01ca1c 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -39,7 +39,9 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_(1) + { ACE_CDR::mb_align (&this->start_); this->current_ = &this->start_; @@ -72,7 +74,8 @@ ACE_OutputCDR::ACE_OutputCDR (char *data, size_t size, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { // We cannot trust the buffer to be properly aligned ACE_CDR::mb_align (&this->start_); @@ -93,7 +96,8 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { // We cannot trust the buffer to be properly aligned ACE_CDR::mb_align (&this->start_); @@ -165,6 +169,13 @@ ACE_OutputCDR::grow_and_adjust (size_t size, ACE_CDR::Boolean ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) { + if (!this->wchar_allowed_) + { + errno = EACCES; + return (this->good_bit_ = 0); + } + if (this->wchar_translator_ != 0) + return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); if (ACE_static_cast (ACE_CDR::Short, major_version_) == 1 && ACE_static_cast (ACE_CDR::Short, minor_version_) == 2) { @@ -174,17 +185,15 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) (const ACE_CDR::Octet*, &x), ACE_static_cast (ACE_CDR::ULong, len)); } - else if (this->wchar_translator_ == 0) - { - if (sizeof (ACE_CDR::WChar) == 2) - return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort *, - &x)); - else - return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, - &x)); - + else if (ACE_static_cast (ACE_CDR::Short, minor_version_) == 0) + { // wchar is not allowed with GIOP 1.0. + errno = EINVAL; + return (this->good_bit_ = 0); } - return this->wchar_translator_->write_wchar (*this, x); + if (sizeof (ACE_CDR::WChar) == 2) + return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort *, &x)); + else + return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, &x)); } ACE_CDR::Boolean @@ -212,7 +221,7 @@ ACE_OutputCDR::write_string (ACE_CDR::ULong len, return this->write_char (0); } - return 0; + return (this->good_bit_ = 0); } ACE_CDR::Boolean @@ -232,6 +241,12 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, // i.e. normally the translator will be 0, but OTOH the code is // smaller and should be better for the cache ;-) ;-) // What do we do for GIOP 1.2??? + // Phil's answer->the translator writer's will have to deal. + if (!this->wchar_allowed_) + { + errno = EACCES; + return (this->good_bit_ = 0); + } if (this->wchar_translator_ != 0) return this->wchar_translator_->write_wstring (*this, len, x); @@ -259,7 +274,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, } else if (this->write_ulong (1)) return this->write_wchar (0); - return 0; + return (this->good_bit_ = 0); } ACE_CDR::Boolean @@ -281,7 +296,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, ACE_static_cast (ACE_CDR::ULong, length))) - return 0; + return (this->good_bit_ = 0); continue; } @@ -292,7 +307,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, ACE_static_cast (ACE_CDR::ULong, length))) - return 0; + return (this->good_bit_ = 0); continue; } @@ -539,7 +554,8 @@ ACE_InputCDR::ACE_InputCDR (const char *buf, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { this->start_.wr_ptr (bufsiz); } @@ -554,7 +570,8 @@ ACE_InputCDR::ACE_InputCDR (size_t bufsiz, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { } @@ -567,7 +584,8 @@ ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { this->reset (data, byte_order); } @@ -583,7 +601,8 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { } @@ -600,7 +619,8 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, major_version_ (major_version), minor_version_ (minor_version), char_translator_ (0), - wchar_translator_ (0) + wchar_translator_ (0), + wchar_allowed_ (1) { // Set the read pointer this->start_.rd_ptr (rd_pos); @@ -624,9 +644,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, good_bit_ (1), major_version_ (rhs.major_version_), minor_version_ (rhs.minor_version_), - char_translator_ (0), - wchar_translator_ (0) + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_), + wchar_allowed_ (rhs.wchar_allowed_) { + if (this->char_translator_) + this->char_translator_->add_ref(); + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), @@ -653,9 +678,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, good_bit_ (1), major_version_ (rhs.major_version_), minor_version_ (rhs.minor_version_), - char_translator_ (0), - wchar_translator_ (0) + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_), + wchar_allowed_ (rhs.wchar_allowed_) { + if (this->char_translator_) + this->char_translator_->add_ref(); + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), @@ -688,8 +718,13 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) major_version_ (rhs.major_version_), minor_version_ (rhs.minor_version_), char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) + wchar_translator_ (rhs.wchar_translator_), + wchar_allowed_ (rhs.wchar_allowed_) { + if (this->char_translator_) + this->char_translator_->add_ref(); + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); char *buf = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); @@ -706,8 +741,14 @@ ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x) major_version_ (x.rhs_.major_version_), minor_version_ (x.rhs_.minor_version_), char_translator_ (x.rhs_.char_translator_), - wchar_translator_ (x.rhs_.wchar_translator_) + wchar_translator_ (x.rhs_.wchar_translator_), + wchar_allowed_ (x.rhs_.wchar_allowed_) { + if (this->char_translator_) + this->char_translator_->add_ref(); + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); + this->start_.rd_ptr (x.rhs_.start_.rd_ptr ()); this->start_.wr_ptr (x.rhs_.start_.wr_ptr ()); @@ -725,6 +766,13 @@ ACE_InputCDR::operator= (const ACE_InputCDR& rhs) this->start_.wr_ptr (rhs.start_.wr_ptr ()); this->do_byte_swap_ = rhs.do_byte_swap_; this->good_bit_ = 1; + this->char_translator_ = rhs.char_translator_; + if (this->char_translator_) + this->char_translator_->add_ref(); + this->wchar_translator_ = rhs.wchar_translator_; + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); + this->wchar_allowed_ = rhs.wchar_allowed_; this->major_version_ = rhs.major_version_; this->minor_version_ = rhs.minor_version_; } @@ -750,9 +798,15 @@ ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs, good_bit_ (1), major_version_ (rhs.major_version_), minor_version_ (rhs.minor_version_), - char_translator_ (0), - wchar_translator_ (0) + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_), + wchar_allowed_ (rhs.wchar_allowed_) { + if (this->char_translator_) + this->char_translator_->add_ref(); + if (this->wchar_translator_) + this->wchar_translator_->add_ref(); + ACE_CDR::mb_align (&this->start_); for (const ACE_Message_Block *i = rhs.begin (); i != rhs.end (); @@ -779,12 +833,22 @@ ACE_InputCDR::skip_wchar (void) return this->read_4 (ACE_reinterpret_cast (ACE_CDR::ULong *,&x)); } - return 0; + return (this->good_bit_ = 0); } ACE_CDR::Boolean ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) { + if (!this->wchar_allowed_) + { + errno = EACCES; + return (this->good_bit_ = 0); + } + if (this->wchar_translator_ != 0) + { + this->good_bit_ = this->wchar_translator_->read_wchar (*this,x); + return this->good_bit_; + } if (ACE_static_cast (ACE_CDR::Short, major_version_) == 1 && ACE_static_cast (ACE_CDR::Short, minor_version_) == 2) { @@ -794,18 +858,16 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) return this->read_octet_array (ACE_reinterpret_cast (ACE_CDR::Octet*, &x), ACE_static_cast (ACE_CDR::ULong, len)); - } - else if (this->wchar_translator_ == 0) - { - if (sizeof (ACE_CDR::WChar) == 2) - return this->read_2 (ACE_reinterpret_cast (ACE_CDR::UShort *, - &x)); else - return this->read_4 (ACE_reinterpret_cast (ACE_CDR::ULong *, - &x)); + return (this->good_bit_ = 0); } - return this->wchar_translator_->read_wchar (*this, x); + if (sizeof (ACE_CDR::WChar) == 2) + return this->read_2 (ACE_reinterpret_cast (ACE_CDR::UShort *, + &x)); + else + return this->read_4 (ACE_reinterpret_cast (ACE_CDR::ULong *, + &x)); } ACE_CDR::Boolean @@ -815,7 +877,10 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x) // i.e. normally the translator will be 0, but OTOH the code is // smaller and should be better for the cache ;-) ;-) if (this->char_translator_ != 0) - return this->char_translator_->read_string (*this, x); + { + this->good_bit_ = this->char_translator_->read_string (*this, x); + return this->good_bit_; + } ACE_CDR::ULong len; @@ -845,7 +910,7 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x) } x = 0; - return 0; + return (this->good_bit_ = 0); } ACE_CDR::Boolean @@ -860,7 +925,7 @@ ACE_InputCDR::read_string (ACE_CString &x) } x = ""; - return 0; + return (this->good_bit_ = 0); } ACE_CDR::Boolean @@ -869,8 +934,16 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) // @@ This is a slight violation of "Optimize for the common case", // i.e. normally the translator will be 0, but OTOH the code is // smaller and should be better for the cache ;-) ;-) + if (!this->wchar_allowed_) + { + errno = EACCES; + return (this->good_bit_ = 0); + } if (this->wchar_translator_ != 0) - return this->wchar_translator_->read_wstring (*this, x); + { + this->good_bit_ = this->wchar_translator_->read_wstring (*this, x); + return this->good_bit_; + } ACE_CDR::ULong len; this->read_ulong (len); diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index e7fb9c09902..c401981ad0a 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -316,6 +316,11 @@ public: ACE_Char_Codeset_Translator *char_translator (void) const; ACE_WChar_Codeset_Translator *wchar_translator (void) const; + /// Set the codeset translators. + void char_translator (ACE_Char_Codeset_Translator *); + void wchar_translator (ACE_WChar_Codeset_Translator *); + void wchar_allowed (int ); + /** * Return alignment of the wr_ptr(), with respect to the start of * the CDR stream. This is not the same as the alignment of @@ -443,6 +448,13 @@ protected: /// If not nil, invoke for translation of character and string data. ACE_Char_Codeset_Translator *char_translator_; ACE_WChar_Codeset_Translator *wchar_translator_; + + /** + * There are some situations when it is an error to attempt wchar + * i/o of any kind. This may be when using GIOP 1.0, or no valid + * NCSW defined. + */ + int wchar_allowed_; }; // **************************************************************** @@ -801,6 +813,11 @@ public: ACE_Char_Codeset_Translator *char_translator (void) const; ACE_WChar_Codeset_Translator *wchar_translator (void) const; + /// Set the codeset translators. + void char_translator (ACE_Char_Codeset_Translator *); + void wchar_translator (ACE_WChar_Codeset_Translator *); + void wchar_allowed (int ); + /** * Returns (in ) the next position in the buffer aligned to * , it advances the Message_Block rd_ptr past the data @@ -843,6 +860,13 @@ protected: ACE_Char_Codeset_Translator *char_translator_; ACE_WChar_Codeset_Translator *wchar_translator_; + /** + * There are some situations when it is an error to attempt wchar + * i/o of any kind. This may be when using GIOP 1.0, or no valid + * NCSW defined. + */ + int wchar_allowed_; + private: ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x); ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x); @@ -892,10 +916,20 @@ private: * This class is a base class for defining codeset translation * routines to handle the character set translations required by * both CDR Input streams and CDR Output streams. + * + * Translators are reference counted. This allows for stateful as well + * as stateless translators. Stateless translators will be allocated + * once whereas CDR Streams own their own copy of a stateful translator. */ class ACE_Export ACE_Char_Codeset_Translator { public: + ACE_Char_Codeset_Translator (); + + /// Increment the reference count. + void add_ref (); + void remove_ref (); + /// Read a single character from the stream, converting from the /// stream codeset to the native codeset virtual ACE_CDR::Boolean read_char (ACE_InputCDR&, @@ -929,6 +963,8 @@ public: const ACE_CDR::Char*, ACE_CDR::ULong) = 0; + virtual ACE_CDR::ULong ncs () = 0; + virtual ACE_CDR::ULong tcs () = 0; protected: /// Children have access to low-level routines because they cannot /// use read_char or something similar (it would recurse). @@ -971,6 +1007,19 @@ protected: /// Used by derived classes to set errors in the CDR stream. void good_bit (ACE_OutputCDR& out, int bit); + + /// Obtain the CDR Stream's major & minor version values. + ACE_CDR::Octet major_version (ACE_InputCDR& input); + ACE_CDR::Octet minor_version (ACE_InputCDR& input); + ACE_CDR::Octet major_version (ACE_OutputCDR& output); + ACE_CDR::Octet minor_version (ACE_OutputCDR& output); + +protected: + virtual ~ACE_Char_Codeset_Translator () {}; + +private: + short refcount_; + }; // **************************************************************** @@ -988,6 +1037,11 @@ protected: class ACE_Export ACE_WChar_Codeset_Translator { public: + ACE_WChar_Codeset_Translator (); + + void add_ref (); + void remove_ref (); + virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&, ACE_CDR::WChar&) = 0; virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, @@ -1054,6 +1108,21 @@ protected: /// Used by derived classes to set errors in the CDR stream. void good_bit (ACE_OutputCDR& out, int bit); + + /// Obtain the CDR Stream's major & minor version values. + ACE_CDR::Octet major_version (ACE_InputCDR& input); + ACE_CDR::Octet minor_version (ACE_InputCDR& input); + ACE_CDR::Octet major_version (ACE_OutputCDR& output); + ACE_CDR::Octet minor_version (ACE_OutputCDR& output); + + virtual ACE_CDR::ULong ncs () = 0; + virtual ACE_CDR::ULong tcs () = 0; +protected: + virtual ~ACE_WChar_Codeset_Translator () {}; + +private: + short refcount_; + }; // @@ These operators should not be inlined since they force SString.h diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index 7221888408a..f1859b2d0bb 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -141,6 +141,10 @@ ACE_OutputCDR::~ACE_OutputCDR (void) this->start_.cont (0); } this->current_ = 0; + if (this->char_translator_) + this->char_translator_->remove_ref(); + if (this->wchar_translator_) + this->wchar_translator_->remove_ref(); } ACE_INLINE void @@ -518,11 +522,38 @@ ACE_OutputCDR::wchar_translator (void) const return this->wchar_translator_; } +ACE_INLINE void +ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) +{ + if (this->char_translator_) + this->char_translator_->remove_ref(); + this->char_translator_ = ctran; +} + +ACE_INLINE void +ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) +{ + if (this->wchar_translator_) + this->wchar_translator_->remove_ref(); + this->wchar_translator_ = wctran; + this->wchar_allowed_ = 1; +} + +ACE_INLINE void +ACE_OutputCDR::wchar_allowed (int allowed) +{ + this->wchar_allowed_ = allowed; +} + // **************************************************************** ACE_INLINE ACE_InputCDR::~ACE_InputCDR (void) { + if (this->char_translator_) + this->char_translator_->remove_ref(); + if (this->wchar_translator_) + this->wchar_translator_->remove_ref(); } ACE_INLINE ACE_CDR::Boolean @@ -1434,8 +1465,44 @@ ACE_InputCDR::wchar_translator (void) const return this->wchar_translator_; } + +ACE_INLINE void +ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) +{ + if (this->char_translator_) + this->char_translator_->remove_ref(); + this->char_translator_ = ctran; +} + +ACE_INLINE void +ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) +{ + if (this->wchar_translator_) + this->wchar_translator_->remove_ref(); + this->wchar_translator_ = wctran; + this->wchar_allowed_ = 1; +} + +ACE_INLINE void +ACE_InputCDR::wchar_allowed (int allowed) +{ + this->wchar_allowed_ = allowed; +} // **************************************************************** +ACE_INLINE void +ACE_Char_Codeset_Translator::add_ref() +{ + this->refcount_++; +} + +ACE_INLINE void +ACE_Char_Codeset_Translator::remove_ref() +{ + if (this->refcount_-- <= 0) + delete this; +} + ACE_INLINE ACE_CDR::Boolean ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x) @@ -1485,8 +1552,45 @@ ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, int bit) out.good_bit_ = bit; } +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input) +{ + return input.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input) +{ + return input.minor_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output) +{ + return output.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output) +{ + return output.minor_version_; +} + // **************************************************************** +ACE_INLINE void +ACE_WChar_Codeset_Translator::add_ref() +{ + this->refcount_++; +} + +ACE_INLINE void +ACE_WChar_Codeset_Translator::remove_ref() +{ + if (this->refcount_-- <= 0) + delete this; +} + ACE_INLINE ACE_CDR::Boolean ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x) @@ -1563,3 +1667,27 @@ ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, int bit) { out.good_bit_ = bit; } + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input) +{ + return input.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input) +{ + return input.minor_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output) +{ + return output.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output) +{ + return output.minor_version_; +} -- cgit v1.2.1