1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-29 21:47:30 +03:00

r14688: More work on represent_as(): output the right function calls, fix test.

(This used to be commit 7bc72277b37f9d89f6a078e85c14d560fd33a3bb)
This commit is contained in:
Jelmer Vernooij 2006-03-24 11:42:03 +00:00 committed by Gerald (Jerry) Carter
parent b6cae24de8
commit 85e91438b1
3 changed files with 35 additions and 8 deletions

View File

@ -676,8 +676,12 @@ sub ParseElementPush($$$$$$)
# Representation type is different from transmit_as
if ($e->{REPRESENTATION_TYPE}) {
pidl "/* FIXME: Convert from $e->{REPRESENTATION_TYPE} to $e->{TYPE} */";
pidl "NDR_CHECK(ndr_$e->{REPRESENTATION_TYPE}_to_$e->{TYPE}(FIXME, FIXME));";
pidl "{";
indent;
my $transmit_name = "_transmit_$e->{NAME}";
pidl mapType($e->{TYPE}) ." $transmit_name;";
pidl "NDR_CHECK(ndr_$e->{REPRESENTATION_TYPE}_to_$e->{TYPE}($var_name, $transmit_name));";
$var_name = $transmit_name;
}
start_flags($e);
@ -690,6 +694,10 @@ sub ParseElementPush($$$$$$)
end_flags($e);
if ($e->{REPRESENTATION_TYPE}) {
deindent;
pidl "}";
}
}
#####################################################################
@ -1064,11 +1072,20 @@ sub ParseElementPull($$$$$$)
my($e,$ndr,$var_prefix,$env,$primitives,$deferred) = @_;
my $var_name = $var_prefix.$e->{NAME};
$var_name = append_prefix($e, $var_name);
my $represent_name;
return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
if ($e->{REPRESENTATION_TYPE}) {
pidl "{";
indent;
$represent_name = $var_name;
$var_name = "_transmit_$e->{NAME}";
pidl mapType($e->{TYPE})." $var_name;";
}
$var_name = append_prefix($e, $var_name);
start_flags($e);
ParseElementPullLevel($e,$e->{LEVELS}[0],$ndr,$var_name,$env,$primitives,$deferred);
@ -1077,8 +1094,9 @@ sub ParseElementPull($$$$$$)
# Representation type is different from transmit_as
if ($e->{REPRESENTATION_TYPE}) {
pidl "/* FIXME: Convert from $e->{TYPE} to $e->{REPRESENTATION_TYPE} */";
pidl "NDR_CHECK(ndr_$e->{TYPE}_to_$e->{REPRESENTATION_TYPE}(FIXME, FIXME));";
pidl "NDR_CHECK(ndr_$e->{TYPE}_to_$e->{REPRESENTATION_TYPE}($var_name, $represent_name));";
deindent;
pidl "}";
}
}

View File

@ -57,8 +57,8 @@ SKIP: {
print CC "#include <stdarg.h>\n";
print CC $header;
print CC $ndrheader;
print CC $ndrparser;
print CC $extra if ($extra);
print CC $ndrparser;
print CC "int main(int argc, const char **argv)
{
TALLOC_CTX *mem_ctx = talloc_init(NULL);

View File

@ -29,7 +29,16 @@ test_samba4_ndr('represent_as-simple',
return 2;
',
'
NTSTATUS ndr_uint8_to_foo(uint8 from, foo *to)
#include <core/nterr.h>
typedef int foo;
NTSTATUS ndr_uint8_to_foo(uint8_t from, foo *to)
{
*to = from;
return NT_STATUS_OK;
}
NTSTATUS ndr_foo_to_uint8(foo from, uint8_t *to)
{
*to = from;
return NT_STATUS_OK;