blob: e3f3262878b72ff41969a6fb46749585e23744cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/**
* @file
*
* @brief Smoke test (basically just compile) the unbounded sequences
* for strings.
*
* @author Carlos O'Ryan
*/
#include "tao/Unbounded_Basic_String_Sequence_T.h"
#include "tao/CORBA_String.h"
#include "ace/Log_Msg.h"
typedef TAO::unbounded_basic_string_sequence<char> s_sequence;
int ACE_TMAIN (int, ACE_TCHAR *[])
{
try
{
s_sequence a;
s_sequence b(23);
s_sequence c(32, 0, s_sequence::allocbuf(32), true);
a = b;
a.length(c.maximum());
if (a.release())
{
b.length(a.length());
}
a[0] = const_cast<char const*>("Hello");
b[0] = a[0];
s_sequence const & d = a;
try
{
c[0] = d[0];
#if defined (TAO_CHECKED_SEQUENCE_INDEXING) && (TAO_CHECKED_SEQUENCE_INDEXING == 1)
return 1;
#endif
}
catch (const ::CORBA::BAD_PARAM &)
{
// c has length = 0, so there is an exception when we try
// to access element above length.
}
b.replace(64, 0, s_sequence::allocbuf(64), true);
char const * const * x = d.get_buffer();
if (x != 0)
{
s_sequence::freebuf(a.get_buffer(true));
}
x = b.get_buffer();
if (d.length())
{
s_sequence::freebuf(s_sequence::allocbuf(64));
}
s_sequence e(c);
CORBA::String_var w(const_cast<char const*>("World"));
try
{
e[0] = w;
#if defined (TAO_CHECKED_SEQUENCE_INDEXING) && (TAO_CHECKED_SEQUENCE_INDEXING == 1)
return 1;
#endif
}
catch (const ::CORBA::BAD_PARAM &)
{
// e has length = 0, so there is an exception when we try
// to access element above length.
}
}
catch (const ::CORBA::Exception &)
{
ACE_ERROR ((LM_ERROR, "Caught unexpected exception\n"));
return 1;
}
return 0;
}
|