use uint32_t instead of unsigned long so we're 64bit safe

This commit is contained in:
Duncan Laurie 2004-01-26 04:55:09 +00:00
parent 84cd061ad4
commit 3b17fb7dd8
3 changed files with 8 additions and 7 deletions

View File

@ -36,15 +36,16 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <signal.h>
#include <ipmitool/helper.h>
#include <string.h>
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)

View File

@ -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)

View File

@ -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));