1- #include < string>
21#include " Echo_i.h"
32
3+ enum { BIG_LENGTH = 4 * 1024 };
4+
45// Constructor.
56
67Echo_i::Echo_i (CORBA::ORB_ptr o)
@@ -32,10 +33,13 @@ Echo_i::return_list ()
3233 list->length (2 );
3334
3435 // Just do something to get a 'big' list of strings.
35- std::string big (4 * 1024 , ' A' );
36- std::string small (" Hello World" );
37- list[CORBA::ULong (0 )] = CORBA::string_dup (big.c_str ());
38- list[CORBA::ULong (1 )] = CORBA::string_dup (small.c_str ());
36+ CORBA::Char big[BIG_LENGTH + 1 ];
37+ for (int i = 0 ; i < BIG_LENGTH; ++i)
38+ big[i] = ' A' ;
39+ big[BIG_LENGTH] = 0 ;
40+ CORBA::Char small[] = " Hello World" ;
41+ list[CORBA::ULong (0 )] = CORBA::string_dup (big);
42+ list[CORBA::ULong (1 )] = CORBA::string_dup (small);
3943
4044 return list._retn ();
4145}
@@ -56,10 +60,16 @@ Echo_i::return_wlist ()
5660 list->length (2 );
5761
5862 // Just do something to get a 'big' list of wide strings.
59- std::wstring big (4 * 1024 , ' A' );
60- std::wstring small (17 , ' B' );
61- list[CORBA::ULong (0 )] = CORBA::wstring_dup (big.c_str ());
62- list[CORBA::ULong (1 )] = CORBA::wstring_dup (small.c_str ());
63+ CORBA::WChar big[BIG_LENGTH + 1 ];
64+ for (int i = 0 ; i < BIG_LENGTH; ++i)
65+ big[i] = ' A' ;
66+ big[BIG_LENGTH] = 0 ;
67+ CORBA::WChar small[17 + 1 ];
68+ for (int i = 0 ; i < 17 ; ++i)
69+ small[i] = ' B' ;
70+ small[17 ] = 0 ;
71+ list[CORBA::ULong (0 )] = CORBA::wstring_dup (big);
72+ list[CORBA::ULong (1 )] = CORBA::wstring_dup (small);
6373
6474 return list._retn ();
6575}
0 commit comments