diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-26 21:59:17 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-26 21:59:17 +0000 |
commit | ab0d45a00f153a07fd39e59876230c7c79b0a847 (patch) | |
tree | 9597366ae9ce27c5aa644d517c00a43c0c24c342 | |
parent | d25802d7266e38a051db5eec9add77bf06d29111 (diff) | |
download | ATCD-ab0d45a00f153a07fd39e59876230c7c79b0a847.tar.gz |
ChangeLogTag:Fri Jun 26 16:57:54 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-98c | 29 | ||||
-rw-r--r-- | TAO/tao/CDR.cpp | 18 | ||||
-rw-r--r-- | TAO/tao/CDR.h | 4 | ||||
-rw-r--r-- | TAO/tao/CDR.i | 16 | ||||
-rw-r--r-- | TAO/tao/encode.cpp | 36 | ||||
-rw-r--r-- | TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp | 6 | ||||
-rw-r--r-- | TAO/tests/Param_Test/Makefile | 256 | ||||
-rw-r--r-- | TAO/tests/Param_Test/README | 1 | ||||
-rw-r--r-- | TAO/tests/Param_Test/bd_string.cpp | 167 | ||||
-rw-r--r-- | TAO/tests/Param_Test/bd_string.h | 81 | ||||
-rw-r--r-- | TAO/tests/Param_Test/driver.cpp | 15 | ||||
-rw-r--r-- | TAO/tests/Param_Test/helper.cpp | 8 | ||||
-rw-r--r-- | TAO/tests/Param_Test/helper.h | 3 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.cpp | 2 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.h | 1 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test.idl | 5 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.cpp | 18 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.h | 6 | ||||
-rw-r--r-- | TAO/tests/Param_Test/tests.h | 1 |
19 files changed, 639 insertions, 34 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 6ae8faff9e0..eafffcbc982 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,32 @@ +Fri Jun 26 16:57:54 1998 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/encode.cpp: + Check the length of a string before encoding. + + * tao/CDR.h: + * tao/CDR.i: + * tao/CDR.cpp: + Added operations to write strings with known lengths + + * tests/Param_Test/Makefile: + * tests/Param_Test/README: + * tests/Param_Test/tests.h: + * tests/Param_Test/bd_string.h: + * tests/Param_Test/bd_string.cpp: + * tests/Param_Test/driver.cpp: + * tests/Param_Test/helper.h: + * tests/Param_Test/helper.cpp: + * tests/Param_Test/options.h: + * tests/Param_Test/options.cpp: + * tests/Param_Test/param_test.idl: + * tests/Param_Test/param_test_i.h: + * tests/Param_Test/param_test_i.cpp: + Added a test for bounded strings. + + * tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp: + Use the TAO extensions to create an octet sequence using a + message block. + Fri Jun 26 16:45:00 1998 Michael Kircher <mk1@cs.wustl.edu> * orbsvcs/tests/Simulator/README: Added information about the diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index 6131d71076b..e65e7e7ebcf 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -438,14 +438,14 @@ TAO_OutputCDR::write_array (const void* x, } CORBA_Boolean -TAO_OutputCDR::write_string (const CORBA::Char *x) +TAO_OutputCDR::write_string (CORBA::ULong len, + const CORBA::Char *x) { - if (x != 0) + if (len != 0) { - CORBA::ULong len = ACE_OS::strlen (x) + 1; - if (this->write_ulong (len)) + if (this->write_ulong (len + 1)) { - return this->write_char_array (x, len); + return this->write_char_array (x, len + 1); } } else @@ -463,14 +463,14 @@ TAO_OutputCDR::write_string (const CORBA::Char *x) } CORBA_Boolean -TAO_OutputCDR::write_wstring (const CORBA::WChar *x) +TAO_OutputCDR::write_wstring (CORBA::ULong len, + const CORBA::WChar *x) { if (x != 0) { - CORBA::ULong len = ACE_OS::wslen (x) + 1; - if (this->write_ulong (len)) + if (this->write_ulong (len + 1)) { - return this->write_wchar_array (x, len); + return this->write_wchar_array (x, len + 1); } } else diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h index b150cb7a9f9..aeacf71dee7 100644 --- a/TAO/tao/CDR.h +++ b/TAO/tao/CDR.h @@ -177,8 +177,12 @@ public: CORBA_Boolean write_float (CORBA::Float x); CORBA_Boolean write_double (const CORBA::Double &x); CORBA_Boolean write_longdouble (const CORBA::LongDouble &x); + CORBA_Boolean write_string (const CORBA::Char *x); + CORBA_Boolean write_string (CORBA::ULong length, const CORBA::Char *x); CORBA_Boolean write_wstring (const CORBA::WChar *x); + CORBA_Boolean write_wstring (CORBA::ULong length, const CORBA::WChar *x); + // For string we offer methods that accept a precomputed length. // = We add one method to write arrays of basic IDL types. // Note: the portion written starts at <x> and ends at <x + length>. diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i index f01c4c92c3c..32b0d7041f1 100644 --- a/TAO/tao/CDR.i +++ b/TAO/tao/CDR.i @@ -103,6 +103,22 @@ TAO_OutputCDR::write_longdouble (const CORBA::LongDouble &x) } ACE_INLINE CORBA_Boolean +TAO_OutputCDR::write_string (const CORBA::Char *x) +{ + if (x != 0) + return this->write_string (ACE_OS::strlen (x), x); + return this->write_string (0, 0); +} + +ACE_INLINE CORBA_Boolean +TAO_OutputCDR::write_wstring (const CORBA::WChar *x) +{ + if (x != 0) + return this->write_wstring (ACE_OS::wslen (x), x); + return this->write_wstring (0, 0); +} + +ACE_INLINE CORBA_Boolean TAO_OutputCDR::write_char_array (const CORBA::Char* x, CORBA::ULong length) { diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp index 012723d1a69..c0d4e48f1e7 100644 --- a/TAO/tao/encode.cpp +++ b/TAO/tao/encode.cpp @@ -707,11 +707,17 @@ TAO_Marshal_String::encode (CORBA::TypeCode_ptr tc, // permissive as to send messages violating the interface spec // by having excessively long strings! CORBA::ULong bounds = tc->length (env); - - if (env.exception () == 0) + if (str != 0) { - if (stream->write_string (str)) - return CORBA::TypeCode::TRAVERSE_CONTINUE; + CORBA::ULong length = ACE_OS::strlen (str); + if (bounds == 0 || bounds >= length) + if (stream->write_string (length, str)) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + } + else + { + if (stream->write_string (0, 0)) + return CORBA::TypeCode::TRAVERSE_CONTINUE; } return CORBA::TypeCode::TRAVERSE_STOP; } @@ -1277,25 +1283,21 @@ TAO_Marshal_WString::encode (CORBA::TypeCode_ptr tc, // by having excessively long strings! CORBA::ULong bounds = tc->length (env); - if (env.exception () == 0) + if (str != 0) { // get the actual length of the string CORBA::ULong len = ACE_OS::wslen ((CORBA::WChar *) str); // if it is an unbounded string or if the length is less than the // bounds for an unbounded string - if ((bounds == 0) || (len <= bounds)) - { - // Encode the string, followed by a NUL character. - - for (continue_encoding = stream->write_ulong (len + 1); - continue_encoding != CORBA::B_FALSE && *str; - continue_encoding = stream->write_wchar (*str++)) - continue; - - stream->write_wchar (0); - return CORBA::TypeCode::TRAVERSE_CONTINUE; - } + if (bounds == 0 || len <= bounds) + if (stream->write_wstring (len, str)) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + } + else + { + if (stream->write_wstring (0, 0)) + return CORBA::TypeCode::TRAVERSE_CONTINUE; } return CORBA::TypeCode::TRAVERSE_STOP; } diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp index d8d0447942c..eaf342afee9 100644 --- a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp +++ b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp @@ -233,11 +233,7 @@ Cubit_i::cube_octet_sequence (const Cubit::octet_seq &input, #if defined (TAO_NO_COPY_OCTET_SEQUENCES) ACE_Message_Block mb (input.length ()); mb.wr_ptr (input.length ()); - TAO_Unbounded_Sequence<CORBA::Octet>* tmp = - new TAO_Unbounded_Sequence<CORBA::Octet> (&mb); - // @@ TODO this is a temporary hack until the IDL compiler - // generates the constructor taking a Message_Block. - output = (Cubit::octet_seq*)tmp; + output = new Cubit::octet_seq (input.length (), &mb); #else output = new Cubit::octet_seq (input.length ()); #endif /* TAO_NO_COPY_OCTET_SEQUENCES */ diff --git a/TAO/tests/Param_Test/Makefile b/TAO/tests/Param_Test/Makefile index 0e9e7a5965a..0c12f823536 100644 --- a/TAO/tests/Param_Test/Makefile +++ b/TAO/tests/Param_Test/Makefile @@ -36,6 +36,7 @@ CLI_FILES = param_testC \ bd_long_seq \ bd_short_seq \ bd_str_seq \ + bd_string \ bd_struct_seq \ fixed_array \ fixed_struct \ @@ -103,6 +104,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -323,6 +325,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -543,6 +546,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -764,6 +768,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -984,6 +989,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -1203,6 +1209,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -1423,6 +1430,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -1644,6 +1652,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -1861,7 +1870,7 @@ realclean: clean $(ACE_ROOT)/ace/High_Res_Timer.i \ $(ACE_ROOT)/ace/Profile_Timer.i \ client.h param_testC.h param_testC.i client.cpp tests.h any.h \ - bd_long_seq.h bd_short_seq.h bd_str_seq.h bd_struct_seq.h \ + bd_long_seq.h bd_short_seq.h bd_str_seq.h bd_string.h bd_struct_seq.h \ fixed_array.h fixed_struct.h nested_struct.h objref.h short.h \ typecode.h ub_any_seq.h ub_long_seq.h ub_objref_seq.h ub_short_seq.h \ ub_str_seq.h ub_string.h ub_struct_seq.h var_array.h var_struct.h \ @@ -1873,6 +1882,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -2097,6 +2107,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -2314,6 +2325,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -2536,6 +2548,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -2755,6 +2768,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -2974,6 +2988,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -3193,6 +3208,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -3412,6 +3428,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -3631,6 +3648,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -3844,12 +3862,233 @@ realclean: clean $(TAO_ROOT)/tao/Server_Request.i \ $(TAO_ROOT)/tao/singletons.h \ param_testC.i bd_str_seq.h +.obj/bd_string.o .obj/bd_string.so .shobj/bd_string.o .shobj/bd_string.so: bd_string.cpp helper.h param_testC.h \ + $(TAO_ROOT)/tao/corba.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i \ + $(ACE_ROOT)/ace/SOCK_Stream.h \ + $(ACE_ROOT)/ace/SOCK_IO.h \ + $(ACE_ROOT)/ace/SOCK.h \ + $(ACE_ROOT)/ace/Addr.h \ + $(ACE_ROOT)/ace/Addr.i \ + $(ACE_ROOT)/ace/IPC_SAP.h \ + $(ACE_ROOT)/ace/IPC_SAP.i \ + $(ACE_ROOT)/ace/SOCK.i \ + $(ACE_ROOT)/ace/SOCK_IO.i \ + $(ACE_ROOT)/ace/INET_Addr.h \ + $(ACE_ROOT)/ace/INET_Addr.i \ + $(ACE_ROOT)/ace/SOCK_Stream.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(ACE_ROOT)/ace/SOCK_Acceptor.h \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/SOCK_Acceptor.i \ + $(ACE_ROOT)/ace/SOCK_Connector.h \ + $(ACE_ROOT)/ace/SOCK_Connector.i \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Synch_Options.i \ + $(ACE_ROOT)/ace/Strategies_T.i \ + $(ACE_ROOT)/ace/Strategies_T.cpp \ + $(ACE_ROOT)/ace/Service_Repository.h \ + $(ACE_ROOT)/ace/Service_Types.h \ + $(ACE_ROOT)/ace/Service_Types.i \ + $(ACE_ROOT)/ace/Service_Repository.i \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/WFMO_Reactor.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(ACE_ROOT)/ace/Message_Queue.cpp \ + $(ACE_ROOT)/ace/WFMO_Reactor.i \ + $(ACE_ROOT)/ace/Strategies.i \ + $(ACE_ROOT)/ace/Connector.h \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(ACE_ROOT)/ace/Svc_Handler.h \ + $(ACE_ROOT)/ace/Task.h \ + $(ACE_ROOT)/ace/Task.i \ + $(ACE_ROOT)/ace/Task_T.h \ + $(ACE_ROOT)/ace/Task_T.i \ + $(ACE_ROOT)/ace/Task_T.cpp \ + $(ACE_ROOT)/ace/Module.h \ + $(ACE_ROOT)/ace/Module.i \ + $(ACE_ROOT)/ace/Module.cpp \ + $(ACE_ROOT)/ace/Stream_Modules.h \ + $(ACE_ROOT)/ace/Stream_Modules.i \ + $(ACE_ROOT)/ace/Stream_Modules.cpp \ + $(ACE_ROOT)/ace/Dynamic.h \ + $(ACE_ROOT)/ace/Dynamic.i \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Svc_Handler.i \ + $(ACE_ROOT)/ace/Svc_Handler.cpp \ + $(ACE_ROOT)/ace/Connector.i \ + $(ACE_ROOT)/ace/Connector.cpp \ + $(ACE_ROOT)/ace/Acceptor.h \ + $(ACE_ROOT)/ace/Acceptor.i \ + $(ACE_ROOT)/ace/Acceptor.cpp \ + $(TAO_ROOT)/tao/compat/objbase.h \ + $(TAO_ROOT)/tao/compat/initguid.h \ + $(TAO_ROOT)/tao/Align.h \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/Union.h \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/default_client.h \ + $(TAO_ROOT)/tao/default_client.i \ + $(TAO_ROOT)/tao/default_server.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.i \ + $(TAO_ROOT)/tao/ORB_Strategies_T.cpp \ + $(TAO_ROOT)/tao/default_server.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Marshal.h \ + $(TAO_ROOT)/tao/Marshal.i \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/POAC.h \ + $(TAO_ROOT)/tao/POAC.i \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/POAS.h \ + $(TAO_ROOT)/tao/POA_CORBA.h \ + $(TAO_ROOT)/tao/POAS.i \ + $(TAO_ROOT)/tao/Object_Table.h \ + $(TAO_ROOT)/tao/POA.i \ + $(TAO_ROOT)/tao/poa_macros.h \ + $(TAO_ROOT)/tao/Connect.h \ + $(TAO_ROOT)/tao/Connect.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(ACE_ROOT)/ace/Dynamic_Service.cpp \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/IIOP_Object.h \ + $(TAO_ROOT)/tao/IIOP_Object.i \ + $(TAO_ROOT)/tao/IIOP_ORB.h \ + $(TAO_ROOT)/tao/IIOP_ORB.i \ + $(TAO_ROOT)/tao/IIOP_Interpreter.h \ + $(TAO_ROOT)/tao/GIOP.h \ + $(TAO_ROOT)/tao/GIOP.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/singletons.h \ + param_testC.i bd_string.h .obj/bd_struct_seq.o .obj/bd_struct_seq.so .shobj/bd_struct_seq.o .shobj/bd_struct_seq.so: bd_struct_seq.cpp helper.h param_testC.h \ $(TAO_ROOT)/tao/corba.h \ $(TAO_ROOT)/tao/orbconf.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -4069,6 +4308,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -4288,6 +4528,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -4507,6 +4748,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -4726,6 +4968,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -4945,6 +5188,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -5164,6 +5408,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -5383,6 +5628,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -5602,6 +5848,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -5821,6 +6068,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -6040,6 +6288,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -6259,6 +6508,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -6478,6 +6728,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -6697,6 +6948,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -6916,6 +7168,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ @@ -7135,6 +7388,7 @@ realclean: clean $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ diff --git a/TAO/tests/Param_Test/README b/TAO/tests/Param_Test/README index 8ceaa11b0cf..7a7de12c293 100644 --- a/TAO/tests/Param_Test/README +++ b/TAO/tests/Param_Test/README @@ -52,6 +52,7 @@ To run the client, type short for shorts ubstring for unbounded string + bdstring for bounded string fixed_struct for fixed sized structs strseq for sequences of strings bounded_strseq for bounded sequences of strings diff --git a/TAO/tests/Param_Test/bd_string.cpp b/TAO/tests/Param_Test/bd_string.cpp new file mode 100644 index 00000000000..3fc6acff167 --- /dev/null +++ b/TAO/tests/Param_Test/bd_string.cpp @@ -0,0 +1,167 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// bd_string.cpp +// +// = DESCRIPTION +// tests bounded strings +// +// = AUTHORS +// Carlos O'Ryan +// +// ============================================================================ + +#include "helper.h" + +#include "bd_string.h" + +// ************************************************************************ +// Test_Bounded_String +// ************************************************************************ + +Test_Bounded_String::Test_Bounded_String (void) + : opname_ (CORBA::string_dup ("test_unbounded_string")), + in_ (0), + inout_ (0), + out_ (0), + ret_ (0) +{ +} + +Test_Bounded_String::~Test_Bounded_String (void) +{ + CORBA::string_free (this->opname_); + CORBA::string_free (this->in_); + CORBA::string_free (this->inout_); + CORBA::string_free (this->out_); + CORBA::string_free (this->ret_); + this->opname_ = 0; + this->in_ = 0; + this->inout_ = 0; + this->out_ = 0; + this->ret_ = 0; +} + +const char * +Test_Bounded_String::opname (void) const +{ + return this->opname_; +} + +int +Test_Bounded_String::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // release any previously occupied values + CORBA::string_free (this->in_); + CORBA::string_free (this->inout_); + CORBA::string_free (this->out_); + CORBA::string_free (this->ret_); + this->in_ = 0; + this->inout_ = 0; + this->out_ = 0; + this->ret_ = 0; + + this->in_ = gen->gen_string (32); + this->inout_ = CORBA::string_dup (this->in_); + return 0; +} + +int +Test_Bounded_String::reset_parameters (void) +{ + // release any previously occupied values + this->inout_ = 0; + this->out_ = 0; + this->ret_ = 0; + + this->inout_ = CORBA::string_dup (this->in_); + return 0; +} + +int +Test_Bounded_String::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + CORBA::String_out str_out (this->out_); + this->ret_ = objref->test_unbounded_string (this->in_, this->inout_, str_out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Bounded_String::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (CORBA::_tc_string, &this->in_, 0); + CORBA::Any inout_arg (CORBA::_tc_string, &this->inout_, 0); + CORBA::Any out_arg (CORBA::_tc_string, &this->out_, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value + (void)retval->item (0, env)->value ()->replace (CORBA::_tc_string, + 0, // ORB will allocate + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Bounded_String::check_validity (void) +{ + CORBA::ULong len = ACE_OS::strlen (this->in_); + + if (!ACE_OS::strcmp (this->in_, this->out_) && + !ACE_OS::strcmp (this->in_, this->ret_) && + ACE_OS::strlen (this->inout_) == 2*len && + !ACE_OS::strncmp (this->in_, this->inout_, len) && + !ACE_OS::strncmp (this->in_, &this->inout_[len], len)) + return 1; + + return 0; // otherwise +} + +CORBA::Boolean +Test_Bounded_String::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + // only retrieve the return value. No need to retrieve the out and inout + // because we had provided the memory and we own it. + *req->result ()->value () >>= this->ret_; + return this->check_validity (); +} + +void +Test_Bounded_String::print_values (void) +{ + ACE_DEBUG ((LM_DEBUG, + "\n=*=*=*=*=*=*\n" + "in with len (%d) = %s\n" + "inout with len (%d) = %s\n" + "out with len (%d) = %s\n" + "ret with len (%d) = %s\n" + "\n=*=*=*=*=*=*\n", + (this->in_ ? ACE_OS::strlen (this->in_):0), + (this->in_ ? this->in_:"<nul string>"), + (this->inout_ ? ACE_OS::strlen (this->inout_):0), + (this->inout_ ? this->inout_:"<nul string>"), + (this->out_ ? ACE_OS::strlen (this->out_):0), + (this->out_ ? this->out_:"<nul string>"), + (this->ret_ ? ACE_OS::strlen (this->ret_):0), + (this->ret_ ? this->ret_:"<nul string>"))); +} + diff --git a/TAO/tests/Param_Test/bd_string.h b/TAO/tests/Param_Test/bd_string.h new file mode 100644 index 00000000000..3490d9ab138 --- /dev/null +++ b/TAO/tests/Param_Test/bd_string.h @@ -0,0 +1,81 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// bd_string.h +// +// = DESCRIPTION +// Tests bounded string +// +// = AUTHORS +// Carlos O'Ryan +// +// ============================================================================ + +#if !defined (PARAM_TEST_BOUNDED_STRING_H) +#define PARAM_TEST_BOUNDED_STRING_H + +#include "param_testC.h" + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test unbounded strings +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +class Test_Bounded_String +{ +public: + Test_Bounded_String (void); + // ctor + + ~Test_Bounded_String (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + char *in_; + // in parameter + + char *inout_; + // inout parameter + + char *out_; + // out parameter + + char *ret_; + // return value +}; + +#endif /* PARAM_TEST_BOUNDED_STRING_H */ diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp index ea3b93fd025..810496a33af 100644 --- a/TAO/tests/Param_Test/driver.cpp +++ b/TAO/tests/Param_Test/driver.cpp @@ -145,6 +145,19 @@ Driver::run (void) delete client; } break; + case Options::TEST_BOUNDED_STRING: + { + Param_Test_Client<Test_Bounded_String> *client = new + Param_Test_Client<Test_Bounded_String> (this->orb_.in (), + this->objref_.in(), + new Test_Bounded_String); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; case Options::TEST_FIXED_STRUCT: { Param_Test_Client<Test_Fixed_Struct> *client = new @@ -404,6 +417,7 @@ Driver::run (void) template class ACE_Singleton<Driver, ACE_SYNCH_RECURSIVE_MUTEX>; template class Param_Test_Client<Test_Short>; template class Param_Test_Client<Test_Unbounded_String>; +template class Param_Test_Client<Test_Bounded_String>; template class Param_Test_Client<Test_Fixed_Struct>; template class Param_Test_Client<Test_String_Sequence>; template class Param_Test_Client<Test_Bounded_String_Sequence>; @@ -426,6 +440,7 @@ template class Param_Test_Client<Test_Var_Array>; #pragma instantiate ACE_Singleton<Driver, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate Param_Test_Client<Test_Short> #pragma instantiate Param_Test_Client<Test_Unbounded_String> +#pragma instantiate Param_Test_Client<Test_Bounded_String> #pragma instantiate Param_Test_Client<Test_Fixed_Struct> #pragma instantiate Param_Test_Client<Test_String_Sequence> #pragma instantiate Param_Test_Client<Test_Bounded_String_Sequence> diff --git a/TAO/tests/Param_Test/helper.cpp b/TAO/tests/Param_Test/helper.cpp index 5e22ba3a49f..d25c2d15026 100644 --- a/TAO/tests/Param_Test/helper.cpp +++ b/TAO/tests/Param_Test/helper.cpp @@ -42,7 +42,13 @@ Generator::gen_long (void) char * Generator::gen_string (void) { - CORBA::ULong len = (CORBA::ULong) (::ACE_OS::rand () % TEST_BUFSIZE); + return gen_string (TEST_BUFSIZE); +} + +char * +Generator::gen_string (int max_length) +{ + CORBA::ULong len = (CORBA::ULong) (::ACE_OS::rand () % max_length); char *buf = CORBA::string_alloc (len); CORBA::ULong i = 0; diff --git a/TAO/tests/Param_Test/helper.h b/TAO/tests/Param_Test/helper.h index d80e8ae40df..f63dcbe0d5f 100644 --- a/TAO/tests/Param_Test/helper.h +++ b/TAO/tests/Param_Test/helper.h @@ -1,4 +1,4 @@ -// $Id +// $Id$ // ============================================================================ // @@ -42,6 +42,7 @@ public: CORBA::Double gen_double (void); #endif CORBA::String gen_string (void); + CORBA::String gen_string (int maxlength); const Param_Test::Fixed_Struct gen_fixed_struct (void); private: Param_Test::Fixed_Struct fixed_struct_; diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp index cb162a86f77..dd256353ef4 100644 --- a/TAO/tests/Param_Test/options.cpp +++ b/TAO/tests/Param_Test/options.cpp @@ -97,6 +97,8 @@ Options::parse_args (int argc, char **argv) this->test_type_ = Options::TEST_SHORT; else if (!ACE_OS::strcmp (get_opts.optarg, "ubstring")) this->test_type_ = Options::TEST_UNBOUNDED_STRING; + else if (!ACE_OS::strcmp (get_opts.optarg, "bdstring")) + this->test_type_ = Options::TEST_BOUNDED_STRING; else if (!ACE_OS::strcmp (get_opts.optarg, "fixed_struct")) this->test_type_ = Options::TEST_FIXED_STRUCT; else if (!ACE_OS::strcmp (get_opts.optarg, "strseq")) diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h index d0ee1fec6f7..0bd7f9651c5 100644 --- a/TAO/tests/Param_Test/options.h +++ b/TAO/tests/Param_Test/options.h @@ -31,6 +31,7 @@ public: NO_TEST, TEST_SHORT, TEST_UNBOUNDED_STRING, + TEST_BOUNDED_STRING, TEST_FIXED_STRUCT, TEST_STRING_SEQUENCE, TEST_BOUNDED_STRING_SEQUENCE, diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl index e298e7a6035..da0c753929c 100644 --- a/TAO/tests/Param_Test/param_test.idl +++ b/TAO/tests/Param_Test/param_test.idl @@ -45,6 +45,11 @@ interface Param_Test inout string s2, out string s3); + typedef string<128> short_string; + short_string test_bounded_string (in short_string s1, + inout short_string s2, + out short_string s3); + // structures (fixed size) struct Fixed_Struct { diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp index b86ad31acbc..84af4824c43 100644 --- a/TAO/tests/Param_Test/param_test_i.cpp +++ b/TAO/tests/Param_Test/param_test_i.cpp @@ -96,6 +96,24 @@ Param_Test_i::test_unbounded_string (const char *s1, return retstr; } +// test bounded strings. For return and out types, we return duplicates of +// the in string. For the inout, we append the same string to itself and send +// it back +char * +Param_Test_i::test_bounded_string (const char *s1, + char *&s2, + CORBA::String_out s3, + CORBA::Environment &) +{ + char *retstr = CORBA::string_dup (s1); + s3 = CORBA::string_dup (s1); + char *tmp = CORBA::string_alloc (2*ACE_OS::strlen (s2)); + ACE_OS::sprintf (tmp, "%s%s", s2, s2); + CORBA::string_free (s2); + s2 = tmp; + return retstr; +} + // test for fixed structures. Just copy the in parameter into all the others Param_Test::Fixed_Struct Param_Test_i::test_fixed_struct (const Param_Test::Fixed_Struct &s1, diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h index e2f2ace9e73..3d2c91cd44d 100644 --- a/TAO/tests/Param_Test/param_test_i.h +++ b/TAO/tests/Param_Test/param_test_i.h @@ -70,6 +70,12 @@ public: CORBA::Environment &env); // test for unbounded strings + virtual char *test_bounded_string (const char *s1, + char *&s2, + CORBA::String_out s3, + CORBA::Environment &env); + // test for bounded strings + virtual Param_Test::Fixed_Struct test_fixed_struct (const Param_Test::Fixed_Struct &s1, Param_Test::Fixed_Struct &s2, diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h index de3a8cde9cc..04a5a3d9377 100644 --- a/TAO/tests/Param_Test/tests.h +++ b/TAO/tests/Param_Test/tests.h @@ -23,6 +23,7 @@ #include "bd_long_seq.h" #include "bd_short_seq.h" #include "bd_str_seq.h" +#include "bd_string.h" #include "bd_struct_seq.h" #include "fixed_array.h" #include "fixed_struct.h" |