Wireshark-dev: Re: [Wireshark-dev] packet-rlc.c problems
From: Gisle Vanem <gvanem@xxxxxxxxxxxx>
Date: Wed, 16 Nov 2011 09:47:35 +0100
"Chris Maynard" <Chris.Maynard@xxxxxxxxx> wrote:

Should be fixed in r39865.  Hopefully the names I've chosen are sensible enough.

Ok, good. Similar problem with packet-spice.c;
 epan/dissectors/packet-spice.c(588) : error C2371: 'POINT' : redefinition; different basic types
       g:\VC_2010\SDK\include\windef.h(343) : see declaration of 'POINT'.

So I suggest we rename 'POINT*' to 'SPICE_POINT*'. Attached 'svn diff packet-spice.c'.

--gv
Index: packet-spice.c
===================================================================
--- packet-spice.c	(revision 39879)
+++ packet-spice.c	(working copy)
@@ -585,16 +585,16 @@
typedef struct {
    gint32 x;
    gint32 y;
-} POINT;
+} SPICE_POINT;

-#define sizeof_POINT 8
+#define sizeof_SPICE_POINT 8

typedef struct {
    gint16 x;
    gint16 y;
-} POINT16;
+} SPICE_POINT16;

-#define sizeof_POINT16 4
+#define sizeof_SPICE_POINT16 4

#define    SPICE_BRUSH_TYPE_NONE 0
#define    SPICE_BRUSH_TYPE_SOLID 1
@@ -609,7 +609,7 @@

typedef struct {
    guint64 image;
-    POINT position;
+    SPICE_POINT position;
} Pattern;

#define sizeof_Pattern 16
@@ -631,7 +631,7 @@

typedef struct {
    guint8 flags;
-    POINT position;
+    SPICE_POINT position;
    guint32 bitmap;
} Mask;

@@ -1532,18 +1532,18 @@
    return type;
}

-static POINT
+static SPICE_POINT
dissect_POINT(tvbuff_t *tvb, proto_tree *tree, const guint32 offset)
{
    proto_item *ti=NULL;
    proto_tree *point_tree;
-    POINT point;
+    SPICE_POINT point;

    point.x = tvb_get_letohl(tvb, offset);
    point.y = tvb_get_letohl(tvb, offset + 4);

    if (tree) {
-        ti = proto_tree_add_text(tree, tvb, offset, sizeof_POINT, "POINT (%u, %u)", point.x, point.y);
+        ti = proto_tree_add_text(tree, tvb, offset, sizeof_SPICE_POINT, "POINT (%u, %u)", point.x, point.y);
        point_tree = proto_item_add_subtree(ti, ett_point);

        proto_tree_add_text(point_tree, tvb, offset,     4, "x: %u", point.x);
@@ -1553,18 +1553,18 @@
    return point;
}

-static POINT16
+static SPICE_POINT16
dissect_POINT16(tvbuff_t *tvb, proto_tree *tree, const guint32 offset)
{
    proto_item *ti=NULL;
    proto_tree *point16_tree;
-    POINT16 point16;
+    SPICE_POINT16 point16;

    point16.x = tvb_get_letohs(tvb, offset);
    point16.y = tvb_get_letohs(tvb, offset + 2);

    if (tree) {
-        ti = proto_tree_add_text(tree, tvb, offset, sizeof_POINT16, "POINT16 (%u, %u)", point16.x, point16.y);
+        ti = proto_tree_add_text(tree, tvb, offset, sizeof_SPICE_POINT16, "POINT16 (%u, %u)", point16.x, point16.y);
        point16_tree = proto_item_add_subtree(ti, ett_point16);

        proto_tree_add_text(point16_tree, tvb, offset,     2, "x: %u", point16.x);
@@ -1587,7 +1587,7 @@
    proto_tree_add_item(Mask_tree, hf_Mask_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset += 1;
    dissect_POINT(tvb, Mask_tree, offset);
-    offset += sizeof_POINT;
+    offset += sizeof_SPICE_POINT;
    bitmap = tvb_get_letohl(tvb, offset);
    proto_tree_add_item(Mask_tree, hf_Mask_bitmap, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
@@ -1938,7 +1938,7 @@
            displayBaseLen = dissect_DisplayBase(tvb, tree, offset);
            offset += displayBaseLen;
            dissect_POINT(tvb, tree, offset);
-            offset += sizeof_POINT;
+            offset += sizeof_SPICE_POINT;
            break;
        case SPICE_DISPLAY_DRAW_WHITENESS:
            displayBaseLen = dissect_DisplayBase(tvb, tree, offset);
@@ -2153,7 +2153,7 @@
    switch(message_type) {
        case SPICE_CURSOR_INIT:
            dissect_POINT16(tvb, tree, offset);
-            offset += sizeof_POINT16;
+            offset += sizeof_SPICE_POINT16;
            proto_tree_add_item(tree, hf_cursor_trail_len, tvb, offset, 2, ENC_LITTLE_ENDIAN);
            offset += 2;
            proto_tree_add_item(tree, hf_cursor_trail_freq, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -2168,14 +2168,14 @@
            break;
        case SPICE_CURSOR_SET:
            dissect_POINT16(tvb, tree, offset);
-            offset += sizeof_POINT16;
+            offset += sizeof_SPICE_POINT16;
            offset +=1; /*TODO flags */
            RedCursorSize = dissect_RedCursor(tvb, tree, offset);
            offset += RedCursorSize;
            break;
        case SPICE_CURSOR_MOVE:
            dissect_POINT16(tvb, tree, offset);
-            offset += sizeof_POINT16;
+            offset += sizeof_SPICE_POINT16;
            break;
        case SPICE_CURSOR_HIDE:
            proto_tree_add_text(tree, tvb, offset, 0, "CURSOR_HIDE message");
@@ -2430,20 +2430,20 @@
            offset += 2;
            break;
        case SPICEC_INPUTS_MOUSE_POSITION:
-            ti = proto_tree_add_text(tree, tvb, offset, sizeof_POINT + 3, "Client MOUSE_POSITION message");
+            ti = proto_tree_add_text(tree, tvb, offset, sizeof_SPICE_POINT + 3, "Client MOUSE_POSITION message");
            inputs_tree = proto_item_add_subtree(ti, ett_inputs_client);
            dissect_POINT(tvb, inputs_tree, offset);
-            offset += sizeof_POINT;
+            offset += sizeof_SPICE_POINT;
            proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 2, ENC_LITTLE_ENDIAN);
            offset += 2;
            proto_tree_add_item(inputs_tree, hf_mouse_display_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
            offset += 1;
            break;
        case SPICEC_INPUTS_MOUSE_MOTION:
-            ti = proto_tree_add_text(tree, tvb, offset, sizeof_POINT + 4, "Client MOUSE_MOTION message");
+            ti = proto_tree_add_text(tree, tvb, offset, sizeof_SPICE_POINT + 4, "Client MOUSE_MOTION message");
            inputs_tree = proto_item_add_subtree(ti, ett_inputs_client);
            dissect_POINT(tvb, inputs_tree, offset);
-            offset += sizeof_POINT;
+            offset += sizeof_SPICE_POINT;
            proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            offset += 4;
            break;
@@ -2984,7 +2984,7 @@
            } else {
                pdu_len += 4;
            }
- +
            if (avail < pdu_len) { /* didn't get the complete PDU, returning */
               pinfo->desegment_offset = offset;
               pinfo->desegment_len = pdu_len - avail;
@@ -3239,7 +3239,7 @@
          { "Authentication selected by client", "spice.auth_select_client",
            FT_UINT32, BASE_DEC, VALS(spice_auth_select_vs), 0x0,
            NULL, HFILL }
- }, + },
        { &hf_common_cap_auth,
          { "Authentication capabilitity", "spice.common_cap_auth",
            FT_UINT32, BASE_HEX_DEC, 0, 0,