summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2006-08-02 22:39:43 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2006-08-02 22:39:43 +0000
commit4386824536a4e82b33397145146c6f1accef2890 (patch)
tree1dc06b04ac74d6ee68a08800b0f953b65c205382
parent90bc38ea5a216e6e7efd8c5e2f19bf533d44c48d (diff)
downloadATCD-4386824536a4e82b33397145146c6f1accef2890.tar.gz
ChangeLog tag: Wed Aug 2 21:51:51 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r--TAO/ChangeLog12
-rw-r--r--TAO/tao/Valuetype/ValueBase.cpp76
-rw-r--r--TAO/tao/Valuetype/ValueBase.h18
3 files changed, 88 insertions, 18 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 12dda2c0178..a3cfe62cc63 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,15 @@
+Wed Aug 2 21:51:51 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * tao/Valuetype/ValueBase.cpp:
+ * tao/Valuetype/ValueBase.h:
+
+ Restore the ability to properly interpret indirect repository
+ IDs for valuetypes to improve interoperability with other ORBs,
+ notably JacORB. Secondarily, I've renamed some internal
+ (private) methods to include the prefix _tao_ so as to avoid
+ potential namespace collisions with names generated by the IDL
+ compiler.
+
Wed Aug 2 21:32:27 UTC 2006 Adam Mitz <mitza@ociweb.com>
* orbsvcs/examples/ImR/Advanced/run_test.pl:
diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp
index dce7528a6f6..58e5512d413 100644
--- a/TAO/tao/Valuetype/ValueBase.cpp
+++ b/TAO/tao/Valuetype/ValueBase.cpp
@@ -144,9 +144,9 @@ CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm,
const CORBA::ValueBase *this_,
ptrdiff_t formal_type_id)
{
- if ( ! write_special_value (strm, this_))
+ if ( ! _tao_write_special_value (strm, this_))
{
- return write_value (strm, this_, formal_type_id);
+ return _tao_write_value (strm, this_, formal_type_id);
}
return true;
@@ -243,14 +243,12 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm,
}
else if (TAO_OBV_GIOP_Flags::has_single_type_info (valuetag))
{
- ACE_CString id;
- if (! strm.read_string(id))
+ if (! _tao_read_repository_id(strm, ids))
return false;
- ids.push_back (id);
}
else if (TAO_OBV_GIOP_Flags::has_list_type_info (valuetag))
{
- if (! read_repository_ids(strm, ids))
+ if (! _tao_read_repository_id_list(strm, ids))
return false;
}
else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag))
@@ -422,7 +420,7 @@ CORBA::ValueBase::_tao_validate_box_type (TAO_InputCDR &strm,
CORBA::Boolean
-CORBA::ValueBase::write_special_value(TAO_OutputCDR &strm,
+CORBA::ValueBase::_tao_write_special_value(TAO_OutputCDR &strm,
const CORBA::ValueBase *value)
{
// If the 'value' is null then write the null value to the stream.
@@ -442,11 +440,11 @@ CORBA::ValueBase::write_special_value(TAO_OutputCDR &strm,
CORBA::Boolean
-CORBA::ValueBase::write_value(TAO_OutputCDR &strm,
+CORBA::ValueBase::_tao_write_value(TAO_OutputCDR &strm,
const CORBA::ValueBase * value,
ptrdiff_t formal_type_id)
{
- if (! value->write_value_header (strm, formal_type_id))
+ if (! value->_tao_write_value_header (strm, formal_type_id))
return false;
if (! value->_tao_marshal_v (strm))
@@ -457,7 +455,7 @@ CORBA::ValueBase::write_value(TAO_OutputCDR &strm,
CORBA::Boolean
-CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm,
+CORBA::ValueBase::_tao_write_value_header(TAO_OutputCDR &strm,
ptrdiff_t formal_type_id) const
{
#if defined (TAO_HAS_OPTIMIZED_VALUETYPE_MARSHALING)
@@ -727,7 +725,8 @@ TAO_ChunkInfo::skip_chunks (TAO_InputCDR &strm)
}
CORBA::Boolean
-CORBA::ValueBase::read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids)
+CORBA::ValueBase::_tao_read_repository_id_list (ACE_InputCDR& strm,
+ Repository_Id_List& ids)
{
CORBA::Long num_ids;
if (!strm.read_long(num_ids))
@@ -743,12 +742,63 @@ CORBA::ValueBase::read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& id
//@@TODO: map repository id for indirection
for (CORBA::Long i = 0; i < num_ids; i ++)
{
+ if (!_tao_read_repository_id (strm,ids))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_read_repository_id (ACE_InputCDR& strm,
+ Repository_Id_List& ids)
+{
ACE_CString id;
- if (! strm.read_string(id))
+ CORBA::ULong length = 0;
+
+ CORBA::Long offset = 0;
+ size_t buffer_size = strm.length();
+
+ if (!strm.read_ulong (length))
+ {
return false;
- ids.push_back (id);
}
+
+ // 'length' may not be the repo id length - it could be the
+ // FFFFFFF indirection marker instead. If it is an indirection marker, we
+ // get the offset following the indirection marker, otherwise we can follow
+ // the same logic using the offset to simply rewind to the start of length
+ // and re-read the length as part of the string
+ if (TAO_OBV_GIOP_Flags::is_indirection_tag (length))
+ {
+ // Read the negative byte offset
+ if (!strm.read_long (offset) || offset >= 0)
+ {
+ return false;
+ }
+ buffer_size = -(offset) + sizeof (CORBA::Long);
+ }
+
+ // Cribbed from tc_demarshal_indirection in Typecode_CDR_Extraction.cpp
+ TAO_InputCDR indir_stream (strm.rd_ptr () + offset - sizeof (CORBA::Long),
+ buffer_size,
+ strm.byte_order ());
+
+ if (!indir_stream.good_bit ())
+ {
+ return false;
}
+ indir_stream.read_string(id);
+
+ // Since the ID is always read from the indirection cdr we have to skip
+ // the main CDR forward if we were in fact reading from the current
+ // location and not rewinding back some offset.
+
+ if (offset == 0)
+ strm.skip_bytes (length);
+
+ ids.push_back (id);
return true;
}
diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h
index 6918787b738..50229951b3c 100644
--- a/TAO/tao/Valuetype/ValueBase.h
+++ b/TAO/tao/Valuetype/ValueBase.h
@@ -226,19 +226,27 @@ namespace CORBA
private:
/// Write some special values such as null value or indirection value.
- static CORBA::Boolean write_special_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value);
+ static CORBA::Boolean _tao_write_special_value(TAO_OutputCDR &strm,
+ const CORBA::ValueBase * value);
/// Write whole value.
- static CORBA::Boolean write_value(TAO_OutputCDR &strm,
+ static CORBA::Boolean _tao_write_value(TAO_OutputCDR &strm,
const CORBA::ValueBase * value,
ptrdiff_t formal_type_id);
/// Write the header of the value which includes the valuetag, number of
/// repository ids and list of repository ids.
- CORBA::Boolean write_value_header(TAO_OutputCDR &strm,
+ CORBA::Boolean _tao_write_value_header(TAO_OutputCDR &strm,
ptrdiff_t formal_type_id) const;
- /// Read the repository ids from the CDR input stream.
- static CORBA::Boolean read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids);
+ /// Read a single repository id from the CDR input stream,
+ /// accounting for indirection.
+ static CORBA::Boolean _tao_read_repository_id (ACE_InputCDR& strm,
+ Repository_Id_List& ids);
+
+ /// Read a list of repository ids from the CDR input stream,
+ /// accounting for indirection
+ static CORBA::Boolean _tao_read_repository_id_list (ACE_InputCDR& strm,
+ Repository_Id_List& ids);
private:
ValueBase & operator= (const ValueBase &);