From ecf2c1effb778a95fd863a5e87ec7e378d228b57 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 7 Feb 2007 19:03:19 +0000 Subject: r21222: Merge a couple of pidl fixes: * Pidl will now warn when trying to use pointers as integers in expressions. * "subcontext()" is now marked as deprecated. The alternatives, transmit_as() / represent_as() should be available soon. * More tests. * Remove some unused code in smbtorture. (This used to be commit 37c0da541e3962164d5af3e3c9560803a733f3b7) --- source4/pidl/tests/ndr_represent.pl | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) mode change 100644 => 100755 source4/pidl/tests/ndr_represent.pl (limited to 'source4/pidl/tests/ndr_represent.pl') diff --git a/source4/pidl/tests/ndr_represent.pl b/source4/pidl/tests/ndr_represent.pl old mode 100644 new mode 100755 index 880ecba827..52cd06f817 --- a/source4/pidl/tests/ndr_represent.pl +++ b/source4/pidl/tests/ndr_represent.pl @@ -3,7 +3,7 @@ # (C) 2006 Jelmer Vernooij. Published under the GNU GPL use strict; -use Test::More tests => 1 * 8; +use Test::More tests => 2 * 8; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_samba4_ndr); @@ -40,3 +40,37 @@ NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to) } ' ); + +test_samba4_ndr('transmit_as-simple', +' + void bla([in,transmit_as(uint32)] uint8 x); +', +' + uint8_t expected[] = { 0x0D }; + DATA_BLOB in_blob = { expected, 1 }; + struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL); + struct bla r; + + if (NT_STATUS_IS_ERR(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r))) + return 1; + + if (r.in.x != 13) + return 2; +', +' +#include + +NTSTATUS ndr_uint8_to_uint32(uint8_t from, uint32_t *to) +{ + *to = from; + return NT_STATUS_OK; +} + +NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to) +{ + *to = from; + return NT_STATUS_OK; +} +' +); + -- cgit