diff options
author | Tim Potter <tpot@samba.org> | 2004-06-16 09:32:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:43 -0500 |
commit | 9517834e64340333cb3f3403bf2535e7bc147947 (patch) | |
tree | 835f9e12a1f0ceb4d0cdcc57f3eab1e3bdca94f7 /source4 | |
parent | 5da5297efaaef13b9f6d88e184a223da41bea79a (diff) | |
download | samba-9517834e64340333cb3f3403bf2535e7bc147947.tar.gz samba-9517834e64340333cb3f3403bf2535e7bc147947.tar.bz2 samba-9517834e64340333cb3f3403bf2535e7bc147947.zip |
r1167: Misc cleanups:
- shorten COL_INFO message
- make parser error messages prettier
- separate variable declarations from function body with newline
- only generate variables for requests/responses when they have the
in/out property
(This used to be commit 53313775a872d5c2f78f214573fd5933af5c205c)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/eparser.pm | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index 890b5faf66..b55da894d2 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -238,9 +238,9 @@ sub ParseArrayPull($$$) $alloc_size = $e->{CONFORMANT_SIZE}; pidl "\tif ($size > $alloc_size) {\n"; - pidl "\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad conformant size %u should be %u\", $alloc_size, $size);\n"; + pidl "\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad conformant size (%u should be %u)\", $alloc_size, $size);\n"; pidl "\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n"; - pidl "\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", 1Bad conformant size %u should be %u\", $alloc_size, $size);\n"; + pidl "\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad conformant size\", $alloc_size, $size);\n"; pidl "\t\treturn;\n"; pidl "\t}\n"; } elsif (!util::is_inline_array($e)) { @@ -258,9 +258,9 @@ sub ParseArrayPull($$$) } else { pidl "\t\tif ($size != _array_size) {\n"; } - pidl "\t\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad array size %u should be %u\", _array_size, $size);\n"; + pidl "\t\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad array size (%u should be %u)\", _array_size, $size);\n"; pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n"; - pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", 2Bad array size %u should be %u\", _array_size, $size);\n"; + pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad array size\", _array_size, $size);\n"; pidl "\t\t\treturn;\n"; pidl "\t\t}\n"; if ($size =~ /r->in/) { @@ -292,15 +292,15 @@ sub ParseArrayPull($$$) pidl "\t\tndr_pull_uint32(ndr, subtree, hf_array_offset, &_offset);\n"; pidl "\t\tndr_pull_uint32(ndr, subtree, hf_array_length, &_length);\n"; pidl "\t\tif (_offset != 0) {\n"; - pidl "\t\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad array offset 0x%08x\", _offset);\n"; + pidl "\t\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad array offset %d\", _offset);\n"; pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n"; - pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \"3Bad array offset 0x%08x\", _offset);\n"; + pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \"Bad array offset %d\", _offset);\n"; pidl "\t\t\treturn;\n"; pidl "\t\t}\n"; pidl "\t\tif (_length > $size || _length != $length) {\n"; pidl "\t\t\tproto_tree_add_text(subtree, ndr->tvb, ndr->offset, 0, \"Bad array length %d > size %d\", _offset, $size);\n"; pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n"; - pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", 4Bad array length %d > size %d\", _offset, $size);\n"; + pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad array length %d > size %d\", _offset, $size);\n"; pidl "\t\t\treturn;\n"; pidl "\t\t}\n"; $size = "_length"; @@ -483,6 +483,8 @@ sub ParseStructPull($) } } + pidl "\n"; + start_flags($struct); pidl "\titem = proto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"$struct->{PARENT}{NAME}\");\n"; @@ -725,14 +727,20 @@ sub ParseFunctionPull($) # declare any internal pointers we need foreach my $e (@{$fn->{DATA}}) { + if (util::need_wire_pointer($e) && util::has_property($e, "in")) { pidl "\tguint32 ptr_$e->{NAME};\n"; } - pidl "\tg$e->{TYPE} elt_$e->{NAME};\n", - if util::is_builtin_type($e->{TYPE}); + + if (util::has_property($e, "in")) { + pidl "\tg$e->{TYPE} elt_$e->{NAME};\n", + if util::is_builtin_type($e->{TYPE}); + } } + pidl "\n"; + foreach my $e (@{$fn->{DATA}}) { if (util::has_property($e, "in")) { ParseFunctionElementPull($e, "in"); @@ -741,6 +749,7 @@ sub ParseFunctionPull($) pidl "\toffset = ndr->offset;\n"; pidl "\tndr_pull_free(ndr);\n"; + pidl "\n"; pidl "\treturn offset;\n"; pidl "}\n\n"; @@ -753,14 +762,20 @@ sub ParseFunctionPull($) # declare any internal pointers we need foreach my $e (@{$fn->{DATA}}) { + if (util::need_wire_pointer($e) && util::has_property($e, "out")) { pidl "\tguint32 ptr_$e->{NAME};\n"; } - pidl "\tg$e->{TYPE} elt_$e->{NAME};\n", - if util::is_builtin_type($e->{TYPE}); + + if (util::has_property($e, "out")) { + pidl "\tg$e->{TYPE} elt_$e->{NAME};\n", + if util::is_builtin_type($e->{TYPE}); + } } + pidl "\n"; + foreach my $e (@{$fn->{DATA}}) { if (util::has_property($e, "out")) { ParseFunctionElementPull($e, "out"); @@ -773,6 +788,7 @@ sub ParseFunctionPull($) pidl "\toffset = ndr->offset;\n"; pidl "\tndr_pull_free(ndr);\n"; + pidl "\n"; pidl "\treturn offset;\n"; pidl "}\n\n"; } |