From 2bbe0c2859487e286f90d0ab7305da54aed5f1e1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 Feb 2009 18:51:36 +0100 Subject: pidl: return early when AllocOutVar() in s3 server generator has nothing to do. Jelmer, Metze, please check. Guenther --- pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pidl/lib/Parse/Pidl/Samba3') diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index 33dc68e753..c9a8eea59f 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -58,14 +58,17 @@ sub AllocOutVar($$$$$) if ($l->{TYPE} eq "POINTER") { my $nl = GetNextLevel($e, $l); $l = $nl if ($nl->{TYPE} eq "ARRAY"); - } + } elsif # we don't support multi-dimentional arrays yet - if ($l->{TYPE} eq "ARRAY") { + ($l->{TYPE} eq "ARRAY") { my $nl = GetNextLevel($e, $l); if ($nl->{TYPE} eq "ARRAY") { fatal($e->{ORIGINAL},"multi-dimentional [out] arrays are not supported!"); } + } else { + # neither pointer nor array, no need to alloc something. + return; } if ($l->{TYPE} eq "ARRAY") { -- cgit From 7168cf440ecacb3c49c1026320347632b629668d Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Sat, 7 Feb 2009 00:43:16 -0800 Subject: pidl: Fix a const build warning in the samba3 merged build ../librpc/gen_ndr/cli_spoolss.c: In function `rpccli_spoolss_EnumPrinterData': ../librpc/gen_ndr/cli_spoolss.c:3400: warning: passing arg 1 of `memcpy' discards qualifiers from pointer target type This is a very similar fix to: 2337f402f0f2fd6c1fa077b1b35347905a38c715 --- pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pidl/lib/Parse/Pidl/Samba3') diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 1a0eb51438..ed1b71a236 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -97,7 +97,11 @@ sub ParseOutputArgument($$$) # to allocate a structure of the right size. my $env = GenerateFunctionInEnv($fn, "r."); my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); - $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));"); + if (has_property($e, "charset")) { + $self->pidl("memcpy(CONST_DISCARD(char *, $e->{NAME}), r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));"); + } else { + $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));"); + } } else { $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); } -- cgit