diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-03 21:33:32 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-03 21:33:32 +0000 |
commit | 3b696ea69c2144a92c19302aeb0271f8c4d01b13 (patch) | |
tree | f975d3c82bea196cd68f5176376529328ac32381 /TAO/tao/CDR.cpp | |
parent | 0fedf994ff9f38d370d75188315df15ec8c10cc6 (diff) | |
download | ATCD-3b696ea69c2144a92c19302aeb0271f8c4d01b13.tar.gz |
ChangeLogTag:Fri Apr 3 08:59:16 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/CDR.cpp')
-rw-r--r-- | TAO/tao/CDR.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index 1fdf3c8e4a5..7b05033d492 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -304,11 +304,24 @@ TAO_OutputCDR::write_array (const void* x, CORBA_Boolean TAO_OutputCDR::write_string (const CORBA::Char *x) { - CORBA::ULong len = ACE_OS::strlen (x) + 1; - - if (this->write_ulong (len)) + if (x != 0) + { + CORBA::ULong len = ACE_OS::strlen (x) + 1; + if (this->write_ulong (len)) + { + return this->write_char_array (x, len); + } + } + else { - return this->write_char_array (x, len); + // Be nice to programmers: treat nulls as empty strings not + // errors. (OMG-IDL supports languages that don't use the C/C++ + // notion of null v. empty strings; nulls aren't part of the OMG-IDL + // string model.) + if (this->write_ulong (1)) + { + return this->write_char (0); + } } return CORBA::B_FALSE; } @@ -316,10 +329,20 @@ TAO_OutputCDR::write_string (const CORBA::Char *x) CORBA_Boolean TAO_OutputCDR::write_wstring (const CORBA::WChar *x) { - CORBA::ULong len = ACE_OS::wslen (x) + 1; - if (this->write_ulong (len)) + if (x != 0) { - return this->write_wchar_array (x, len); + CORBA::ULong len = ACE_OS::wslen (x) + 1; + if (this->write_ulong (len)) + { + return this->write_wchar_array (x, len); + } + } + else + { + if (this->write_ulong (1)) + { + return this->write_wchar (0); + } } return CORBA::B_FALSE; } @@ -388,7 +411,8 @@ TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs, && newpos <= this->start_->end () && newpos + size <= this->start_->end ()) { - this->start_->rd_ptr (newpos); + // Notice that ACE_Message_Block::duplicate may leave the + // wr_ptr() with a higher value that what we actually want. this->start_->wr_ptr (newpos + size); CORBA::Octet byte_order; |