r15260: Don't dereference NULL pointers to obtain array lengths - found by
[samba.git] / source / pidl / ref_notes.txt
1 some experiments with ref ptrs
2
3
4
5         typedef struct {
6                 short x;
7         } xstruct;
8
9         uint16 echo_TestRef([in] xstruct foo);
10
11         short v = 13;
12         xstruct r;
13         r.x = v;
14         echo_TestRef(r);
15
16         [0D 00]
17
18 ----------------------------------------------------
19         typedef struct {
20                 short *x;
21         } xstruct;
22
23         uint16 echo_TestRef([in] xstruct foo);
24
25         short v = 13;
26         xstruct r;
27         r.x = &v;
28         echo_TestRef(r);
29
30         [PP PP PP PP 0D 00]
31
32
33         xstruct r;
34         r.x = NULL;
35         echo_TestRef(r);
36
37         [00 00 00 00]
38
39 ----------------------------------------------------
40         typedef struct {
41                 [ref] short *x;
42         } xstruct;
43
44         uint16 echo_TestRef([in] xstruct foo);
45
46         short v = 13;
47         xstruct r;
48         r.x = &v;
49         echo_TestRef(r);
50
51         [XX XX XX XX 0D 00]
52
53
54         xstruct r;
55         r.x = NULL;
56         echo_TestRef(r);
57
58         [client runtime error 0x6f4]
59
60
61 ----------------------------------------------------
62         typedef struct {
63                 short x;
64         } xstruct;
65
66         uint16 echo_TestRef([in] xstruct *foo);
67
68         short v = 13;
69         xstruct r;
70         r.x = v;
71         echo_TestRef(&r);
72
73         [0D 00]
74
75
76         echo_TestRef(NULL);
77
78         [client runtime error 0x6f4]
79
80 ----------------------------------------------------
81         typedef struct {
82                 short x;
83         } xstruct;
84
85         uint16 echo_TestRef([in,ref] xstruct *foo);
86
87         short v = 13;
88         xstruct r;
89         r.x = v;
90         echo_TestRef(&r);
91
92         [0D 00]
93
94
95         echo_TestRef(NULL);
96
97         [client runtime error 0x6f4]
98
99
100 ----------------------------------------------------
101         typedef struct {
102                 short x;
103         } xstruct;
104
105         uint16 echo_TestRef([in,unique] xstruct *foo);
106
107         short v = 13;
108         xstruct r;
109         r.x = v;
110         echo_TestRef(&r);
111
112         [PP PP PP PP 0D 00]
113
114
115         echo_TestRef(NULL);
116
117         [00 00 00 00]
118
119
120 ----------------------------------------------------
121         typedef struct {
122                 short x;
123         } xstruct;
124
125         uint16 echo_TestRef([out] xstruct foo);
126
127         [idl compiler error]
128
129 ----------------------------------------------------
130         typedef struct {
131                 short x;
132         } xstruct;
133
134         void echo_TestRef([out] xstruct *foo);
135
136         xstruct r;
137         echo_TestRef(&r);
138         r.x -> 13;
139
140         [0D 00]
141
142
143         echo_TestRef(NULL);
144
145         [client runtime error 0x6f4]
146
147 ----------------------------------------------------
148         typedef struct {
149                 short x;
150         } xstruct;
151
152         void echo_TestRef([out,ref] xstruct *foo);
153
154         xstruct r;
155         echo_TestRef(&r);
156         r.x -> 13;
157
158         [0D 00]
159
160
161         echo_TestRef(NULL);
162
163         [client runtime error 0x6f4]
164
165 ----------------------------------------------------
166         typedef struct {
167                 short x;
168         } xstruct;
169
170         void echo_TestRef([out,unique] xstruct *foo);
171
172         [idl compiler error]
173
174
175 ----------------------------------------------------
176         void echo_TestRef([in] short **foo);
177
178         short v = 13;
179         short *pv = &v;
180
181         echo_TestRef(&pv);
182
183         [PP PP PP PP 0D 00]
184
185
186         short *pv = NULL;
187
188         echo_TestRef(&pv);
189
190         [00 00 00 00]
191
192
193         echo_TestRef(NULL);
194         
195         [client runtime error 0x6f4]
196
197
198 ----------------------------------------------------
199         void echo_TestRef([in,ref] short **foo);
200
201         short v = 13;
202         short *pv = &v;
203
204         echo_TestRef(&pv);
205
206         [PP PP PP PP 0D 00]
207
208
209         short *pv = NULL;
210
211         echo_TestRef(&pv);
212
213         [00 00 00 00]
214
215
216         echo_TestRef(NULL);
217         
218         [client runtime error 0x6f4]
219
220