Changed ushort, uchar and sbyte types to intN_t

This commit is contained in:
Ianos Gnatiuc
2005-10-21 19:48:21 +00:00
parent 0c7d1f668c
commit f559b54f6e
10 changed files with 99 additions and 104 deletions

View File

@@ -346,8 +346,8 @@ int SMBArea::load_hdr(gmsg* __msg, smbmsg_t *smsg)
int SMBArea::load_msg(gmsg* msg)
{
smbmsg_t smsg;
ushort xlat;
uchar *inbuf;
uint16_t xlat;
uint8_t *inbuf;
int32_t outlen;
char buf[512];
int i;
@@ -446,11 +446,11 @@ common:
if(xlat != XLAT_NONE) /* no other translations currently supported */
continue;
if(lzh) {
inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length);
inbuf = (uint8_t *)throw_xmalloc(smsg.dfield[i].length);
fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp);
outlen = *(int32_t *)inbuf;
msg->txt = (char *)throw_realloc(msg->txt, txt_len+outlen);
lzh_decode(inbuf, smsg.dfield[i].length - l, (uchar *)(msg->txt+txt_len-1));
lzh_decode(inbuf, smsg.dfield[i].length - l, (uint8_t *)(msg->txt+txt_len-1));
throw_xfree(inbuf);
}
else if(l < smsg.dfield[i].length) {
@@ -604,12 +604,12 @@ void SMBArea::save_hdr(int mode, gmsg* msg)
smsg.hfield_dat = NULL;
}
ushort net = NET_FIDO;
uint16_t net = NET_FIDO;
destaddr.zone = msg->dest.zone;
destaddr.net = msg->dest.net;
destaddr.node = msg->dest.node;
destaddr.point = msg->dest.point;
smb_hfield(&smsg, RECIPIENTNETTYPE, sizeof(ushort), &net);
smb_hfield(&smsg, RECIPIENTNETTYPE, sizeof(uint16_t), &net);
smb_hfield(&smsg, RECIPIENTNETADDR, sizeof(fidoaddr_t), &destaddr);
smb_hfield(&smsg, SENDER, strlen(msg->by), msg->by);
@@ -753,12 +753,12 @@ void SMBArea::save_hdr(int mode, gmsg* msg)
if(smsg.hdr.offset != (uint32_t)-1L) {
fseek(data->sdt_fp, smsg.hdr.offset, SEEK_SET);
*(ushort *)(sbody-2) = XLAT_NONE;
*(uint16_t *)(sbody-2) = XLAT_NONE;
l = ftell(data->sdt_fp);
fwrite(sbody-2, SDT_BLOCK_LEN, smb_datblocks(bodylen), data->sdt_fp);
if(taillen) {
fseek(data->sdt_fp, l+bodylen+2, SEEK_SET);
*(ushort *)(stail-2) = XLAT_NONE;
*(uint16_t *)(stail-2) = XLAT_NONE;
fwrite(stail-2, SDT_BLOCK_LEN, smb_datblocks(taillen), data->sdt_fp);
}
fflush(data->sdt_fp);
@@ -895,7 +895,7 @@ void SMBArea::update_timesread(gmsg* msg)
// ------------------------------------------------------------------
static char *binstr(char *buf, ushort length)
static char *binstr(char *buf, uint16_t length)
{
static char str[128];
char tmp[128];
@@ -1036,9 +1036,9 @@ Line* SMBArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head)
HexDump16(buf+7, _ptr, sizeof(msghdr_t)%16, HEX_DUMP2);
line = AddLine(line, buf);
ushort xlat;
uchar *inbuf;
int32_t outlen;
uint16_t xlat;
uint8_t *inbuf;
int32_t outlen;
bool lzh;
bool tail = true;
uint32_t l;
@@ -1071,11 +1071,11 @@ common:
if(xlat != XLAT_NONE) /* no other translations currently supported */
continue;
if(lzh) {
inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length);
inbuf = (uint8_t *)throw_xmalloc(smsg.dfield[i].length);
fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp);
outlen = *(int32_t *)inbuf;
msg->txt = (char *)throw_realloc(msg->txt, txt_len+outlen);
lzh_decode(inbuf, smsg.dfield[i].length - l, (uchar *)(msg->txt+txt_len-1));
lzh_decode(inbuf, smsg.dfield[i].length - l, (uint8_t *)(msg->txt+txt_len-1));
throw_xfree(inbuf);
}
else if(l < smsg.dfield[i].length) {

View File

@@ -96,27 +96,27 @@
struct XbbsHdr {
char majorversion; // Minor revision number of this message style
char minorversion; // Minor revision number of this message style
ushort structlen; // The length of this data structure
uint16_t structlen; // The length of this data structure
char from[60]; // Who the message is from
char to[60]; // Who the message is to
char subj[70]; // The subject of the message
char date[35]; // Date the message was written
char indate[4]; // Import date
uint32_t msgnum; // Current message number
uint32_t timesread; // Number of times the message has been read
time32_t timerecv; // Time user received this message
uint32_t length; // Length of message stored in .Text Data file
int32_t start; // Pointer to starting byte in .Text Data file
uint32_t extra1; // Extra space // Was going to be for reply
uint32_t extra2; // Extra space // linking instead came up with
uint32_t extra3; // Extra space // a better method
Addr origaddr; // Messages origin
Addr destaddr; // Messages destination
ushort cost; // Cost to send this message
ushort fflags; // Fidonet related flags
ushort xflags; // XBBS related flags
uint32_t iflags; // Internet related flags
uint32_t oflags; // Other network related flags
uint32_t msgnum; // Current message number
uint32_t timesread; // Number of times the message has been read
time32_t timerecv; // Time user received this message
uint32_t length; // Length of message stored in .Text Data file
int32_t start; // Pointer to starting byte in .Text Data file
uint32_t extra1; // Extra space // Was going to be for reply
uint32_t extra2; // Extra space // linking instead came up with
uint32_t extra3; // Extra space // a better method
Addr origaddr; // Messages origin
Addr destaddr; // Messages destination
uint16_t cost; // Cost to send this message
uint16_t fflags; // Fidonet related flags
uint16_t xflags; // XBBS related flags
uint32_t iflags; // Internet related flags
uint32_t oflags; // Other network related flags
};
@@ -124,13 +124,13 @@ struct XbbsHdr {
// AdeptXBBS Message Index (*.Index)
struct XbbsIdx {
ushort to; // Checksum of the to field
ushort from; // Checksum of the from field
ushort subj; // Checksum of the subject field
uint32_t msgidcrc; // MSGID 32-bit CRC of address field (starting value 0xFFFFFFFF)
uint32_t msgidserialno; // MSGID Serial number field
uint32_t replycrc; // REPLY 32-bit CRC of address field (starting value 0xFFFFFFFF)
uint32_t replyserialno; // REPLY Serial number field
uint16_t to; // Checksum of the to field
uint16_t from; // Checksum of the from field
uint16_t subj; // Checksum of the subject field
uint32_t msgidcrc; // MSGID 32-bit CRC of address field (starting value 0xFFFFFFFF)
uint32_t msgidserialno; // MSGID Serial number field
uint32_t replycrc; // REPLY 32-bit CRC of address field (starting value 0xFFFFFFFF)
uint32_t replyserialno; // REPLY Serial number field
};

View File

@@ -101,14 +101,14 @@ void XbbsArea::unlock_file(int handle, int32_t position, int32_t length) {
// ------------------------------------------------------------------
ushort XbbsCheckSum(char* str) {
uint16_t XbbsCheckSum(char* str) {
ushort checksum = 0;
uint16_t checksum = 0;
while(*str) {
checksum ^= (ushort)toupper(*str++);
checksum ^= (uint16_t)toupper(*str++);
if(checksum & 1)
checksum = (ushort)((checksum >> 1) ^ 0xA000);
checksum = (uint16_t)((checksum >> 1) ^ 0xA000);
else
checksum >>= 1;
}
@@ -152,35 +152,35 @@ void XbbsArea::save_message(int __mode, gmsg* __msg, XbbsHdr& __hdr) {
__hdr.timerecv = __msg->received;
__hdr.origaddr = __msg->oorig;
__hdr.destaddr = __msg->odest;
__hdr.cost = (ushort)__msg->cost;
__hdr.cost = (uint16_t)__msg->cost;
// Transfer attributes
__hdr.fflags |= (ushort)(__msg->attr.pvt() ? FFLAGS_MSGPRIVATE : 0);
__hdr.fflags |= (ushort)(__msg->attr.cra() ? FFLAGS_MSGCRASH : 0);
__hdr.fflags |= (ushort)(__msg->attr.rcv() ? FFLAGS_MSGREAD : 0);
__hdr.fflags |= (ushort)(__msg->attr.snt() ? FFLAGS_MSGSENT : 0);
__hdr.fflags |= (ushort)(__msg->attr.att() ? FFLAGS_MSGFILE : 0);
__hdr.fflags |= (ushort)(__msg->attr.trs() ? FFLAGS_MSGFWD : 0);
__hdr.fflags |= (ushort)(__msg->attr.orp() ? FFLAGS_MSGORPHAN : 0);
__hdr.fflags |= (ushort)(__msg->attr.k_s() ? FFLAGS_MSGKILL : 0);
__hdr.fflags |= (ushort)(__msg->attr.loc() ? FFLAGS_MSGLOCAL : 0);
__hdr.fflags |= (ushort)(__msg->attr.rsv() ? FFLAGS_MSGXX2 : 0);
__hdr.fflags |= (ushort)(__msg->attr.frq() ? FFLAGS_MSGFRQ : 0);
__hdr.fflags |= (ushort)(__msg->attr.rrq() ? FFLAGS_MSGRRQ : 0);
__hdr.fflags |= (ushort)(__msg->attr.rrc() ? FFLAGS_MSGCPT : 0);
__hdr.fflags |= (ushort)(__msg->attr.arq() ? FFLAGS_MSGARQ : 0);
__hdr.fflags |= (ushort)(__msg->attr.urq() ? FFLAGS_MSGURQ : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.pvt() ? FFLAGS_MSGPRIVATE : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.cra() ? FFLAGS_MSGCRASH : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.rcv() ? FFLAGS_MSGREAD : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.snt() ? FFLAGS_MSGSENT : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.att() ? FFLAGS_MSGFILE : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.trs() ? FFLAGS_MSGFWD : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.orp() ? FFLAGS_MSGORPHAN : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.k_s() ? FFLAGS_MSGKILL : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.loc() ? FFLAGS_MSGLOCAL : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.rsv() ? FFLAGS_MSGXX2 : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.frq() ? FFLAGS_MSGFRQ : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.rrq() ? FFLAGS_MSGRRQ : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.rrc() ? FFLAGS_MSGCPT : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.arq() ? FFLAGS_MSGARQ : 0);
__hdr.fflags |= (uint16_t)(__msg->attr.urq() ? FFLAGS_MSGURQ : 0);
__hdr.xflags |= (ushort)(__msg->attr.del() ? XFLAGS_MSGDELETED : 0);
__hdr.xflags |= (ushort)(__msg->attr.ano() ? XFLAGS_MSGANON : 0);
__hdr.xflags |= (ushort)(__msg->attr.fsc() ? XFLAGS_MSGSCANNED : 0);
__hdr.xflags |= (ushort)(__msg->attr.lok() ? XFLAGS_MSGKEEP : 0);
__hdr.xflags |= (ushort)(__msg->attr.trt() ? XFLAGS_MSGTREATED : 0);
__hdr.xflags |= (ushort)(__msg->attr.lzs() ? XFLAGS_MSGPACKED : 0);
__hdr.xflags |= (ushort)(__msg->attr.gsc() ? XFLAGS_MSGGSCAN : 0);
__hdr.xflags |= (ushort)(__msg->attr.rsc() ? XFLAGS_MSGRSCAN : 0);
__hdr.xflags |= (ushort)(__msg->attr.arc() ? XFLAGS_MSGARCHIVED : 0);
__hdr.xflags |= (ushort)(__msg->attr.tag() ? XFLAGS_MSGTAGGED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.del() ? XFLAGS_MSGDELETED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.ano() ? XFLAGS_MSGANON : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.fsc() ? XFLAGS_MSGSCANNED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.lok() ? XFLAGS_MSGKEEP : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.trt() ? XFLAGS_MSGTREATED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.lzs() ? XFLAGS_MSGPACKED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.gsc() ? XFLAGS_MSGGSCAN : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.rsc() ? XFLAGS_MSGRSCAN : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.arc() ? XFLAGS_MSGARCHIVED : 0);
__hdr.xflags |= (uint16_t)(__msg->attr.tag() ? XFLAGS_MSGTAGGED : 0);
if(not (__mode & GMSG_UPDATE)) {
if(__msg->attr.uns()) {