- if (!defined $utype ||
- !util::has_property($utype, "nodiscriminant")) {
- my $e2 = util::find_sibling($e, $switch);
- my $type_decl = typelist::mapType($e2);
- pidl "if (($ndr_flags) & NDR_SCALARS) {";
- indent;
- pidl "$type_decl _level;";
- pidl "NDR_CHECK(ndr_pull_$e2->{TYPE}($ndr, NDR_SCALARS, &_level));";
- if ($switch_var =~ /r->in/) {
- pidl "if (!($ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _level != $switch_var) {";
- indent;
- } else {
- pidl "if (_level != $switch_var) {";
- indent;
- }
- pidl "return ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u in $e->{NAME}\", _level);";
- deindent;
- if ($switch_var =~ /r->/) {
- pidl "} else { $switch_var = _level; }";
- } else {
- pidl "}";
- }
- deindent;
- pidl "}";
- }