summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McQueen <simon.mcqueen@gmail.com>2005-06-17 09:03:52 +0000
committerSimon McQueen <simon.mcqueen@gmail.com>2005-06-17 09:03:52 +0000
commit57de34ead26a1c4f094eadd2ab2191141d82d3ea (patch)
treefcc3e2534d6e5ebd78f88dc6534411e52c2a265c
parent86b92620ea1d440ee2f3ea6a9c18c50de183f310 (diff)
downloadATCD-57de34ead26a1c4f094eadd2ab2191141d82d3ea.tar.gz
ChangeLogTag: Fri Jun 17 09:56:44 2005 Simon McQueen <sm@prismtech.com>
-rw-r--r--TAO/ChangeLog8
-rw-r--r--TAO/tao/Valuetype/ValueBase.cpp76
2 files changed, 71 insertions, 13 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index e8ae98e0bbf..a414036764d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,11 @@
+Fri Jun 17 09:56:44 2005 Simon McQueen <sm@prismtech.com>
+
+ * tao/Valuetype/ValueBase.cpp:
+
+ Add support for stream encoded repository ID indirection as per
+ "15.3.4.3 Scope of the Indirections" in 02-06-33.
+ This fixes bug #2156.
+
Fri Jun 17 08:55:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/ORBInitializer_Registry.cpp:
diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp
index 74e361b1277..54f28548d30 100644
--- a/TAO/tao/Valuetype/ValueBase.cpp
+++ b/TAO/tao/Valuetype/ValueBase.cpp
@@ -274,22 +274,72 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm,
}
if (TAO_OBV_GIOP_Flags::has_no_type_info (value_tag))
- {
- factory = orb_core->orb ()->lookup_value_factory (repo_id);
- }
+ {
+ factory = orb_core->orb ()->lookup_value_factory (repo_id);
+ }
else
- {
- CORBA::String_var repo_id_stream;
+ {
+ CORBA::String_var repo_id_stream;
- // It would be more efficient not to copy the string %!)
- if (!strm.read_string (repo_id_stream.inout ()))
- {
- return false;
- }
+ CORBA::ULong length;
- factory =
- orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
- }
+ if (!strm.read_ulong (length))
+ {
+ return 0;
+ }
+
+ // 'length' may not be the repo id length - it could be the
+ // FFFFFFF indirection marker instead
+ if (TAO_OBV_GIOP_Flags::is_indirection_tag (length))
+ {
+ CORBA::Long offset;
+
+ // Read the negative byte offset
+ if (!strm.read_long (offset) || offset >= 0)
+ {
+ return 0;
+ }
+
+ // Cribbed from tc_demarshal_indirection in Typecode_CDR_Extraction.cpp
+ TAO_InputCDR indir_stream (strm.rd_ptr () + offset - sizeof (CORBA::Long),
+ (-offset) + sizeof (CORBA::Long),
+ strm.byte_order ());
+
+ if (!indir_stream.good_bit ())
+ {
+ return 0;
+ }
+
+ indir_stream.read_string(repo_id_stream.inout ());
+ }
+ else
+ {
+ if (length > 0 && length <= strm.length ())
+ {
+ ACE_NEW_RETURN (repo_id_stream.inout (),
+ ACE_CDR::Char[length],
+ 0);
+ if (!strm.read_char_array (repo_id_stream.inout (), length))
+ {
+ return 0;
+ }
+ }
+ else if (length == 0)
+ {
+ ACE_NEW_RETURN (repo_id_stream.inout (),
+ ACE_CDR::Char[1],
+ 0);
+ ACE_OS::strcpy (const_cast <char *&> (repo_id_stream.inout ()), "");
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ factory =
+ orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
+ }
if (factory == 0) // %! except.!
{