Author: tpot
Date: 2005-01-04 23:18:41 +0000 (Tue, 04 Jan 2005)
New Revision: 165

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

Log:
Revert previous commit about giving arrays of scalars their own subtree.
Generate code to display using proto_tree_add_bytes() instead.

Modified:
   trunk/ethereal/plugins/pidl/eparser.c
   trunk/ethereal/plugins/pidl/eparser.h


Changeset:
Modified: trunk/ethereal/plugins/pidl/eparser.c
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.c       2005-01-04 21:10:01 UTC (rev 
164)
+++ trunk/ethereal/plugins/pidl/eparser.c       2005-01-04 23:18:41 UTC (rev 
165)
@@ -439,33 +439,42 @@
        return NT_STATUS_OK;
 }
 
-static int hf_array_uint8 = -1;
-
 NTSTATUS ndr_pull_array_uint8(struct pidl_pull *ndr, int ndr_flags, 
-                             pidl_tree *tree, uint8_t *data, uint32_t n)
+                             pidl_tree *tree, int hf, uint8_t *data, 
+                             uint32_t n)
 {
        uint32_t i;
-       if (!(ndr_flags & NDR_SCALARS)) {
+
+       if (!(ndr_flags & NDR_SCALARS))
                return NT_STATUS_OK;
-       }
-       for (i = 0; i < n; i++) {
-               ndr_pull_uint8(ndr, tree, hf_array_uint8, data + i);
-       }
+
+       proto_tree_add_bytes(
+               tree->proto_tree, hf, ndr->tvb, ndr->offset, n, 
+               tvb_get_ptr(ndr->tvb, ndr->offset, n));
+
+       ndr->offset += n;
+
        return NT_STATUS_OK;
 }
 
-static int hf_array_uint32 = -1;
-
 NTSTATUS ndr_pull_array_uint32(struct pidl_pull *ndr, int ndr_flags, 
-                              pidl_tree *tree, uint32_t *data, uint32_t n)
+                              pidl_tree *tree, int hf, uint32_t *data, 
+                              uint32_t n)
 {
+       int len = n * sizeof(uint32_t);
        uint32_t i;
-       if (!(ndr_flags & NDR_SCALARS)) {
+
+       if (!(ndr_flags & NDR_SCALARS))
                return NT_STATUS_OK;
-       }
-       for (i = 0; i < n; i++) {
-               ndr_pull_uint32(ndr, tree, hf_array_uint8, data + i);
-       }
+
+       ndr_pull_align(ndr, sizeof(uint32_t));
+
+       proto_tree_add_bytes(
+               tree->proto_tree, hf, ndr->tvb, ndr->offset, len, 
+               tvb_get_ptr(ndr->tvb, ndr->offset, len));
+
+       ndr->offset += len;
+
        return NT_STATUS_OK;
 }
 
@@ -782,8 +791,6 @@
         { &hf_array_size, { "Array size", "eparser.array_size", FT_UINT32, 
BASE_DEC, NULL, 0x0, "Array size", HFILL }},
         { &hf_array_length, { "Array length", "eparser.array_length", 
FT_UINT32, BASE_DEC, NULL, 0x0, "Array length", HFILL }},
         { &hf_array_offset, { "Array offset", "eparser.array_offset", 
FT_UINT32, BASE_DEC, NULL, 0x0, "Array offset", HFILL }},
-        { &hf_array_uint8, { "Uint8 array value", "eparser.uint8_array", 
FT_UINT8, BASE_DEC, NULL, 0x0, "Uint8 array value", HFILL }},
-        { &hf_array_uint32, { "Uint32 array value", "eparser.uint32_array", 
FT_UINT32, BASE_DEC, NULL, 0x0, "Uint32 array value", HFILL }},
         { &hf_subcontext_size16, { "Uint16 subcontext", 
"eparser.subcontext16", FT_UINT16, BASE_DEC, NULL, 0x0, "Uint16 subcontext", 
HFILL }},
         { &hf_subcontext_size32, { "Uint32 subcontext", 
"eparser.subcontext32", FT_UINT32, BASE_DEC, NULL, 0x0, "Uint32 subcontext", 
HFILL }},
         { &hf_dom_sid2_num_auths, { "dom_sid2 num auths", "eparser.num_auths", 
FT_UINT32, BASE_DEC, NULL, 0x0, "dom_sid2 num auths", HFILL }},

Modified: trunk/ethereal/plugins/pidl/eparser.h
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.h       2005-01-04 21:10:01 UTC (rev 
164)
+++ trunk/ethereal/plugins/pidl/eparser.h       2005-01-04 23:18:41 UTC (rev 
165)
@@ -127,10 +127,8 @@
                        NTSTATUS (*pull_fn)(struct pidl_pull *, int, 
                                            pidl_tree *tree, void *));
 NTSTATUS ndr_check_array_size(struct pidl_pull *ndr, void *p, uint32_t size);
-NTSTATUS ndr_pull_array_uint8(struct pidl_pull *ndr, int ndr_flags, 
-                             pidl_tree *tree, uint8_t *data, uint32_t n);
-NTSTATUS ndr_pull_array_uint32(struct pidl_pull *ndr, int ndr_flags, 
-                              pidl_tree *tree, uint32_t *data, uint32_t n);
+NTSTATUS ndr_pull_array_uint8(struct pidl_pull *ndr, int ndr_flags, pidl_tree 
*tree, int hf, uint8_t *data, uint32_t n);
+NTSTATUS ndr_pull_array_uint32(struct pidl_pull *ndr, int ndr_flags, pidl_tree 
*tree, int hf, uint32_t *data, uint32_t n);
 NTSTATUS ndr_pull_time_t(struct pidl_pull *ndr, pidl_tree *tree, int hf, 
                         time_t *data);
 NTSTATUS ndr_pull_relative1(struct pidl_pull *ndr, const void *p, uint32_t 
rel_offset);

Reply via email to