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

@ -127,13 +127,8 @@ typedef unsigned int uint32_t;
#error Don't know how to define 32 bit integers
#endif
typedef int8_t sbyte;
typedef uint8_t byte;
typedef uint8_t uchar;
typedef uint16_t word;
typedef uint16_t ushort;
typedef uint32_t dword;
#endif //#ifdef _MSC_VER

View File

@ -141,7 +141,7 @@ int ftn_version7_nodelist_index::namecmp() const {
int n = 1;
int d;
while(1) {
d = tolower((uchar)*a) - tolower((uchar)*b);
d = tolower((uint8_t)*a) - tolower((uint8_t)*b);
if((d != 0) or (*a == NUL) or (*b == NUL))
break;
a++;

View File

@ -87,11 +87,11 @@ struct PcbUsers {
struct PcbUsersInfHdr {
ushort version; // PCBoard Version Number
ushort numofconf; // Number of EXTENDED Conferences Allocated in File
ushort sizeofrec; // Size of the 'static' PCBoard User Record
uint16_t version; // PCBoard Version Number
uint16_t numofconf; // Number of EXTENDED Conferences Allocated in File
uint16_t sizeofrec; // Size of the 'static' PCBoard User Record
long sizeofconf; // Total Size of PCBoard Conference Information
ushort numofapps; // Number of Third Party Apps adding onto the record
uint16_t numofapps; // Number of Third Party Apps adding onto the record
long totalrecsize; // Total Record Size (PCB and all TPA components)
};
@ -102,9 +102,9 @@ struct PcbUsersInfHdr {
struct PcbUsersInfApp {
char name[15]; // Name of Application (NULL terminated)
ushort version; // Version Number
ushort sizeofrec; // Size of Application Record information (0-65535)
ushort sizeofconfrec; // Size of Conference Record information (0-65535)
uint16_t version; // Version Number
uint16_t sizeofrec; // Size of Application Record information (0-65535)
uint16_t sizeofconfrec; // Size of Conference Record information (0-65535)
char keyword[9]; // Keyword to execute Application (NULL terminated)
long offset; // Offset in User Record where TPA record begins
};

View File

@ -208,11 +208,11 @@ struct m_pointers {
/* Miscellanious system information */
byte video; /* Mode for local video display */
byte log_mode; /* What style of logging to use */
word max_baud; /* fastest speed we can use */
sbyte multitasker; /* flag for DoubleDos (see below) */
byte nlver; /* Which nodelist version we use (NLVER_XXX) */
byte video; /* Mode for local video display */
byte log_mode; /* What style of logging to use */
word max_baud; /* fastest speed we can use */
int8_t multitasker; /* flag for DoubleDos (see below) */
byte nlver; /* Which nodelist version we use (NLVER_XXX) */
int16_t min_ulist; /* OBSOLETE! Only used for compatibility */
int16_t max_ulist; /* with Maximus 2.x! */

View File

@ -88,23 +88,23 @@ const int SUB_HYPER = (1L<<27); // Hyper allocation
// ------------------------------------------------------------------
typedef struct { // Message group info
char lname[LEN_GLNAME+1], // Short name
sname[LEN_GSNAME+1]; // Long name
uchar ar[LEN_ARSTR+1], // Access requirements
unused[96]; // unused
char lname[LEN_GLNAME+1], // Short name
sname[LEN_GSNAME+1]; // Long name
uint8_t ar[LEN_ARSTR+1], // Access requirements
unused[96]; // unused
} grp_t;
typedef struct { // Message sub board info
ushort grp; // Which group this sub belongs to
uint16_t grp; // Which group this sub belongs to
char lname[LEN_SLNAME+1], // Long name - used for listing
sname[LEN_SSNAME+1], // Short name - used for prompts
qwkname[LEN_SQWKNAME+1], // QWK name
code[9], // Eight character code
data_dir[LEN_DIR+1]; // Data file directory
uchar ar[LEN_ARSTR+1], // Access requirements
read_ar[LEN_ARSTR+1], // Read requirements
post_ar[LEN_ARSTR+1], // Post requirements
op_ar[LEN_ARSTR+1]; // Operator requirements
uint8_t ar[LEN_ARSTR+1], // Access requirements
read_ar[LEN_ARSTR+1], // Read requirements
post_ar[LEN_ARSTR+1], // Post requirements
op_ar[LEN_ARSTR+1]; // Operator requirements
uint32_t misc; // Miscellaneous flags
char tagline[81], // Optional QWK net tag line
origline[51], // Optional EchoMail origin line
@ -112,12 +112,12 @@ typedef struct { // Message sub board info
echopath[LEN_DIR+1]; // EchoMail path
ftn_addr faddr; // FidoNet address
uint32_t maxmsgs, // Max number of messages allowed
maxcrcs; // Max number of CRCs to keep
ushort maxage, // Max age of messages (in days)
ptridx; // Index into pointer file
uchar mod_ar[LEN_ARSTR+1]; // Moderated user requirements
ushort qwkconf; // QWK configuration
uchar unused[53]; // unused
maxcrcs; // Max number of CRCs to keep
uint16_t maxage, // Max age of messages (in days)
ptridx; // Index into pointer file
uint8_t mod_ar[LEN_ARSTR+1]; // Moderated user requirements
uint16_t qwkconf; // QWK configuration
uint8_t unused[53]; // unused
} sub_t;
// ------------------------------------------------------------------

View File

@ -291,7 +291,7 @@ void gareafile::ReadFMail(char* tag) {
fclose(fpar);
}
uint ar_rev = (ushort)ar.revNumber;
uint32_t ar_rev = (uint16_t)ar.revNumber;
if((ar_rev >= 0x0100) and (ar_rev < 0x0110))
ReadFMail098(fp, path, file, options);

View File

@ -39,7 +39,7 @@ void gareafile::ReadSynchronet(char* tag) {
Path file, path;
char options[80];
ushort shrt, i;
uint16_t shrt, i;
grp_t grp;
sub_t sub;
@ -98,13 +98,13 @@ void gareafile::ReadSynchronet(char* tag) {
// unused (0xff) 512
fseek(in, 1034, SEEK_CUR);
if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
if(fread(&shrt, sizeof(uint16_t), 1, in) == 1) {
for(i = 0; i < shrt; i++) {
if(fread(&grp, sizeof(grp_t), 1, in) != 1)
break;
}
}
if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
if(fread(&shrt, sizeof(uint16_t), 1, in) == 1) {
for(i = 0; i < shrt; i++) {
if(fread(&sub, sizeof(sub_t), 1, in) != 1)
break;

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()) {