From 3b17fb7dd837a1ca080e351112d186bef0a23da4 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Mon, 26 Jan 2004 04:55:09 +0000 Subject: [PATCH] use uint32_t instead of unsigned long so we're 64bit safe --- ipmitool/lib/helper.c | 5 +++-- ipmitool/lib/ipmi_chassis.c | 4 ++-- ipmitool/lib/ipmi_sel.c | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c index 8a89ea4..3301f84 100644 --- a/ipmitool/lib/helper.c +++ b/ipmitool/lib/helper.c @@ -36,15 +36,16 @@ #include #include +#include #include #include #include -unsigned long buf2long(unsigned char * buf) +uint32_t buf2long(unsigned char * buf) { - return (unsigned long)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]); + return (uint32_t)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]); } unsigned short buf2short(unsigned char * buf) diff --git a/ipmitool/lib/ipmi_chassis.c b/ipmitool/lib/ipmi_chassis.c index d2e7bbe..3427124 100644 --- a/ipmitool/lib/ipmi_chassis.c +++ b/ipmitool/lib/ipmi_chassis.c @@ -134,7 +134,7 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf) { struct ipmi_rs * rsp; struct ipmi_rq req; - unsigned long count; + uint32_t count; memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_CHASSIS; @@ -148,7 +148,7 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf) memcpy(&count, rsp->data+1, 4); printf("POH Counter : %li hours total (%li days, %li hours)\n", - count, (unsigned long)(count / 24), (unsigned long)(count % 24)); + count, (uint32_t)(count / 24), (uint32_t)(count % 24)); } static void ipmi_chassis_restart_cause(struct ipmi_intf * intf) diff --git a/ipmitool/lib/ipmi_sel.c b/ipmitool/lib/ipmi_sel.c index 1fb333c..f72e21d 100644 --- a/ipmitool/lib/ipmi_sel.c +++ b/ipmitool/lib/ipmi_sel.c @@ -228,7 +228,7 @@ ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short * next_id) } static char * -ipmi_sel_timestamp(unsigned long stamp) +ipmi_sel_timestamp(uint32_t stamp) { static unsigned char tbuf[40]; strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&stamp)); @@ -236,7 +236,7 @@ ipmi_sel_timestamp(unsigned long stamp) } static char * -ipmi_sel_timestamp_date(unsigned long stamp) +ipmi_sel_timestamp_date(uint32_t stamp) { static unsigned char tbuf[11]; strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&stamp)); @@ -244,7 +244,7 @@ ipmi_sel_timestamp_date(unsigned long stamp) } static char * -ipmi_sel_timestamp_time(unsigned long stamp) +ipmi_sel_timestamp_time(uint32_t stamp) { static unsigned char tbuf[9]; strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&stamp));