diff options
Diffstat (limited to 'TAO/tao/encode.cpp')
-rw-r--r-- | TAO/tao/encode.cpp | 70 |
1 files changed, 21 insertions, 49 deletions
diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp index ac3a0892cd3..86471b76112 100644 --- a/TAO/tao/encode.cpp +++ b/TAO/tao/encode.cpp @@ -99,7 +99,7 @@ TAO_Marshal_Primitive::encode (CORBA::TypeCode_ptr tc, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Primitive::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } @@ -149,7 +149,7 @@ TAO_Marshal_Any::encode (CORBA::TypeCode_ptr, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Any::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } @@ -219,7 +219,7 @@ TAO_Marshal_TypeCode::encode (CORBA::TypeCode_ptr, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_TypeCode::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } @@ -238,7 +238,7 @@ TAO_Marshal_Principal::encode (CORBA::TypeCode_ptr, if ((*stream << p) == 0) { - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } return CORBA::TypeCode::TRAVERSE_CONTINUE; @@ -265,7 +265,7 @@ TAO_Marshal_ObjRef::encode (CORBA::TypeCode_ptr, if ((*stream << obj) == 0) { - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } return CORBA::TypeCode::TRAVERSE_CONTINUE; @@ -400,7 +400,7 @@ TAO_Marshal_Struct::encode (CORBA::TypeCode_ptr tc, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Struct::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } @@ -506,12 +506,12 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc, case CORBA::tk_enum: { - CORBA::ULong ul; + CORBA::Long l; TAO_InputCDR stream ((ACE_Message_Block *) member_label->_tao_get_cdr ()); - (void)stream.decode (discrim_tc, &ul, 0, ACE_TRY_ENV); + (void)stream.decode (discrim_tc, &l, 0, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); - if (ul == *(CORBA::ULong *) discrim_val) + if (l == *(CORBA::Long *) discrim_val) discrim_matched = 1; } break; @@ -526,9 +526,8 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc, break; case CORBA::tk_wchar: - CORBA::WChar wc; - *member_label >>= CORBA::Any::to_wchar (wc); - if (wc == *(CORBA::WChar *) discrim_val) + // @@ ASG TO-DO + if (*(CORBA::WChar *) member_label->value () == *(CORBA::WChar *) discrim_val) discrim_matched = 1; break; @@ -546,7 +545,7 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc, ACE_DEBUG ((LM_DEBUG, "Union::encode - " "Bad discriminant type\n")); - ACE_THROW_RETURN (CORBA::BAD_TYPECODE (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE), + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::COMPLETED_MAYBE), CORBA::TypeCode::TRAVERSE_STOP); }// end of switch @@ -565,50 +564,23 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc, { member_val = base_union->_access (0); // marshal according to the matched typecode - - if (member_tc->kind () == CORBA::tk_objref) - { - // we know that the object pointer is stored in a - // TAO_Object_Field_T parametrized type - TAO_Object_Field_T<CORBA_Object>* field = - ACE_reinterpret_cast (TAO_Object_Field_T<CORBA_Object> *, - member_val); - CORBA::Object_ptr ptr = field->_upcast (); - return stream->encode (member_tc, &ptr, data2, ACE_TRY_ENV); - } - else - { - return stream->encode (member_tc, member_val, - data2, ACE_TRY_ENV); - } + return stream->encode (member_tc, member_val, + data2, ACE_TRY_ENV); } } // we are here only if there was no match if (default_tc) { member_val = base_union->_access (0); - if (default_tc->kind () == CORBA::tk_objref) - { - // we know that the object pointer is stored in a - // TAO_Object_Field_T parametrized type - TAO_Object_Field_T<CORBA_Object>* field = - ACE_reinterpret_cast (TAO_Object_Field_T<CORBA_Object> *, - member_val); - CORBA::Object_ptr ptr = field->_upcast (); - return stream->encode (default_tc, &ptr, data2, ACE_TRY_ENV); - } - else - { - return stream->encode (default_tc, member_val, - data2, ACE_TRY_ENV); - } + return stream->encode (default_tc, member_val, data2, + ACE_TRY_ENV); } if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Union::encode - failed. " "No match and no default case\n")); - ACE_THROW_RETURN (CORBA::MARSHAL (), + ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO), CORBA::TypeCode::TRAVERSE_STOP); } @@ -849,7 +821,7 @@ TAO_Marshal_Sequence::encode (CORBA::TypeCode_ptr tc, // If an error was detected but no exception was raised then raise a // marshal exception. if (env.exception () == 0) - env.exception (new CORBA::MARSHAL ()); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_NO)); return CORBA::TypeCode::TRAVERSE_STOP; } @@ -999,7 +971,7 @@ TAO_Marshal_Array::encode (CORBA::TypeCode_ptr tc, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Sequence::encode detected error\n")); - env.exception (new CORBA::MARSHAL ()); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_NO)); return CORBA::TypeCode::TRAVERSE_STOP; } @@ -1083,7 +1055,7 @@ TAO_Marshal_Alias::encode (CORBA::TypeCode_ptr tc, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Alias::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } @@ -1205,7 +1177,7 @@ TAO_Marshal_Except::encode (CORBA::TypeCode_ptr tc, if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Marshal_Except::encode detected error\n")); - env.exception (new CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE)); + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } } |