diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-03-30 20:52:25 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-03-30 20:52:25 +0000 |
commit | e1b666b6eb73a18863c838408515510153e59a26 (patch) | |
tree | 98664247079f00089f97c4070e8702b325d307e3 /epan/dissectors | |
parent | 36abf38221dddf973a1d44af8f8824e40283dd42 (diff) |
More Win64 fixes.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27903 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-iec104.c | 37 | ||||
-rw-r--r-- | epan/dissectors/packet-imap.c | 4 |
2 files changed, 20 insertions, 21 deletions
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c index 1fc7e53cb2..8a7545d030 100644 --- a/epan/dissectors/packet-iec104.c +++ b/epan/dissectors/packet-iec104.c @@ -54,7 +54,7 @@ guint8 val_to_strlen(guint32 val, const value_string *vs) { const gchar *ret; ret = match_strval(val, vs); if (ret != NULL) - return strlen(ret); + return (guint8) strlen(ret); return 100; } @@ -434,15 +434,14 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 Bytex = 0; guint8 Ind = 0; struct asduheader * asduh; - char * res = NULL; + emem_strbuf_t * res; proto_item * it104 = NULL; proto_tree * trHead; if (!(check_col(pinfo->cinfo, COL_INFO) || tree)) return; /* Be sure that the function is only called twice */ asduh = ep_alloc(sizeof(struct asduheader)); - res = ep_alloc(MAXS); - res[0] = '\0'; + res = ep_strbuf_new_label(""); if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "104asdu"); @@ -464,32 +463,32 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr asduh->NumIx = Bytex & 0x7F; asduh->SQ = Bytex & F_SQ; /* Build common string for 'Packet List' and 'Packet Details' */ - g_snprintf(res, MAXS, "%u,%u%s%u ", asduh->AddrLow, asduh->AddrHigh, pinfo->srcport == iec104port ? "->" : "<-", asduh->OA); - g_strlcat(res, val_to_str(asduh->TypeId, asdu_types, "<TypeId=%u>"), MAXS); - g_strlcat(res, " ", MAXS); - g_strlcat(res, val_to_str(asduh->TNCause & F_CAUSE, causetx_types, " <CauseTx=%u>"), MAXS); - if (asduh->TNCause & F_NEGA) g_strlcat(res, "_NEGA", MAXS); - if (asduh->TNCause & F_TEST) g_strlcat(res, "_TEST", MAXS); + ep_strbuf_printf(res, "%u,%u%s%u ", asduh->AddrLow, asduh->AddrHigh, pinfo->srcport == iec104port ? "->" : "<-", asduh->OA); + ep_strbuf_append(res, val_to_str(asduh->TypeId, asdu_types, "<TypeId=%u>")); + ep_strbuf_append(res, " "); + ep_strbuf_append(res, val_to_str(asduh->TNCause & F_CAUSE, causetx_types, " <CauseTx=%u>")); + if (asduh->TNCause & F_NEGA) ep_strbuf_append(res, "_NEGA"); + if (asduh->TNCause & F_TEST) ep_strbuf_append(res, "_TEST"); if (asduh->TNCause & (F_TEST | F_NEGA)) { Bytex = val_to_strlen(asduh->TNCause & F_CAUSE, causetx_types); - for (Ind=Bytex; Ind< 7; Ind++) g_strlcat(res, " ", MAXS); + for (Ind=Bytex; Ind< 7; Ind++) ep_strbuf_append(res, " "); } - g_snprintf(res+strlen(res), MAXS-strlen(res), " IOA=%d", asduh->IOA); + ep_strbuf_append_printf(res, " IOA=%d", asduh->IOA); if (asduh->NumIx > 1) { - if (asduh->SQ == F_SQ) g_snprintf(res+strlen(res), MAXS-strlen(res), "-%d", asduh->IOA+ asduh->NumIx- 1); - else g_strlcat(res, ",...", MAXS); - g_snprintf(res+strlen(res), MAXS-strlen(res), " (%u)", asduh->NumIx); + if (asduh->SQ == F_SQ) ep_strbuf_append_printf(res, "-%d", asduh->IOA + asduh->NumIx - 1); + else ep_strbuf_append(res, ",..."); + ep_strbuf_append_printf(res, " (%u)", asduh->NumIx); } } else { - g_snprintf(res, MAXS, "<ERR Short Asdu, Len=%u>", Len); + ep_strbuf_printf(res, "<ERR Short Asdu, Len=%u>", Len); } - g_strlcat(res, " ", MAXS); /* We add an space to separate possible APCIs/ASDUs in the same packet */ + ep_strbuf_append(res, " "); /* We add an space to separate possible APCIs/ASDUs in the same packet */ /*** *** END: Common to 'Packet List' and 'Packet Details' *** ***/ /*** *** DISSECT 'Packet List' *** ***/ if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, res); + col_add_str(pinfo->cinfo, COL_INFO, res->str); col_set_fence(pinfo->cinfo, COL_INFO); } @@ -500,7 +499,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr it104 = proto_tree_add_item(tree, proto_iec104asdu, tvb, 0, -1, FALSE); /* 'Packet Details': ROOT ITEM */ - proto_item_append_text(it104, ": %s'%s'", res, Len >= ASDU_HEAD_LEN ? val_to_str(asduh->TypeId, asdu_lngtypes, "<Unknown TypeId>") : ""); + proto_item_append_text(it104, ": %s'%s'", res->str, Len >= ASDU_HEAD_LEN ? val_to_str(asduh->TypeId, asdu_lngtypes, "<Unknown TypeId>") : ""); /* 'Packet Details': TREE */ if (Len < ASDU_HEAD_LEN) return; diff --git a/epan/dissectors/packet-imap.c b/epan/dissectors/packet-imap.c index 64f1146ef2..aa8b1752b3 100644 --- a/epan/dissectors/packet-imap.c +++ b/epan/dissectors/packet-imap.c @@ -135,8 +135,8 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tokenlen, "Response Tag: %s", format_text(line, tokenlen)); } - offset += next_token - line; - linelen -= next_token - line; + offset += (gint) (next_token - line); + linelen -= (int) (next_token - line); line = next_token; } |