summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_parser.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-24 01:18:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:44 -0500
commit152a6a00c31f52d14a63bfc977ac54713c56c9cd (patch)
tree82a0b1a45404f08f32b647a47b7c332469650fc8 /source4/build/pidl/ndr_parser.pm
parentd60b11c1f0151dbd758b896ba2934a8efa4ada75 (diff)
downloadsamba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.tar.gz
samba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.tar.bz2
samba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.zip
r7865: changed pidl to take a "const void *" instead of a "void *" for the
structure in ndr_push_*() and ndr_print_*(). The push and print functions really should not modify the structure. metze, to make this work I had to change your spoolss hand marshaller. Can you please check it is OK? I think that the IN and OUT sides of that function are not ever called on the same structure, so I think that attempt at remembering the value by assigning to r->in._offered was not doing anything anyway, but please correct me if I have misunderstood it. If you really do need to remember something on those structures I'd suggest the ndr_token_store() and ndr_token_retrieve() functions, which are used by pidl for just this sort of thing. (This used to be commit eee528be97fa43ca53bdc5652b4d29a0a2caf563)
Diffstat (limited to 'source4/build/pidl/ndr_parser.pm')
-rw-r--r--source4/build/pidl/ndr_parser.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm
index a654909e0b..ba6b9d58da 100644
--- a/source4/build/pidl/ndr_parser.pm
+++ b/source4/build/pidl/ndr_parser.pm
@@ -603,7 +603,7 @@ sub ParseElementPush($$$$$$)
start_flags($e);
if (my $value = util::has_property($e, "value")) {
- pidl "$var_name = " . util::ParseExpr($value, $env) . ";";
+ $var_name = util::ParseExpr($value, $env);
}
ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred);
@@ -642,9 +642,7 @@ sub ParseElementPrint($$$)
return if (util::has_property($e, "noprint"));
if (my $value = util::has_property($e, "value")) {
- pidl "if (ndr->flags & LIBNDR_PRINT_SET_VALUES) {";
- pidl "\t$var_name = " . util::ParseExpr($value,$env) . ";";
- pidl "}";
+ $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . util::ParseExpr($value,$env) . ":$var_name";
}
foreach my $l (@{$e->{LEVELS}}) {
@@ -1361,13 +1359,13 @@ sub ParseStructNdrSize($)
sub ArgsStructPush($)
{
my $e = shift;
- return "struct ndr_push *ndr, int ndr_flags, struct $e->{NAME} *r";
+ return "struct ndr_push *ndr, int ndr_flags, const struct $e->{NAME} *r";
}
sub ArgsStructPrint($)
{
my $e = shift;
- return "struct ndr_print *ndr, const char *name, struct $e->{NAME} *r";
+ return "struct ndr_print *ndr, const char *name, const struct $e->{NAME} *r";
}
sub ArgsStructPull($)
@@ -1634,13 +1632,13 @@ sub ParseUnionPull($$)
sub ArgsUnionPush($)
{
my $e = shift;
- return "struct ndr_push *ndr, int ndr_flags, union $e->{NAME} *r";
+ return "struct ndr_push *ndr, int ndr_flags, const union $e->{NAME} *r";
}
sub ArgsUnionPrint($)
{
my $e = shift;
- return "struct ndr_print *ndr, const char *name, union $e->{NAME} *r";
+ return "struct ndr_print *ndr, const char *name, const union $e->{NAME} *r";
}
sub ArgsUnionPull($)
@@ -1746,7 +1744,7 @@ sub ParseFunctionPrint($)
return if util::has_property($fn, "noprint");
- pidl "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, struct $fn->{NAME} *r)";
+ pidl "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r)";
pidl "{";
indent;
@@ -1809,7 +1807,7 @@ sub ParseFunctionPush($)
return if util::has_property($fn, "nopush");
- pidl fn_prefix($fn) . "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, struct $fn->{NAME} *r)";
+ pidl fn_prefix($fn) . "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)";
pidl "{";
indent;