Use tvb_new_subset_remaining() rather than tvb_new_subset();

Do minir whitespace cleanup.

svn path=/trunk/; revision=41366
This commit is contained in:
Bill Meier 2012-03-06 03:20:17 +00:00
parent 594b358011
commit d3cfffd72a
2 changed files with 101 additions and 101 deletions

View File

@ -143,7 +143,7 @@ dissect_papi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
proto_item *ti; proto_item *ti;
proto_tree *papi_tree; proto_tree *papi_tree;
guint offset = 0; guint offset = 0;
tvbuff_t *next_tvb; tvbuff_t *next_tvb;
@ -204,8 +204,8 @@ dissect_papi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = dissect_papi_debug(tvb, offset, papi_tree); offset = dissect_papi_debug(tvb, offset, papi_tree);
} }
next_tvb = tvb_new_subset(tvb, offset, -1, -1); next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle,next_tvb, pinfo, tree); call_dissector(data_handle,next_tvb, pinfo, tree);
} }
return(TRUE); return(TRUE);

View File

@ -554,7 +554,7 @@ value_string_ext asp_error_vals_ext = VALUE_STRING_EXT_INIT(asp_error_vals);
static int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree, static int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree,
int hf_index) int hf_index)
{ {
int len; int len;
char *tmp; char *tmp;
len = tvb_get_guint8(tvb, offset); len = tvb_get_guint8(tvb, offset);
@ -570,7 +570,7 @@ static int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree,
* code, we could perhaps avoid allocating and freeing * code, we could perhaps avoid allocating and freeing
* this string buffer. * this string buffer.
*/ */
tmp = (gchar*)tvb_get_ephemeral_string(tvb, offset, len); tmp = (gchar*)tvb_get_ephemeral_string(tvb, offset, len);
item = proto_tree_add_string(tree, hf_index, tvb, offset-1, len+1, tmp); item = proto_tree_add_string(tree, hf_index, tvb, offset-1, len+1, tmp);
subtree = proto_item_add_subtree(item, ett_pstring); subtree = proto_item_add_subtree(item, ett_pstring);
@ -587,7 +587,7 @@ static void
dissect_rtmp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_rtmp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *rtmp_tree; proto_tree *rtmp_tree;
proto_item *ti; proto_item *ti;
guint8 function; guint8 function;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -609,11 +609,11 @@ static void
dissect_rtmp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_rtmp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *rtmp_tree; proto_tree *rtmp_tree;
proto_item *ti; proto_item *ti;
int offset = 0; int offset = 0;
guint16 net; guint16 net;
guint8 nodelen,nodelen_bits; guint8 nodelen,nodelen_bits;
guint16 node; /* might be more than 8 bits */ guint16 node; /* might be more than 8 bits */
int i; int i;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -694,16 +694,16 @@ dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *nbp_tree; proto_tree *nbp_tree;
proto_tree *nbp_info_tree; proto_tree *nbp_info_tree;
proto_item *ti, *info_item; proto_item *ti, *info_item;
int offset = 0; int offset = 0;
guint8 info; guint8 info;
guint op, count; guint op, count;
guint i; guint i;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
info = tvb_get_guint8(tvb, offset); info = tvb_get_guint8(tvb, offset);
op = info >> 4; op = info >> 4;
count = info & 0x0F; count = info & 0x0F;
col_add_fstr(pinfo->cinfo, COL_INFO, "Op: %s Count: %u", col_add_fstr(pinfo->cinfo, COL_INFO, "Op: %s Count: %u",
@ -724,7 +724,7 @@ dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree_add_item(nbp_tree, hf_nbp_tid, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(nbp_tree, hf_nbp_tid, tvb, offset+1, 1, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
for (i=0; i<count; i++) { for (i = 0; i < count; i++) {
proto_tree *node_item,*node_tree; proto_tree *node_item,*node_tree;
int soffset = offset; int soffset = offset;
@ -758,26 +758,26 @@ dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
*/ */
static void static void
dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *atp_tree = NULL; proto_tree *atp_tree = NULL;
proto_item *ti; proto_item *ti;
proto_tree *atp_info_tree; proto_tree *atp_info_tree;
proto_item *info_item; proto_item *info_item;
int offset = 0; int offset = 0;
guint8 ctrlinfo; guint8 ctrlinfo;
guint8 frag_number = 0; guint8 frag_number = 0;
guint op; guint op;
guint16 tid; guint16 tid;
guint8 query; guint8 query;
struct aspinfo aspinfo; struct aspinfo aspinfo;
tvbuff_t *new_tvb = NULL; tvbuff_t *new_tvb = NULL;
gboolean save_fragmented; gboolean save_fragmented;
gboolean more_fragment = FALSE; gboolean more_fragment = FALSE;
int len; int len;
guint8 bitmap; guint8 bitmap;
guint8 nbe = 0; guint8 nbe = 0;
guint8 t = 0; guint8 t = 0;
conversation_t *conversation; conversation_t *conversation;
asp_request_val *request_val = NULL; asp_request_val *request_val = NULL;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATP");
@ -905,7 +905,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
} }
else { else {
/* full packet */ /* full packet */
new_tvb = tvb_new_subset(tvb, ATP_HDRSIZE -1, -1,- 1); new_tvb = tvb_new_subset_remaining(tvb, ATP_HDRSIZE -1 );
} }
if (new_tvb) { if (new_tvb) {
@ -962,27 +962,27 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
static gint static gint
dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
{ {
proto_tree *sub_tree; proto_tree *sub_tree;
proto_item *ti; proto_item *ti;
guint16 ofs; guint16 ofs;
guint16 flag; guint16 flag;
guint16 machine_ofs; guint16 machine_ofs;
guint16 sign_ofs = 0; guint16 sign_ofs = 0;
guint16 adr_ofs = 0; guint16 adr_ofs = 0;
guint16 dir_ofs = 0; guint16 dir_ofs = 0;
guint16 utf_ofs = 0; guint16 utf_ofs = 0;
guint8 nbe; guint8 nbe;
guint len; guint len;
guint i; guint i;
proto_tree *adr_tree; proto_tree *adr_tree;
char *tmp; char *tmp;
guint16 net; guint16 net;
guint8 node; guint8 node;
guint16 port; guint16 port;
guint16 ulen; guint16 ulen;
if (!tree) if (!tree)
return offset; return offset;
@ -1180,12 +1180,12 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
static int static int
dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
int offset = 0; int offset = 0;
guint8 fn; guint8 fn;
guint8 connID; guint8 connID;
proto_tree *pap_tree = NULL; proto_tree *pap_tree = NULL;
proto_item *ti; proto_item *ti;
int len; int len;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PAP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "PAP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -1270,11 +1270,11 @@ dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static struct aspinfo * static struct aspinfo *
get_transaction(tvbuff_t *tvb, packet_info *pinfo) get_transaction(tvbuff_t *tvb, packet_info *pinfo)
{ {
struct aspinfo *aspinfo = pinfo->private_data; struct aspinfo *aspinfo = pinfo->private_data;
conversation_t *conversation; conversation_t *conversation;
asp_request_key request_key, *new_request_key; asp_request_key request_key, *new_request_key;
asp_request_val *request_val; asp_request_val *request_val;
guint8 fn; guint8 fn;
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
pinfo->srcport, pinfo->destport, 0); pinfo->srcport, pinfo->destport, 0);
@ -1313,11 +1313,11 @@ static int
dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
struct aspinfo *aspinfo; struct aspinfo *aspinfo;
int offset = 0; int offset = 0;
proto_tree *asp_tree = NULL; proto_tree *asp_tree = NULL;
proto_item *ti; proto_item *ti;
guint8 fn; guint8 fn;
int len; int len;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -1456,13 +1456,13 @@ static void
dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
struct aspinfo *aspinfo; struct aspinfo *aspinfo;
int offset = 0; int offset = 0;
proto_tree *zip_tree; proto_tree *zip_tree;
proto_tree *sub_tree; proto_tree *sub_tree;
proto_item *ti; proto_item *ti;
guint8 fn; guint8 fn;
guint16 count; guint16 count;
guint8 len; guint8 len;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZIP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZIP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -1515,7 +1515,7 @@ dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(zip_tree, hf_zip_count, tvb, offset, 2, ENC_BIG_ENDIAN); ti = proto_tree_add_item(zip_tree, hf_zip_count, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
sub_tree = proto_item_add_subtree(ti, ett_zip_zones_list); sub_tree = proto_item_add_subtree(ti, ett_zip_zones_list);
for (i= 0; i < count; i++) { for (i = 0; i < count; i++) {
len = tvb_get_guint8(tvb, offset); len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(sub_tree, hf_zip_zone_name, tvb, offset, 1,ENC_ASCII|ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_zip_zone_name, tvb, offset, 1,ENC_ASCII|ENC_BIG_ENDIAN);
offset += len +1; offset += len +1;
@ -1530,16 +1530,16 @@ dissect_ddp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
proto_tree *zip_tree = NULL; proto_tree *zip_tree = NULL;
proto_item *ti; proto_item *ti;
guint8 fn; guint8 fn;
guint8 len; guint8 len;
gint offset = 0; gint offset = 0;
proto_tree *flag_tree; proto_tree *flag_tree;
proto_tree *sub_tree; proto_tree *sub_tree;
proto_tree *net_tree; proto_tree *net_tree;
guint8 flag; guint8 flag;
guint16 net; guint16 net;
guint i; guint i;
guint count; guint count;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZIP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZIP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -1560,10 +1560,10 @@ dissect_ddp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (fn) { switch (fn) {
case 1: /* Query */ case 1: /* Query */
count = tvb_get_guint8(tvb, offset); count = tvb_get_guint8(tvb, offset);
ti = proto_tree_add_item(zip_tree, hf_zip_network_count, tvb, offset, 1, ENC_BIG_ENDIAN); ti = proto_tree_add_item(zip_tree, hf_zip_network_count, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++; offset++;
sub_tree = proto_item_add_subtree(ti, ett_zip_network_list); sub_tree = proto_item_add_subtree(ti, ett_zip_network_list);
for (i= 0; i < count; i++) { for (i = 0; i < count; i++) {
proto_tree_add_item(sub_tree, hf_zip_network, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_zip_network, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
} }
@ -1599,7 +1599,7 @@ dissect_ddp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(zip_tree, hf_zip_network_count, tvb, offset, 1, ENC_BIG_ENDIAN); ti = proto_tree_add_item(zip_tree, hf_zip_network_count, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++; offset++;
sub_tree = proto_item_add_subtree(ti, ett_zip_network_list); sub_tree = proto_item_add_subtree(ti, ett_zip_network_list);
for (i= 0; i < count; i++) { for (i = 0; i < count; i++) {
net = tvb_get_ntohs(tvb, offset); net = tvb_get_ntohs(tvb, offset);
ti = proto_tree_add_text(sub_tree, tvb, offset , 2, "Zone for network : %u", net); ti = proto_tree_add_text(sub_tree, tvb, offset , 2, "Zone for network : %u", net);
net_tree = proto_item_add_subtree(ti, ett_zip_network_list); net_tree = proto_item_add_subtree(ti, ett_zip_network_list);
@ -1656,14 +1656,14 @@ static void
dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode, dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
guint8 snode, proto_tree *tree) guint8 snode, proto_tree *tree)
{ {
guint16 len; guint16 len;
guint8 dport; guint8 dport;
guint8 sport; guint8 sport;
guint8 type; guint8 type;
proto_tree *ddp_tree = NULL; proto_tree *ddp_tree = NULL;
proto_item *ti, *hidden_item; proto_item *ti, *hidden_item;
static struct atalk_ddp_addr src, dst; static struct atalk_ddp_addr src, dst;
tvbuff_t *new_tvb; tvbuff_t *new_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -1719,11 +1719,11 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
static void static void
dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
e_ddp ddp; e_ddp ddp;
proto_tree *ddp_tree; proto_tree *ddp_tree;
proto_item *ti, *hidden_item; proto_item *ti, *hidden_item;
static struct atalk_ddp_addr src, dst; static struct atalk_ddp_addr src, dst;
tvbuff_t *new_tvb; tvbuff_t *new_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -2457,7 +2457,7 @@ proto_reg_handoff_atalk(void)
pap_handle = new_create_dissector_handle(dissect_pap, proto_pap); pap_handle = new_create_dissector_handle(dissect_pap, proto_pap);
rtmp_request_handle = create_dissector_handle(dissect_rtmp_request, proto_rtmp); rtmp_request_handle = create_dissector_handle(dissect_rtmp_request, proto_rtmp);
rtmp_data_handle = create_dissector_handle(dissect_rtmp_data, proto_rtmp); rtmp_data_handle = create_dissector_handle(dissect_rtmp_data, proto_rtmp);
dissector_add_uint("ddp.type", DDP_RTMPREQ, rtmp_request_handle); dissector_add_uint("ddp.type", DDP_RTMPREQ, rtmp_request_handle);
dissector_add_uint("ddp.type", DDP_RTMPDATA, rtmp_data_handle); dissector_add_uint("ddp.type", DDP_RTMPDATA, rtmp_data_handle);
@ -2472,7 +2472,7 @@ proto_reg_handoff_atalk(void)
register_init_routine( atp_init); register_init_routine( atp_init);
register_init_routine( &asp_reinit); register_init_routine( &asp_reinit);
afp_handle = find_dissector("afp"); afp_handle = find_dissector("afp");
data_handle = find_dissector("data"); data_handle = find_dissector("data");
} }