msgpack: fix some compiler warnings.

../epan/dissectors/packet-msgpack.c: In function ‘dissect_msgpack_string’:
../epan/dissectors/packet-msgpack.c:239:9: warning: pointer targets in assignment from ‘guint8 *’ {aka ‘unsigned char *’} to ‘char *’ differ in signedness [-Wpointer-sign]
  239 |  lvalue = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset + 1 + lensize, len, ENC_NA);
      |         ^
../epan/dissectors/packet-msgpack.c: In function ‘dissect_msgpack_ext’:
../epan/dissectors/packet-msgpack.c:305:9: warning: pointer targets in assignment from ‘const guint8 *’ {aka ‘const unsigned char *’} to ‘const char *’ differ in signedness [-Wpointer-sign]
  305 |   start = tvb_get_ptr(tvb, *offset, bytes);
      |         ^
../epan/dissectors/packet-msgpack.c:306:77: warning: pointer targets in passing argument 6 of ‘proto_tree_add_bytes’ differ in signedness [-Wpointer-sign]
  306 |   proto_tree_add_bytes(ext_tree, hf_msgpack_ext_bytes, tvb, *offset, bytes, start);
      |                                                                             ^~~~~
      |                                                                             |
      |                                                                             const char *
In file included from ../epan/packet.h:14,
                 from ../epan/dissectors/packet-msgpack.c:18:
../epan/proto.h:1536:1: note: expected ‘const guint8 *’ {aka ‘const unsigned char *’} but argument is of type ‘const char *’
 1536 | proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
      | ^~~~~~~~~~~~~~~~~~~~
../epan/dissectors/packet-msgpack.c:308:37: warning: pointer targets in passing argument 2 of ‘bytes_to_hexstr’ differ in signedness [-Wpointer-sign]
  308 |    *value = bytes_to_hexstr(*value, start, bytes);
      |                                     ^~~~~
      |                                     |
      |                                     const char *
In file included from ../epan/dissectors/packet-msgpack.c:20:
../epan/to_str.h:202:21: note: expected ‘const guint8 *’ {aka ‘const unsigned char *’} but argument is of type ‘const char *’
  202 | WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const guint8 *ad, guint32 len);
This commit is contained in:
Dario Lombardo 2020-12-27 18:33:49 +01:00 committed by AndersBroman
parent a5822f6792
commit 428ecf2013
1 changed files with 3 additions and 3 deletions

View File

@ -236,7 +236,7 @@ static void dissect_msgpack_string(tvbuff_t* tvb, proto_tree* tree, int type, vo
lensize = 4;
}
lvalue = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset + 1 + lensize, len, ENC_NA);
lvalue = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, *offset + 1 + lensize, len, ENC_NA);
label = (data ? (char*)data : "MsgPack String");
ti = proto_tree_add_string_format(tree, hf_msgpack_string, tvb, *offset, 1 + lensize + len, lvalue, "%s: %s", label, lvalue);
@ -287,7 +287,7 @@ static void dissect_msgpack_ext(tvbuff_t* tvb, proto_tree* tree, int type, void*
{
char* label;
int bytes;
const char* start;
const guint8* start;
proto_tree* ext_tree;
guint offset_start = *offset;
@ -302,7 +302,7 @@ static void dissect_msgpack_ext(tvbuff_t* tvb, proto_tree* tree, int type, void*
proto_tree_add_item(ext_tree, hf_msgpack_ext_type, tvb, *offset, 1, ENC_NA);
*offset += 1;
bytes = 1 << (type - 0xd4);
start = tvb_get_ptr(tvb, *offset, bytes);
start = (const guint8*)tvb_get_ptr(tvb, *offset, bytes);
proto_tree_add_bytes(ext_tree, hf_msgpack_ext_bytes, tvb, *offset, bytes, start);
if (value)
*value = bytes_to_hexstr(*value, start, bytes);