svn commit: samba r3036 - in branches/SAMBA_4_0/source/librpc/ndr: .

tpot at samba.org tpot at samba.org
Mon Oct 18 12:18:55 GMT 2004


Author: tpot
Date: 2004-10-18 12:18:54 +0000 (Mon, 18 Oct 2004)
New Revision: 3036

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/librpc/ndr&rev=3036&nolog=1

Log:
Add function to pull an array of structures.  Abstracts away the
individual routines in ndr_spoolss_buf.c.

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2004-10-18 12:06:21 UTC (rev 3035)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2004-10-18 12:18:54 UTC (rev 3036)
@@ -249,7 +249,28 @@
 	return NT_STATUS_OK;
 }
 
+/*
+  pull a constant size array of structures
+*/
+NTSTATUS ndr_pull_struct_array(struct ndr_pull *ndr, uint32_t count,
+			       size_t elsize, void **info,
+			       NTSTATUS (*pull_fn)(struct ndr_pull *, int, void *))
+{
+	int i;
+	char *base;
 
+	NDR_ALLOC_N_SIZE(ndr, *info, count, elsize);
+	base = (char *)*info;
+
+	for (i = 0; i < count; i++) {
+		ndr->data += ndr->offset;
+		ndr->offset = 0;
+		NDR_CHECK(pull_fn(ndr, NDR_SCALARS|NDR_BUFFERS, &base[count * elsize]));
+	}
+
+	return NT_STATUS_OK;
+}
+
 /*
   print a generic array
 */



More information about the samba-cvs mailing list