From e427f58622e3d88c59953d6c1fb583acfb046213 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 25 May 2005 13:50:27 +0000 Subject: r6973: Merge new version of pidl into the main SAMBA_4_0 branch. The main difference in this new version is the extra data structure generated between the IDL data structure and the NDR parser: IDL -> NDR -> { ndr_parser, ndr_header, eparser, etc } This makes the ndr_parser.pm internals much more sane. Other changes include: - Remove unnecessary calls with NDR_BUFFERS (for example, GUID doesn't have any buffers, just scalars) as well as some (unnecessary) nested setting of flags. - Parse array loops in the C code rather then calling ndr_pull_array(). This allows us to have, for example, arrays of pointers or arrays of pointers to arrays, etc.. - Use if() {} rather then if () goto foo; everywhere - NDR_IN no longer implies LIBNDR_FLAG_REF_ALLOC - By default, top level pointers are now "ref" (as is the default in most other IDL compilers). This can be overridden using the default_pointer_top() property. - initial work on new ethereal parser generators by Alan DeKok and me - pidl now writes errors in the standard format used by compilers, which is parsable by most editors - ability to warn about the fact that pidl extension(s) have been used, useful for making sure IDL files work with other IDL compilers. oh, and there's probably some other things I can't think of right now.. (This used to be commit 13cf227615f6b9e0e5fa62e59197024410254f01) --- source4/librpc/ndr/ndr.c | 120 ++--------------------------------------------- 1 file changed, 3 insertions(+), 117 deletions(-) (limited to 'source4/librpc/ndr/ndr.c') diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 8296726866..dfd21018d2 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -182,120 +182,6 @@ NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t size) return NT_STATUS_OK; } -/* This function does not appear to be used */ - -#if 0 - -/* - set the push offset to 'ofs' -*/ -static NTSTATUS ndr_push_set_offset(struct ndr_push *ndr, uint32_t ofs) -{ - NDR_CHECK(ndr_push_expand(ndr, ofs)); - ndr->offset = ofs; - return NT_STATUS_OK; -} - -#endif - -/* - push a generic array -*/ -NTSTATUS ndr_push_array(struct ndr_push *ndr, int ndr_flags, void *base, - size_t elsize, uint32_t count, - NTSTATUS (*push_fn)(struct ndr_push *, int, void *)) -{ - int i; - char *p = base; - if (!(ndr_flags & NDR_SCALARS)) goto buffers; - for (i=0;idata += 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 -*/ -void ndr_print_array(struct ndr_print *ndr, const char *name, void *base, - size_t elsize, uint32_t count, - void (*print_fn)(struct ndr_print *, const char *, void *)) -{ - int i; - char *p = base; - ndr->print(ndr, "%s: ARRAY(%d)", name, count); - ndr->depth++; - for (i=0;idepth--; -} - - - void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) { va_list ap; @@ -390,7 +276,7 @@ static NTSTATUS ndr_map_error(enum ndr_err_code err) break; } - /* we should all error codes to different status codes */ + /* we should map all error codes to different status codes */ return NT_STATUS_INVALID_PARAMETER; } @@ -623,7 +509,7 @@ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) { uint32_t stored; - NDR_CHECK(ndr_token_retrieve(&ndr->array_size_list, p, &stored)); + stored = ndr_token_peek(&ndr->array_size_list, p); if (stored != size) { return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size - got %u expected %u\n", @@ -661,7 +547,7 @@ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) { uint32_t stored; - NDR_CHECK(ndr_token_retrieve(&ndr->array_length_list, p, &stored)); + stored = ndr_token_peek(&ndr->array_length_list, p); if (stored != length) { return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array length - got %u expected %u\n", -- cgit