From 6febe27586426ac556b56b491a93fed4c852680a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 9 May 2016 15:54:27 -0700 Subject: Give the time_[m]secs_to routines names that begin with "[un]signed_". Indicate whether they take a signed time delta or an unsigned time delta. Export unsigned_time_secs_to_str() while we're at it. Change-Id: I0fbe87f1825efa886364caa61a3358b79d285947 Reviewed-on: https://code.wireshark.org/review/15324 Reviewed-by: Guy Harris --- epan/dissectors/asn1/mms/mms.cnf | 2 +- epan/dissectors/packet-agentx.c | 2 +- epan/dissectors/packet-bootp.c | 4 ++-- epan/dissectors/packet-dmp.c | 16 ++++++++-------- epan/dissectors/packet-dns.c | 10 +++++----- epan/dissectors/packet-icmp.c | 8 ++++---- epan/dissectors/packet-ipmi.c | 2 +- epan/dissectors/packet-mms.c | 2 +- epan/dissectors/packet-nbt.c | 2 +- epan/dissectors/packet-pktc.c | 2 +- epan/dissectors/packet-selfm.c | 4 ++-- epan/dissectors/packet-smb-browse.c | 6 +++--- epan/dissectors/packet-smb-pipe.c | 6 +++--- epan/dissectors/packet-smb.c | 2 +- epan/dissectors/packet-who.c | 2 +- epan/dissectors/packet-zbee-zcl-general.c | 4 ++-- epan/to_str.c | 30 +++++++++++++++--------------- epan/to_str.h | 6 +++--- 18 files changed, 55 insertions(+), 55 deletions(-) diff --git a/epan/dissectors/asn1/mms/mms.cnf b/epan/dissectors/asn1/mms/mms.cnf index b348c6ad6b..61692c3eb2 100644 --- a/epan/dissectors/asn1/mms/mms.cnf +++ b/epan/dissectors/asn1/mms/mms.cnf @@ -57,7 +57,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE if(len == 4) { milliseconds = tvb_get_ntohl(tvb, offset); - ptime = time_msecs_to_str(wmem_packet_scope(), milliseconds); + ptime = signed_time_msecs_to_str(wmem_packet_scope(), milliseconds); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-agentx.c b/epan/dissectors/packet-agentx.c index 74133efc6e..db4473f5ae 100644 --- a/epan/dissectors/packet-agentx.c +++ b/epan/dissectors/packet-agentx.c @@ -472,7 +472,7 @@ dissect_response_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint NORLEL(flags, r_uptime, tvb, offset); proto_tree_add_uint_format(subtree, hf_resp_uptime, tvb, offset, 4, r_uptime, - "sysUptime: %s", time_msecs_to_str(wmem_packet_scope(), r_uptime)); + "sysUptime: %s", signed_time_msecs_to_str(wmem_packet_scope(), r_uptime)); proto_tree_add_item(subtree, hf_resp_error, tvb, offset + 4, 2, encoding); proto_tree_add_item(subtree, hf_resp_index, tvb, offset + 6, 2, encoding); offset += 8; diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 3ac40fc68c..6d639ab8ab 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -1635,7 +1635,7 @@ bootp_handle_basic_types(packet_info *pinfo, proto_tree *tree, proto_item *item, if (hf != NULL) { time_s_secs = (gint32) tvb_get_ntohl(tvb, offset); proto_tree_add_int_format_value(tree, *hf, - tvb, offset, 4, time_s_secs, "(%ds) %s", time_s_secs, time_secs_to_str(wmem_packet_scope(), time_s_secs)); + tvb, offset, 4, time_s_secs, "(%ds) %s", time_s_secs, signed_time_secs_to_str(wmem_packet_scope(), time_s_secs)); } else if (hf_default->time_in_s_secs != NULL) proto_tree_add_item(tree, *hf_default->time_in_s_secs, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -1653,7 +1653,7 @@ bootp_handle_basic_types(packet_info *pinfo, proto_tree *tree, proto_item *item, time_u_secs = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(tree, *hf, tvb, offset, 4, time_u_secs, "(%us) %s", time_u_secs, - ((time_u_secs == 0xffffffff) ? "infinity" : time_secs_to_str_unsigned(wmem_packet_scope(), time_u_secs))); + ((time_u_secs == 0xffffffff) ? "infinity" : unsigned_time_secs_to_str(wmem_packet_scope(), time_u_secs))); } else if (hf_default->time_in_u_secs != NULL) proto_tree_add_item(tree, *hf_default->time_in_u_secs, tvb, offset, 4, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 0678f38528..a9dea7554b 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -2992,7 +2992,7 @@ static gint dissect_dmp_envelope (tvbuff_t *tvb, packet_info *pinfo, if (secs == DMP_TIME_RESERVED) { proto_item_append_text (tf, "Reserved (0x%2.2x)", time_diff); } else { - proto_item_append_text (tf, "%s", time_secs_to_str(wmem_packet_scope(), secs)); + proto_item_append_text (tf, "%s", signed_time_secs_to_str(wmem_packet_scope(), secs)); } offset += 1; } @@ -3313,9 +3313,9 @@ static gint dissect_dmp_report (tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text (tf, "Reserved (0x%2.2x)", report); proto_item_append_text (ei, " (Reserved)"); } else { - proto_item_append_text (tf, "%s (%s)", time_secs_to_str(wmem_packet_scope(), secs), + proto_item_append_text (tf, "%s (%s)", signed_time_secs_to_str(wmem_packet_scope(), secs), abs_time_secs_to_str (wmem_packet_scope(), dmp.subm_time - secs, ABSOLUTE_TIME_LOCAL, TRUE)); - proto_item_append_text (ei, " (%s from submission time)", time_secs_to_str(wmem_packet_scope(), secs)); + proto_item_append_text (ei, " (%s from submission time)", signed_time_secs_to_str(wmem_packet_scope(), secs)); } } else { dmp.ndr = TRUE; @@ -3427,9 +3427,9 @@ static gint dissect_dmp_notification (tvbuff_t *tvb, packet_info *pinfo _U_, proto_item_append_text (tf, "Reserved (0x%2.2x)", rec_time); proto_item_append_text (ei, " (Reserved)"); } else { - proto_item_append_text (tf, "%s (%s)", time_secs_to_str(wmem_packet_scope(), secs), + proto_item_append_text (tf, "%s (%s)", signed_time_secs_to_str(wmem_packet_scope(), secs), abs_time_secs_to_str (wmem_packet_scope(), dmp.subm_time - secs, ABSOLUTE_TIME_LOCAL, TRUE)); - proto_item_append_text (ei, " (%s from submission time)", time_secs_to_str(wmem_packet_scope(), secs)); + proto_item_append_text (ei, " (%s from submission time)", signed_time_secs_to_str(wmem_packet_scope(), secs)); } offset += 1; @@ -3837,9 +3837,9 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text (tf, "Reserved (0x%2.2x)", exp_time); proto_item_append_text (ei, " (Reserved)"); } else { - proto_item_append_text (tf, "%s (%s)", time_secs_to_str(wmem_packet_scope(), secs), + proto_item_append_text (tf, "%s (%s)", signed_time_secs_to_str(wmem_packet_scope(), secs), abs_time_secs_to_str (wmem_packet_scope(), dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL, TRUE)); - proto_item_append_text (ei, " (%s from submission time)", time_secs_to_str(wmem_packet_scope(), secs)); + proto_item_append_text (ei, " (%s from submission time)", signed_time_secs_to_str(wmem_packet_scope(), secs)); } offset += 1; } @@ -3861,7 +3861,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, dtg_sign.false_string, abs_time_secs_to_str (wmem_packet_scope(), dmp.subm_time, ABSOLUTE_TIME_LOCAL, TRUE)); } else { - proto_item_append_text (tf, "%s in the %s (%s)", time_secs_to_str(wmem_packet_scope(), secs), + proto_item_append_text (tf, "%s in the %s (%s)", signed_time_secs_to_str(wmem_packet_scope(), secs), (dtg & 0x80) ? dtg_sign.true_string : dtg_sign.false_string, (dtg & 0x80) ? abs_time_secs_to_str (wmem_packet_scope(), dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL, TRUE) : diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 4e99c5e4d4..7d83d71a40 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -1917,19 +1917,19 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, cur_offset += 4; ti_soa = proto_tree_add_item(rr_tree, hf_dns_soa_refresh_interval, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti_soa, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); + proto_item_append_text(ti_soa, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); cur_offset += 4; ti_soa = proto_tree_add_item(rr_tree, hf_dns_soa_retry_interval, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti_soa, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); + proto_item_append_text(ti_soa, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); cur_offset += 4; ti_soa = proto_tree_add_item(rr_tree, hf_dns_soa_expire_limit, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti_soa, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); + proto_item_append_text(ti_soa, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); cur_offset += 4; ti_soa = proto_tree_add_item(rr_tree, hf_dns_soa_minimum_ttl, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti_soa, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); + proto_item_append_text(ti_soa, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); } break; @@ -2972,7 +2972,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, rr_len -= 1; ti = proto_tree_add_item(rr_tree, hf_dns_rrsig_original_ttl, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); + proto_item_append_text(ti, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, cur_offset))); cur_offset += 4; rr_len -= 4; diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 526c06e485..e679266ae8 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -1366,7 +1366,7 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) proto_tree_add_item_ret_uint(icmp_tree, hf_icmp_num_addrs, tvb, 4, 1, ENC_BIG_ENDIAN, &num_addrs); proto_tree_add_item_ret_uint(icmp_tree, hf_icmp_addr_entry_size, tvb, 5, 1, ENC_BIG_ENDIAN, &addr_entry_size); ti = proto_tree_add_item(icmp_tree, hf_icmp_lifetime, tvb, 6, 2, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%s)", time_secs_to_str(wmem_packet_scope(), tvb_get_ntohs(tvb, 6))); + proto_item_append_text(ti, " (%s)", signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohs(tvb, 6))); break; case ICMP_PARAMPROB: @@ -1576,13 +1576,13 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) orig_ts = get_best_guess_mstimeofday(tvb, 8, frame_ts); ti = proto_tree_add_item(icmp_tree, hf_icmp_originate_timestamp, tvb, 8, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%s after midnight UTC)", time_msecs_to_str(wmem_packet_scope(), orig_ts)); + proto_item_append_text(ti, " (%s after midnight UTC)", signed_time_msecs_to_str(wmem_packet_scope(), orig_ts)); ti = proto_tree_add_item(icmp_tree, hf_icmp_receive_timestamp, tvb, 12, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%s after midnight UTC)", time_msecs_to_str(wmem_packet_scope(), get_best_guess_mstimeofday(tvb, 12, frame_ts))); + proto_item_append_text(ti, " (%s after midnight UTC)", signed_time_msecs_to_str(wmem_packet_scope(), get_best_guess_mstimeofday(tvb, 12, frame_ts))); ti = proto_tree_add_item(icmp_tree, hf_icmp_transmit_timestamp, tvb, 16, 4, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%s after midnight UTC)", time_msecs_to_str(wmem_packet_scope(), get_best_guess_mstimeofday(tvb, 16, frame_ts))); + proto_item_append_text(ti, " (%s after midnight UTC)", signed_time_msecs_to_str(wmem_packet_scope(), get_best_guess_mstimeofday(tvb, 16, frame_ts))); } break; diff --git a/epan/dissectors/packet-ipmi.c b/epan/dissectors/packet-ipmi.c index 5991bfb08c..efbf588741 100644 --- a/epan/dissectors/packet-ipmi.c +++ b/epan/dissectors/packet-ipmi.c @@ -1065,7 +1065,7 @@ ipmi_add_timestamp(proto_tree *tree, gint hf, tvbuff_t *tvb, guint offset) } else if (ts <= 0x20000000) { proto_tree_add_uint_format_value(tree, hf, tvb, offset, 4, ts, "%s since SEL device's initialization", - time_secs_to_str_unsigned(wmem_packet_scope(), ts)); + unsigned_time_secs_to_str(wmem_packet_scope(), ts)); } else { proto_tree_add_uint_format_value(tree, hf, tvb, offset, 4, ts, "%s", abs_time_secs_to_str(wmem_packet_scope(), ts, ABSOLUTE_TIME_UTC, TRUE)); diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index 7731de3b89..2e37c02486 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1845,7 +1845,7 @@ dissect_mms_TimeOfDay(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ if(len == 4) { milliseconds = tvb_get_ntohl(tvb, offset); - ptime = time_msecs_to_str(wmem_packet_scope(), milliseconds); + ptime = signed_time_msecs_to_str(wmem_packet_scope(), milliseconds); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c index ef3d7beb3a..b99b03600d 100644 --- a/epan/dissectors/packet-nbt.c +++ b/epan/dissectors/packet-nbt.c @@ -326,7 +326,7 @@ add_rr_to_tree(proto_tree *rr_tree, tvbuff_t *tvb, int offset, proto_tree_add_uint(rr_tree, hf_nbns_class, tvb, offset, 2, class_val); offset += 2; proto_tree_add_uint_format_value(rr_tree, hf_nbns_ttl, tvb, offset, 4, ttl, "%s", - time_secs_to_str(wmem_packet_scope(), ttl)); + signed_time_secs_to_str(wmem_packet_scope(), ttl)); offset += 4; proto_tree_add_uint(rr_tree, hf_nbns_data_length, tvb, offset, 2, data_len); } diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index 26550e4b9c..c1c162ad7d 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -384,7 +384,7 @@ dissect_pktc_ap_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int o proto_tree_add_uint_format(tree, hf_pktc_sec_param_lifetime, tvb, offset, 4, tvb_get_ntohl(tvb, offset), "%s: %s", proto_registrar_get_name(hf_pktc_sec_param_lifetime), - time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, offset))); + signed_time_secs_to_str(wmem_packet_scope(), tvb_get_ntohl(tvb, offset))); offset+=4; /* grace period */ diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c index 6b1a74fec9..e91f0013ac 100644 --- a/epan/dissectors/packet-selfm.c +++ b/epan/dissectors/packet-selfm.c @@ -2036,7 +2036,7 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o proto_tree_add_item(fastmsg_tree, hf_selfm_fastmsg_unsresp_doy, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(fastmsg_tree, hf_selfm_fastmsg_unsresp_year, tvb, offset+2, 2, ENC_BIG_ENDIAN); proto_tree_add_uint_format_value(fastmsg_tree, hf_selfm_fastmsg_unsresp_todms, tvb, offset+4, 4, - tod_ms, "%s", time_msecs_to_str(wmem_packet_scope(), tod_ms)); + tod_ms, "%s", signed_time_msecs_to_str(wmem_packet_scope(), tod_ms)); offset += 8; /* Build element tree */ @@ -2077,7 +2077,7 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o proto_tree_add_item(fastmsg_element_tree, hf_selfm_fastmsg_unsresp_elmt_idx, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(fastmsg_element_tree, hf_selfm_fastmsg_unsresp_elmt_ts_ofs, tvb, offset+1, 3, ENC_BIG_ENDIAN); proto_tree_add_uint_format_value(fastmsg_element_tree, hf_selfm_fastmsg_unsresp_elmt_ts_ofs_decoded, tvb, offset+1, 3, - tod_ms + (elmt_ts_offset/1000), "%s", time_msecs_to_str(wmem_packet_scope(), tod_ms + (elmt_ts_offset/1000))); + tod_ms + (elmt_ts_offset/1000), "%s", signed_time_msecs_to_str(wmem_packet_scope(), tod_ms + (elmt_ts_offset/1000))); proto_tree_add_uint(fastmsg_element_tree, hf_selfm_fastmsg_unsresp_elmt_status, tvb, elmt_status32_ofs, 4, elmt_status); offset += 4; diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c index 732c5b5744..b727098b7c 100644 --- a/epan/dissectors/packet-smb-browse.c +++ b/epan/dissectors/packet-smb-browse.c @@ -566,7 +566,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr proto_tree_add_uint_format_value(tree, hf_periodicity, tvb, offset, 4, periodicity, "%s", - time_msecs_to_str(wmem_packet_scope(), periodicity)); + signed_time_msecs_to_str(wmem_packet_scope(), periodicity)); offset += 4; /* server name */ @@ -663,7 +663,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr proto_tree_add_uint_format_value(tree, hf_server_uptime, tvb, offset, 4, uptime, "%s", - time_msecs_to_str(wmem_packet_scope(), uptime)); + signed_time_msecs_to_str(wmem_packet_scope(), uptime)); offset += 4; /* next 4 bytes must be zero */ @@ -810,7 +810,7 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr proto_tree_add_uint_format_value(tree, hf_periodicity, tvb, offset, 2, periodicity, "%s", - time_msecs_to_str(wmem_packet_scope(), periodicity)); + signed_time_msecs_to_str(wmem_packet_scope(), periodicity)); offset += 2; /* server name */ diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c index 00ddd244f6..2b7f298d88 100644 --- a/epan/dissectors/packet-smb-pipe.c +++ b/epan/dissectors/packet-smb-pipe.c @@ -509,7 +509,7 @@ add_reltime(tvbuff_t *tvb, int offset, int count _U_, packet_info *pinfo _U_, nstime.nsecs = 0; proto_tree_add_time_format_value(tree, hf_index, tvb, offset, 4, &nstime, "%s", - time_secs_to_str(wmem_packet_scope(), (gint32) nstime.secs)); + signed_time_secs_to_str(wmem_packet_scope(), (gint32) nstime.secs)); offset += 4; return offset; } @@ -651,11 +651,11 @@ add_tzoffset(tvbuff_t *tvb, int offset, int count _U_, packet_info *pinfo _U_, if (tzoffset < 0) { proto_tree_add_int_format_value(tree, hf_tzoffset, tvb, offset, 2, tzoffset, "%s east of UTC", - time_secs_to_str(wmem_packet_scope(), -tzoffset*60)); + signed_time_secs_to_str(wmem_packet_scope(), -tzoffset*60)); } else if (tzoffset > 0) { proto_tree_add_int_format_value(tree, hf_tzoffset, tvb, offset, 2, tzoffset, "%s west of UTC", - time_secs_to_str(wmem_packet_scope(), tzoffset*60)); + signed_time_secs_to_str(wmem_packet_scope(), tzoffset*60)); } else { proto_tree_add_int_format_value(tree, hf_tzoffset, tvb, offset, 2, tzoffset, "at UTC"); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index d0d35ad3cf..54759c8fbb 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -4836,7 +4836,7 @@ smbext20_timeout_msecs_to_str(gint32 timeout) return buf; } - return time_msecs_to_str(wmem_packet_scope(), timeout); + return signed_time_msecs_to_str(wmem_packet_scope(), timeout); } static int diff --git a/epan/dissectors/packet-who.c b/epan/dissectors/packet-who.c index 54d55b4867..3f2753a81c 100644 --- a/epan/dissectors/packet-who.c +++ b/epan/dissectors/packet-who.c @@ -203,7 +203,7 @@ dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree) idle_secs = tvb_get_ntohl(tvb, line_offset); proto_tree_add_uint_format(whoent_tree, hf_who_idle, tvb, line_offset, 4, idle_secs, "Idle: %s", - time_secs_to_str(wmem_packet_scope(), idle_secs)); + signed_time_secs_to_str(wmem_packet_scope(), idle_secs)); line_offset += 4; whoent_num++; diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c index b5a20febbd..f1dfe8e76b 100644 --- a/epan/dissectors/packet-zbee-zcl-general.c +++ b/epan/dissectors/packet-zbee-zcl-general.c @@ -9308,7 +9308,7 @@ decode_zcl_ota_req_time(gchar *s, guint32 value) } else { /* offset from now */ - gchar *tmp = time_secs_to_str(NULL, value); + gchar *tmp = signed_time_secs_to_str(NULL, value); g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp); wmem_free(NULL, tmp); } @@ -9334,7 +9334,7 @@ decode_zcl_ota_upgr_time(gchar *s, guint32 value) } else { /* offset from now */ - gchar *tmp = time_secs_to_str(NULL, value); + gchar *tmp = signed_time_secs_to_str(NULL, value); g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp); wmem_free(NULL, tmp); } diff --git a/epan/to_str.c b/epan/to_str.c index b89553dca1..e70547c0f2 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -733,7 +733,7 @@ display_signed_time(gchar *buf, int buflen, const gint32 sec, gint32 frac, * if false. */ static void -time_secs_to_str_buf_unsigned(guint32 time_val, const guint32 frac, +unsigned_time_secs_to_str_buf(guint32 time_val, const guint32 frac, const gboolean is_nsecs, wmem_strbuf_t *buf) { int hours, mins, secs; @@ -770,7 +770,7 @@ time_secs_to_str_buf_unsigned(guint32 time_val, const guint32 frac, } gchar * -time_secs_to_str_unsigned(wmem_allocator_t *scope, const guint32 time_val) +unsigned_time_secs_to_str(wmem_allocator_t *scope, const guint32 time_val) { wmem_strbuf_t *buf; @@ -780,7 +780,7 @@ time_secs_to_str_unsigned(wmem_allocator_t *scope, const guint32 time_val) buf = wmem_strbuf_sized_new(scope, TIME_SECS_LEN+1, TIME_SECS_LEN+1); - time_secs_to_str_buf_unsigned(time_val, 0, FALSE, buf); + unsigned_time_secs_to_str_buf(time_val, 0, FALSE, buf); return wmem_strbuf_finalize(buf); } @@ -793,8 +793,8 @@ time_secs_to_str_unsigned(wmem_allocator_t *scope, const guint32 time_val) * if false. */ static void -time_secs_to_str_buf(gint32 time_val, const guint32 frac, const gboolean is_nsecs, - wmem_strbuf_t *buf) +signed_time_secs_to_str_buf(gint32 time_val, const guint32 frac, + const gboolean is_nsecs, wmem_strbuf_t *buf) { if(time_val < 0){ wmem_strbuf_append_printf(buf, "-"); @@ -803,29 +803,29 @@ time_secs_to_str_buf(gint32 time_val, const guint32 frac, const gboolean is_nsec * You can't fit time_val's absolute value into * a 32-bit signed integer. Just directly * pass G_MAXUINT32, which is its absolute - * value, directly to time_secs_to_str_buf_unsigned(). + * value, directly to unsigned_time_secs_to_str_buf(). * * (XXX - does ISO C guarantee that -(-2^n), * when calculated and cast to an n-bit unsigned * integer type, will have the value 2^n?) */ - time_secs_to_str_buf_unsigned(G_MAXUINT32, frac, + unsigned_time_secs_to_str_buf(G_MAXUINT32, frac, is_nsecs, buf); } else { /* * We now know -secs will fit into a guint32; * negate it and pass that to - * time_secs_to_str_buf_unsigned(). + * unsigned_time_secs_to_str_buf(). */ - time_secs_to_str_buf_unsigned(-time_val, frac, + unsigned_time_secs_to_str_buf(-time_val, frac, is_nsecs, buf); } } else - time_secs_to_str_buf_unsigned(time_val, frac, is_nsecs, buf); + unsigned_time_secs_to_str_buf(time_val, frac, is_nsecs, buf); } gchar * -time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val) +signed_time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val) { wmem_strbuf_t *buf; @@ -835,7 +835,7 @@ time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val) buf = wmem_strbuf_sized_new(scope, TIME_SECS_LEN+1, TIME_SECS_LEN+1); - time_secs_to_str_buf(time_val, 0, FALSE, buf); + signed_time_secs_to_str_buf(time_val, 0, FALSE, buf); return wmem_strbuf_finalize(buf); } @@ -845,7 +845,7 @@ time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val) * hours, minutes, and seconds, and put the result into a buffer. */ gchar * -time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val) +signed_time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val) { wmem_strbuf_t *buf; int msecs; @@ -867,7 +867,7 @@ time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val) time_val /= 1000; } - time_secs_to_str_buf(time_val, msecs, FALSE, buf); + signed_time_secs_to_str_buf(time_val, msecs, FALSE, buf); return wmem_strbuf_finalize(buf); } @@ -906,7 +906,7 @@ rel_time_to_str(wmem_allocator_t *scope, const nstime_t *rel_time) time_val = (gint) -rel_time->secs; } - time_secs_to_str_buf(time_val, nsec, TRUE, buf); + signed_time_secs_to_str_buf(time_val, nsec, TRUE, buf); return wmem_strbuf_finalize(buf); } diff --git a/epan/to_str.h b/epan/to_str.h index 687395a8dd..36849e0b84 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -104,9 +104,9 @@ WS_DLL_PUBLIC void display_epoch_time(gchar *, int, const time_t, gint32, const WS_DLL_PUBLIC void display_signed_time(gchar *, int, const gint32, gint32, const to_str_time_res_t); -WS_DLL_PUBLIC gchar* time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val); -gchar* time_secs_to_str_unsigned(wmem_allocator_t *scope, const guint32); -WS_DLL_PUBLIC gchar* time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val); +WS_DLL_PUBLIC gchar* signed_time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val); +WS_DLL_PUBLIC gchar* unsigned_time_secs_to_str(wmem_allocator_t *scope, const guint32); +WS_DLL_PUBLIC gchar* signed_time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val); extern void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len); extern void guint64_to_str_buf(guint64 u, gchar *buf, int buf_len); -- cgit v1.2.3