svn commit: samba r5363 - in branches/SAMBA_4_0/source: build/pidl librpc/ndr

jelmer at samba.org jelmer at samba.org
Sun Feb 13 00:07:18 GMT 2005


Author: jelmer
Date: 2005-02-13 00:07:17 +0000 (Sun, 13 Feb 2005)
New Revision: 5363

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5363

Log:
- ndr_%_ptr -> ndr_%_unique_ptr
- ndr_%_relative% -> ndr_%_relative_ptr%
- Change pointer_default() default to "unique" 
  (DCE uses "ptr" as default, MIDL doesn't follow the standard and uses "unique")

Modified:
   branches/SAMBA_4_0/source/build/pidl/ndr.pm
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/ndr.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-02-12 23:03:26 UTC (rev 5362)
+++ branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-02-13 00:07:17 UTC (rev 5363)
@@ -535,11 +535,11 @@
 	}
 
 	if (util::has_property($e, "relative")) {
-		pidl "\tNDR_CHECK(ndr_push_relative1(ndr, $var_prefix$e->{NAME}));\n";
+		pidl "\tNDR_CHECK(ndr_push_relative_ptr1(ndr, $var_prefix$e->{NAME}));\n";
 	} elsif (util::is_inline_array($e)) {
 		ParseArrayPush($e, "r->", "NDR_SCALARS");
 	} elsif (need_wire_pointer($e)) {
-		pidl "\tNDR_CHECK(ndr_push_ptr(ndr, $var_prefix$e->{NAME}));\n";
+		pidl "\tNDR_CHECK(ndr_push_unique_ptr(ndr, $var_prefix$e->{NAME}));\n";
 	} elsif (need_alloc($e)) {
 		# no scalar component
 	} elsif (my $switch = util::has_property($e, "switch_is")) {
@@ -701,11 +701,11 @@
 	if (util::is_inline_array($e)) {
 		ParseArrayPull($e, "r->", "NDR_SCALARS");
 	} elsif (need_wire_pointer($e)) {
-		pidl "\tNDR_CHECK(ndr_pull_ptr(ndr, &_ptr_$e->{NAME}));\n";
+		pidl "\tNDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_$e->{NAME}));\n";
 		pidl "\tif (_ptr_$e->{NAME}) {\n";
 		pidl "\t\tNDR_ALLOC(ndr, $var_prefix$e->{NAME});\n";
 		if (util::has_property($e, "relative")) {
-			pidl "\t\tNDR_CHECK(ndr_pull_relative1(ndr, $var_prefix$e->{NAME}, _ptr_$e->{NAME}));\n";
+			pidl "\t\tNDR_CHECK(ndr_pull_relative_ptr1(ndr, $var_prefix$e->{NAME}, _ptr_$e->{NAME}));\n";
 		}
 		pidl "\t} else {\n";
 		pidl "\t\t$var_prefix$e->{NAME} = NULL;\n";
@@ -747,7 +747,7 @@
 	if (need_wire_pointer($e)) {
 		pidl "\tif ($var_prefix$e->{NAME}) {\n";
 		if (util::has_property($e, "relative")) {
-			pidl "\t\tNDR_CHECK(ndr_push_relative2(ndr, $var_prefix$e->{NAME}));\n";
+			pidl "\t\tNDR_CHECK(ndr_push_relative_ptr2(ndr, $var_prefix$e->{NAME}));\n";
 		}
 	}
 	    
@@ -825,7 +825,7 @@
 		if (util::has_property($e, "relative")) {
 			pidl "\t\tstruct ndr_pull_save _relative_save;\n";
 			pidl "\t\tndr_pull_save(ndr, &_relative_save);\n";
-			pidl "\t\tNDR_CHECK(ndr_pull_relative2(ndr, $var_prefix$e->{NAME}));\n";
+			pidl "\t\tNDR_CHECK(ndr_pull_relative_ptr2(ndr, $var_prefix$e->{NAME}));\n";
 		}
 	}
 	    
@@ -1585,7 +1585,7 @@
 
 	if (util::array_size($e)) {
 		if (need_wire_pointer($e)) {
-			pidl "\tNDR_CHECK(ndr_push_ptr(ndr, r->$inout.$e->{NAME}));\n";
+			pidl "\tNDR_CHECK(ndr_push_unique_ptr(ndr, r->$inout.$e->{NAME}));\n";
 			pidl "\tif (r->$inout.$e->{NAME}) {\n";
 			ParseArrayPush($e, "r->$inout.", "NDR_SCALARS|NDR_BUFFERS");
 			pidl "\t}\n";
@@ -1644,7 +1644,7 @@
 
 	if (util::array_size($e)) {
 		if (need_wire_pointer($e)) {
-			pidl "\tNDR_CHECK(ndr_pull_ptr(ndr, &_ptr_$e->{NAME}));\n";
+			pidl "\tNDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_$e->{NAME}));\n";
 			pidl "\tr->$inout.$e->{NAME} = NULL;\n";
 			pidl "\tif (_ptr_$e->{NAME}) {\n";
 		} elsif ($inout eq "out" && util::has_property($e, "ref")) {
@@ -1936,7 +1936,9 @@
 	my $x = shift;
 
 	if (not util::has_property($x, "pointer_default")) {
-		$x->{PROPERTIES}->{pointer_default} = "ptr";
+		# MIDL defaults to "ptr" in DCE compatible mode (/osf)
+		# and "unique" in Microsoft Extensions mode (default)
+		$x->{PROPERTIES}->{pointer_default} = "unique";
 	}
 
 	foreach my $d (@{$x->{DATA}}) {
@@ -1947,7 +1949,9 @@
 			}
 		}
 		if ($d->{TYPE} eq "FUNCTION") {
-			CheckPointerTypes($d, $x->{PROPERTIES}->{pointer_default});
+			CheckPointerTypes($d, 
+				$x->{PROPERTIES}->{pointer_default}  # MIDL defaults to "ref"
+			);
 		}
 	}
 }

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-02-12 23:03:26 UTC (rev 5362)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-02-13 00:07:17 UTC (rev 5363)
@@ -719,7 +719,7 @@
   pull a relative object - stage1
   called during SCALARS processing
 */
-NTSTATUS ndr_pull_relative1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset)
+NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset)
 {
 	if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) {
 		return ndr_token_store(ndr, &ndr->relative_list, p, 
@@ -733,7 +733,7 @@
   pull a relative object - stage2
   called during BUFFERS processing
 */
-NTSTATUS ndr_pull_relative2(struct ndr_pull *ndr, const void *p)
+NTSTATUS ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p)
 {
 	uint32_t rel_offset;
 	NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset));
@@ -744,7 +744,7 @@
   push a relative object - stage1
   this is called during SCALARS processing
 */
-NTSTATUS ndr_push_relative1(struct ndr_push *ndr, const void *p)
+NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p)
 {
 	if (p == NULL) {
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
@@ -759,7 +759,7 @@
   push a relative object - stage2
   this is called during buffers processing
 */
-NTSTATUS ndr_push_relative2(struct ndr_push *ndr, const void *p)
+NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p)
 {
 	struct ndr_push_save save;
 	if (p == NULL) {

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2005-02-12 23:03:26 UTC (rev 5362)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2005-02-13 00:07:17 UTC (rev 5363)
@@ -108,7 +108,7 @@
 /*
   parse a pointer referent identifier
 */
-NTSTATUS ndr_pull_ptr(struct ndr_pull *ndr, uint32_t *v)
+NTSTATUS ndr_pull_unique_ptr(struct ndr_pull *ndr, uint32_t *v)
 {
 	NTSTATUS status;
 	status = ndr_pull_uint32(ndr, NDR_SCALARS, v);
@@ -482,7 +482,7 @@
 /*
   push a 1 if a pointer is non-NULL, otherwise 0
 */
-NTSTATUS ndr_push_ptr(struct ndr_push *ndr, const void *p)
+NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
 {
 	uint32_t ptr = 0;
 	if (p) {



More information about the samba-cvs mailing list