Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PDNSRequestParams.cpp
Line
Count
Source (jump to first uncovered line)
1
//
2
// Automatically generated by ipdlc.
3
// Edit at your own risk
4
//
5
6
7
#include "mozilla/net/PDNSRequestParams.h"
8
9
10
//-----------------------------------------------------------------------------
11
// Method definitions for the IPDL type |struct DNSRecord|
12
//
13
namespace mozilla {
14
namespace net {
15
auto DNSRecord::operator==(const DNSRecord& _o) const -> bool
16
0
{
17
0
    if ((!((canonicalName()) == ((_o).canonicalName())))) {
18
0
        return false;
19
0
    }
20
0
    if ((!((addrs()) == ((_o).addrs())))) {
21
0
        return false;
22
0
    }
23
0
    return true;
24
0
}
25
26
auto DNSRecord::operator!=(const DNSRecord& _o) const -> bool
27
0
{
28
0
    return (!(operator==(_o)));
29
0
}
30
31
} // namespace net
32
} // namespace mozilla
33
34
namespace mozilla {
35
namespace ipc {
36
auto IPDLParamTraits<mozilla::net::DNSRecord>::Write(
37
        IPC::Message* aMsg,
38
        mozilla::ipc::IProtocol* aActor,
39
        const paramType& aVar) -> void
40
0
{
41
0
    WriteIPDLParam(aMsg, aActor, (aVar).canonicalName());
42
0
    // Sentinel = 'canonicalName'
43
0
    (aMsg)->WriteSentinel(2117440974);
44
0
    WriteIPDLParam(aMsg, aActor, (aVar).addrs());
45
0
    // Sentinel = 'addrs'
46
0
    (aMsg)->WriteSentinel(2934080597);
47
0
}
48
49
auto IPDLParamTraits<mozilla::net::DNSRecord>::Read(
50
        const IPC::Message* aMsg,
51
        PickleIterator* aIter,
52
        mozilla::ipc::IProtocol* aActor,
53
        paramType* aVar) -> bool
54
0
{
55
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->canonicalName())))))) {
56
0
        (aActor)->FatalError("Error deserializing 'canonicalName' (nsCString) member of 'DNSRecord'");
57
0
        return false;
58
0
    }
59
0
    // Sentinel = 'canonicalName'
60
0
    if ((!((aMsg)->ReadSentinel(aIter, 2117440974)))) {
61
0
        mozilla::ipc::SentinelReadError("Error deserializing 'canonicalName' (nsCString) member of 'DNSRecord'");
62
0
        return false;
63
0
    }
64
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->addrs())))))) {
65
0
        (aActor)->FatalError("Error deserializing 'addrs' (NetAddrArray) member of 'DNSRecord'");
66
0
        return false;
67
0
    }
68
0
    // Sentinel = 'addrs'
69
0
    if ((!((aMsg)->ReadSentinel(aIter, 2934080597)))) {
70
0
        mozilla::ipc::SentinelReadError("Error deserializing 'addrs' (NetAddrArray) member of 'DNSRecord'");
71
0
        return false;
72
0
    }
73
0
    return true;
74
0
}
75
76
} // namespace ipc
77
} // namespace mozilla
78
79
//-----------------------------------------------------------------------------
80
// Method definitions for the IPDL type |union DNSRequestResponse|
81
//
82
namespace mozilla {
83
namespace net {
84
auto DNSRequestResponse::MaybeDestroy(Type aNewType) -> bool
85
0
{
86
0
    if ((mType) == (T__None)) {
87
0
        return true;
88
0
    }
89
0
    if ((mType) == (aNewType)) {
90
0
        return false;
91
0
    }
92
0
    switch (mType) {
93
0
    case TDNSRecord:
94
0
        {
95
0
            (ptr_DNSRecord())->~DNSRecord__tdef();
96
0
            break;
97
0
        }
98
0
    case TArrayOfnsCString:
99
0
        {
100
0
            (ptr_ArrayOfnsCString())->~ArrayOfnsCString__tdef();
101
0
            break;
102
0
        }
103
0
    case Tnsresult:
104
0
        {
105
0
            (ptr_nsresult())->~nsresult__tdef();
106
0
            break;
107
0
        }
108
0
    default:
109
0
        {
110
0
            mozilla::ipc::LogicError("not reached");
111
0
            break;
112
0
        }
113
0
    }
114
0
    return true;
115
0
}
116
117
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(const DNSRecord& aOther)
118
0
{
119
0
    new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord(aOther);
120
0
    mType = TDNSRecord;
121
0
}
122
123
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(DNSRecord&& aOther)
124
0
{
125
0
    new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord(std::move(aOther));
126
0
    mType = TDNSRecord;
127
0
}
128
129
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(const nsTArray<nsCString>& aOther)
130
0
{
131
0
    new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>(aOther);
132
0
    mType = TArrayOfnsCString;
133
0
}
134
135
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(nsTArray<nsCString>&& aOther)
136
0
{
137
0
    new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>(std::move(aOther));
138
0
    mType = TArrayOfnsCString;
139
0
}
140
141
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(const nsresult& aOther)
142
0
{
143
0
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aOther);
144
0
    mType = Tnsresult;
145
0
}
146
147
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(nsresult&& aOther)
148
0
{
149
0
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aOther));
150
0
    mType = Tnsresult;
151
0
}
152
153
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(const DNSRequestResponse& aOther)
154
0
{
155
0
    (aOther).AssertSanity();
156
0
    switch ((aOther).type()) {
157
0
    case TDNSRecord:
158
0
        {
159
0
            new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord((aOther).get_DNSRecord());
160
0
            break;
161
0
        }
162
0
    case TArrayOfnsCString:
163
0
        {
164
0
            new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>((aOther).get_ArrayOfnsCString());
165
0
            break;
166
0
        }
167
0
    case Tnsresult:
168
0
        {
169
0
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
170
0
            break;
171
0
        }
172
0
    case T__None:
173
0
        {
174
0
            break;
175
0
        }
176
0
    default:
177
0
        {
178
0
            mozilla::ipc::LogicError("unreached");
179
0
            return;
180
0
        }
181
0
    }
182
0
    mType = (aOther).type();
183
0
}
184
185
MOZ_IMPLICIT DNSRequestResponse::DNSRequestResponse(DNSRequestResponse&& aOther)
186
0
{
187
0
    (aOther).AssertSanity();
188
0
    Type t = (aOther).type();
189
0
    switch (t) {
190
0
    case TDNSRecord:
191
0
        {
192
0
            new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord(std::move((aOther).get_DNSRecord()));
193
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
194
0
            break;
195
0
        }
196
0
    case TArrayOfnsCString:
197
0
        {
198
0
            new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>(std::move((aOther).get_ArrayOfnsCString()));
199
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
200
0
            break;
201
0
        }
202
0
    case Tnsresult:
203
0
        {
204
0
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aOther).get_nsresult()));
205
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
206
0
            break;
207
0
        }
208
0
    case T__None:
209
0
        {
210
0
            break;
211
0
        }
212
0
    default:
213
0
        {
214
0
            mozilla::ipc::LogicError("unreached");
215
0
            return;
216
0
        }
217
0
    }
218
0
    (aOther).mType = T__None;
219
0
    mType = t;
220
0
}
221
222
DNSRequestResponse::~DNSRequestResponse()
223
0
{
224
0
    static_cast<void>(MaybeDestroy(T__None));
225
0
}
226
227
auto DNSRequestResponse::operator=(const DNSRecord& aRhs) -> DNSRequestResponse&
228
0
{
229
0
    if (MaybeDestroy(TDNSRecord)) {
230
0
        new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord;
231
0
    }
232
0
    (*(ptr_DNSRecord())) = aRhs;
233
0
    mType = TDNSRecord;
234
0
    return (*(this));
235
0
}
236
237
auto DNSRequestResponse::operator=(DNSRecord&& aRhs) -> DNSRequestResponse&
238
0
{
239
0
    if (MaybeDestroy(TDNSRecord)) {
240
0
        new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord;
241
0
    }
242
0
    (*(ptr_DNSRecord())) = std::move(aRhs);
243
0
    mType = TDNSRecord;
244
0
    return (*(this));
245
0
}
246
247
auto DNSRequestResponse::operator=(const nsTArray<nsCString>& aRhs) -> DNSRequestResponse&
248
0
{
249
0
    if (MaybeDestroy(TArrayOfnsCString)) {
250
0
        new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>;
251
0
    }
252
0
    (*(ptr_ArrayOfnsCString())) = aRhs;
253
0
    mType = TArrayOfnsCString;
254
0
    return (*(this));
255
0
}
256
257
auto DNSRequestResponse::operator=(nsTArray<nsCString>&& aRhs) -> DNSRequestResponse&
258
0
{
259
0
    if (MaybeDestroy(TArrayOfnsCString)) {
260
0
        new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>;
261
0
    }
262
0
    (*(ptr_ArrayOfnsCString())) = std::move(aRhs);
263
0
    mType = TArrayOfnsCString;
264
0
    return (*(this));
265
0
}
266
267
auto DNSRequestResponse::operator=(const nsresult& aRhs) -> DNSRequestResponse&
268
0
{
269
0
    if (MaybeDestroy(Tnsresult)) {
270
0
        new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
271
0
    }
272
0
    (*(ptr_nsresult())) = aRhs;
273
0
    mType = Tnsresult;
274
0
    return (*(this));
275
0
}
276
277
auto DNSRequestResponse::operator=(nsresult&& aRhs) -> DNSRequestResponse&
278
0
{
279
0
    if (MaybeDestroy(Tnsresult)) {
280
0
        new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
281
0
    }
282
0
    (*(ptr_nsresult())) = std::move(aRhs);
283
0
    mType = Tnsresult;
284
0
    return (*(this));
285
0
}
286
287
auto DNSRequestResponse::operator=(const DNSRequestResponse& aRhs) -> DNSRequestResponse&
288
0
{
289
0
    (aRhs).AssertSanity();
290
0
    Type t = (aRhs).type();
291
0
    switch (t) {
292
0
    case TDNSRecord:
293
0
        {
294
0
            if (MaybeDestroy(t)) {
295
0
                new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord;
296
0
            }
297
0
            (*(ptr_DNSRecord())) = (aRhs).get_DNSRecord();
298
0
            break;
299
0
        }
300
0
    case TArrayOfnsCString:
301
0
        {
302
0
            if (MaybeDestroy(t)) {
303
0
                new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>;
304
0
            }
305
0
            (*(ptr_ArrayOfnsCString())) = (aRhs).get_ArrayOfnsCString();
306
0
            break;
307
0
        }
308
0
    case Tnsresult:
309
0
        {
310
0
            if (MaybeDestroy(t)) {
311
0
                new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
312
0
            }
313
0
            (*(ptr_nsresult())) = (aRhs).get_nsresult();
314
0
            break;
315
0
        }
316
0
    case T__None:
317
0
        {
318
0
            static_cast<void>(MaybeDestroy(t));
319
0
            break;
320
0
        }
321
0
    default:
322
0
        {
323
0
            mozilla::ipc::LogicError("unreached");
324
0
            break;
325
0
        }
326
0
    }
327
0
    mType = t;
328
0
    return (*(this));
329
0
}
330
331
auto DNSRequestResponse::operator=(DNSRequestResponse&& aRhs) -> DNSRequestResponse&
332
0
{
333
0
    (aRhs).AssertSanity();
334
0
    Type t = (aRhs).type();
335
0
    switch (t) {
336
0
    case TDNSRecord:
337
0
        {
338
0
            if (MaybeDestroy(t)) {
339
0
                new (mozilla::KnownNotNull, ptr_DNSRecord()) DNSRecord;
340
0
            }
341
0
            (*(ptr_DNSRecord())) = std::move((aRhs).get_DNSRecord());
342
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
343
0
            break;
344
0
        }
345
0
    case TArrayOfnsCString:
346
0
        {
347
0
            if (MaybeDestroy(t)) {
348
0
                new (mozilla::KnownNotNull, ptr_ArrayOfnsCString()) nsTArray<nsCString>;
349
0
            }
350
0
            (*(ptr_ArrayOfnsCString())) = std::move((aRhs).get_ArrayOfnsCString());
351
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
352
0
            break;
353
0
        }
354
0
    case Tnsresult:
355
0
        {
356
0
            if (MaybeDestroy(t)) {
357
0
                new (mozilla::KnownNotNull, ptr_nsresult()) nsresult;
358
0
            }
359
0
            (*(ptr_nsresult())) = std::move((aRhs).get_nsresult());
360
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
361
0
            break;
362
0
        }
363
0
    case T__None:
364
0
        {
365
0
            static_cast<void>(MaybeDestroy(t));
366
0
            break;
367
0
        }
368
0
    default:
369
0
        {
370
0
            mozilla::ipc::LogicError("unreached");
371
0
            break;
372
0
        }
373
0
    }
374
0
    (aRhs).mType = T__None;
375
0
    mType = t;
376
0
    return (*(this));
377
0
}
378
379
auto DNSRequestResponse::operator==(const DNSRecord& aRhs) const -> bool
380
0
{
381
0
    return (get_DNSRecord()) == (aRhs);
382
0
}
383
384
auto DNSRequestResponse::operator==(const nsTArray<nsCString>& aRhs) const -> bool
385
0
{
386
0
    return (get_ArrayOfnsCString()) == (aRhs);
387
0
}
388
389
auto DNSRequestResponse::operator==(const nsresult& aRhs) const -> bool
390
0
{
391
0
    return (get_nsresult()) == (aRhs);
392
0
}
393
394
auto DNSRequestResponse::operator==(const DNSRequestResponse& aRhs) const -> bool
395
0
{
396
0
    if ((type()) != ((aRhs).type())) {
397
0
        return false;
398
0
    }
399
0
400
0
    switch (type()) {
401
0
    case TDNSRecord:
402
0
        {
403
0
            return (get_DNSRecord()) == ((aRhs).get_DNSRecord());
404
0
        }
405
0
    case TArrayOfnsCString:
406
0
        {
407
0
            return (get_ArrayOfnsCString()) == ((aRhs).get_ArrayOfnsCString());
408
0
        }
409
0
    case Tnsresult:
410
0
        {
411
0
            return (get_nsresult()) == ((aRhs).get_nsresult());
412
0
        }
413
0
    default:
414
0
        {
415
0
            mozilla::ipc::LogicError("unreached");
416
0
            return false;
417
0
        }
418
0
    }
419
0
}
420
421
auto DNSRequestResponse::get(DNSRecord* aOutValue) const -> void
422
0
{
423
0
    (*(aOutValue)) = get_DNSRecord();
424
0
}
425
426
auto DNSRequestResponse::get(nsTArray<nsCString>* aOutValue) const -> void
427
0
{
428
0
    (*(aOutValue)) = get_ArrayOfnsCString();
429
0
}
430
431
auto DNSRequestResponse::get(nsresult* aOutValue) const -> void
432
0
{
433
0
    (*(aOutValue)) = get_nsresult();
434
0
}
435
436
} // namespace net
437
} // namespace mozilla
438
439
namespace mozilla {
440
namespace ipc {
441
auto IPDLParamTraits<mozilla::net::DNSRequestResponse>::Write(
442
        IPC::Message* aMsg,
443
        mozilla::ipc::IProtocol* aActor,
444
        const paramType& aVar) -> void
445
{
446
    typedef mozilla::net::DNSRequestResponse union__;
447
    int type;
448
    type = (aVar).type();
449
    WriteIPDLParam(aMsg, aActor, type);
450
    // Sentinel = 'DNSRequestResponse'
451
    (aMsg)->WriteSentinel(1300723575);
452
453
    switch (type) {
454
    case union__::TDNSRecord:
455
        {
456
            WriteIPDLParam(aMsg, aActor, (aVar).get_DNSRecord());
457
            // Sentinel = 'TDNSRecord'
458
            (aMsg)->WriteSentinel(2640728140);
459
            return;
460
        }
461
    case union__::TArrayOfnsCString:
462
        {
463
            WriteIPDLParam(aMsg, aActor, (aVar).get_ArrayOfnsCString());
464
            // Sentinel = 'TArrayOfnsCString'
465
            (aMsg)->WriteSentinel(2949171118);
466
            return;
467
        }
468
    case union__::Tnsresult:
469
        {
470
            WriteIPDLParam(aMsg, aActor, (aVar).get_nsresult());
471
            // Sentinel = 'Tnsresult'
472
            (aMsg)->WriteSentinel(2293764539);
473
            return;
474
        }
475
    default:
476
        {
477
            (aActor)->FatalError("unknown union type");
478
            return;
479
        }
480
    }
481
}
482
483
auto IPDLParamTraits<mozilla::net::DNSRequestResponse>::Read(
484
        const IPC::Message* aMsg,
485
        PickleIterator* aIter,
486
        mozilla::ipc::IProtocol* aActor,
487
        paramType* aVar) -> bool
488
0
{
489
0
    typedef mozilla::net::DNSRequestResponse union__;
490
0
    int type;
491
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) {
492
0
        (aActor)->FatalError("Error deserializing type of union DNSRequestResponse");
493
0
        return false;
494
0
    }
495
0
    // Sentinel = 'DNSRequestResponse'
496
0
    if ((!((aMsg)->ReadSentinel(aIter, 1300723575)))) {
497
0
        mozilla::ipc::SentinelReadError("Error deserializing type of union DNSRequestResponse");
498
0
        return false;
499
0
    }
500
0
501
0
    switch (type) {
502
0
    case union__::TDNSRecord:
503
0
        {
504
0
            mozilla::net::DNSRecord tmp = mozilla::net::DNSRecord();
505
0
            (*(aVar)) = tmp;
506
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_DNSRecord())))))) {
507
0
                (aActor)->FatalError("Error deserializing variant TDNSRecord of union DNSRequestResponse");
508
0
                return false;
509
0
            }
510
0
            // Sentinel = 'TDNSRecord'
511
0
            if ((!((aMsg)->ReadSentinel(aIter, 2640728140)))) {
512
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TDNSRecord of union DNSRequestResponse");
513
0
                return false;
514
0
            }
515
0
            return true;
516
0
        }
517
0
    case union__::TArrayOfnsCString:
518
0
        {
519
0
            nsTArray<nsCString> tmp;
520
0
            (*(aVar)) = tmp;
521
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_ArrayOfnsCString())))))) {
522
0
                (aActor)->FatalError("Error deserializing variant TArrayOfnsCString of union DNSRequestResponse");
523
0
                return false;
524
0
            }
525
0
            // Sentinel = 'TArrayOfnsCString'
526
0
            if ((!((aMsg)->ReadSentinel(aIter, 2949171118)))) {
527
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfnsCString of union DNSRequestResponse");
528
0
                return false;
529
0
            }
530
0
            return true;
531
0
        }
532
0
    case union__::Tnsresult:
533
0
        {
534
0
            nsresult tmp = nsresult();
535
0
            (*(aVar)) = tmp;
536
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_nsresult())))))) {
537
0
                (aActor)->FatalError("Error deserializing variant Tnsresult of union DNSRequestResponse");
538
0
                return false;
539
0
            }
540
0
            // Sentinel = 'Tnsresult'
541
0
            if ((!((aMsg)->ReadSentinel(aIter, 2293764539)))) {
542
0
                mozilla::ipc::SentinelReadError("Error deserializing variant Tnsresult of union DNSRequestResponse");
543
0
                return false;
544
0
            }
545
0
            return true;
546
0
        }
547
0
    default:
548
0
        {
549
0
            (aActor)->FatalError("unknown union type");
550
0
            return false;
551
0
        }
552
0
    }
553
0
}
554
555
} // namespace ipc
556
} // namespace mozilla