From 1f4f8695e5764ed862a9810dbd3c7dbf3d3a0992 Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sat, 22 Oct 2005 14:44:25 +0000 Subject: [PATCH] Changed part of integer types to intN_t --- golded3/gcmisc.cpp | 10 +++--- goldlib/gall/gbmh.cpp | 6 ++-- goldlib/gall/gctype.h | 8 ++--- goldlib/gall/gmemi86.h | 2 +- goldlib/gall/gstrall.h | 4 +-- goldlib/gall/gutldos.cpp | 4 +-- goldlib/gall/gutlvers.cpp | 6 ++-- goldlib/gall/gvidbase.cpp | 12 +++---- goldlib/gcfg/gs_ez102.h | 2 +- goldlib/gcfg/gs_opus.h | 4 +-- goldlib/gcfg/gs_qfrnt.h | 25 ++++++--------- goldlib/gcfg/gs_xmail.h | 66 +++++++++++++++++++-------------------- goldlib/glibc/regex.c | 14 ++++----- goldlib/glibc/regex.h | 2 ++ goldlib/msgidlib/ffind.c | 2 +- goldlib/msgidlib/ffind.h | 8 ++--- 16 files changed, 85 insertions(+), 90 deletions(-) diff --git a/golded3/gcmisc.cpp b/golded3/gcmisc.cpp index ea55f8e..1ae5dcd 100644 --- a/golded3/gcmisc.cpp +++ b/golded3/gcmisc.cpp @@ -618,7 +618,7 @@ void ReadXlatTables() { memset(&ChsTable, 0, sizeof(Chs)); for(n=0; n<256; n++) { ChsTable.t[n][0] = 1; - ChsTable.t[n][1] = (unsigned char)n; // The character + ChsTable.t[n][1] = (uint8_t)n; // The character } strcpy(buf, AddPath(CFG->xlatpath, xlt->mapfile)); ifp = fsopen(buf, "rb", CFG->sharemode); @@ -677,13 +677,13 @@ void ReadXlatTables() { ptr = strskip_txt(ptr); break; case 'd': - y = (unsigned char)atoi(ptr+1); + y = (uint8_t)atoi(ptr+1); ChsTable.t[ch][++x] = (byte)y; ChsTable.t[ch][0] = (byte)x; ptr = strskip_txt(ptr); break; case 'x': - y = (unsigned char)atox(ptr+1); + y = (uint8_t)atox(ptr+1); ChsTable.t[ch][++x] = (byte)y; ChsTable.t[ch][0] = (byte)x; ptr = strskip_txt(ptr); @@ -757,11 +757,11 @@ void ReadXlatTables() { ptr = strskip_txt(ptr); break; case 'd': - EscTable.t[n][x++] = (unsigned char)atoi(ptr+1); + EscTable.t[n][x++] = (uint8_t)atoi(ptr+1); ptr = strskip_txt(ptr); break; case 'x': - EscTable.t[n][x++] = (unsigned char)atox(ptr+1); + EscTable.t[n][x++] = (uint8_t)atox(ptr+1); ptr = strskip_txt(ptr); break; case '0': diff --git a/goldlib/gall/gbmh.cpp b/goldlib/gall/gbmh.cpp index e25f354..b4196a2 100644 --- a/goldlib/gall/gbmh.cpp +++ b/goldlib/gall/gbmh.cpp @@ -80,12 +80,12 @@ void gbmh::init(const char* pattern, bool ignorecase) { for(i=0; i= 0 and toupper((unsigned char)s[j]) == pat[j]) + while(--j >= 0 and toupper((uint8_t)s[j]) == pat[j]) ; } else { diff --git a/goldlib/gall/gctype.h b/goldlib/gall/gctype.h index 0df3f5a..c82f842 100644 --- a/goldlib/gall/gctype.h +++ b/goldlib/gall/gctype.h @@ -41,8 +41,8 @@ #include #if defined(__EMX__) #include -#define tolower(c) _nls_tolower((unsigned char)(c)) -#define toupper(c) _nls_toupper((unsigned char)(c)) +#define tolower(c) _nls_tolower((uint8_t)(c)) +#define toupper(c) _nls_toupper((uint8_t)(c)) #elif defined(__WIN32__) #ifdef __cplusplus extern "C" { @@ -52,8 +52,8 @@ __inline__ int toupper(int c) { return tu[c]; } } #else extern char tl[256], tu[256]; -#define tolower(c) tl[(int)(unsigned char)(c)] -#define toupper(c) tu[(int)(unsigned char)(c)] +#define tolower(c) tl[(int)(uint8_t)(c)] +#define toupper(c) tu[(int)(uint8_t)(c)] #endif #endif diff --git a/goldlib/gall/gmemi86.h b/goldlib/gall/gmemi86.h index cfe782c..a272165 100644 --- a/goldlib/gall/gmemi86.h +++ b/goldlib/gall/gmemi86.h @@ -212,7 +212,7 @@ inline void __dpmi_free_dos_memory(int buffer) { #include #include -inline void *gmkfp(unsigned short seg, unsigned short ofs) { +inline void *gmkfp(uint16_t seg, uint16_t ofs) { if(not (_crt0_startup_flags & _CRT0_FLAG_NEARPTR)) if(not __djgpp_nearptr_enable()) return (void *)0; diff --git a/goldlib/gall/gstrall.h b/goldlib/gall/gstrall.h index b62b8e6..ddaa8a6 100644 --- a/goldlib/gall/gstrall.h +++ b/goldlib/gall/gstrall.h @@ -41,8 +41,8 @@ #if defined(__EMX__) #include -#define strupr(s) (char *)_nls_strupr((unsigned char *)(s)) -#define strlwr(s) (char *)_nls_strlwr((unsigned char *)(s)) +#define strupr(s) (char *)_nls_strupr((uint8_t *)(s)) +#define strlwr(s) (char *)_nls_strlwr((uint8_t *)(s)) #elif defined(__GNUC__) #if defined(__QNXNTO__) #include diff --git a/goldlib/gall/gutldos.cpp b/goldlib/gall/gutldos.cpp index 8284770..a641713 100644 --- a/goldlib/gall/gutldos.cpp +++ b/goldlib/gall/gutldos.cpp @@ -98,9 +98,9 @@ int g_init_os(int flags) { cpu.di(0); cpu.genint(0x21); if(not (cpu.flags() & 1) and (cpu.cx() == 5)) { - unsigned int table = _farpeekw(selector, 3) * 16 + _farpeekw(selector, 1); + uint32_t table = _farpeekw(selector, 3) * 16 + _farpeekw(selector, 1); int i, size = _farpeekw(_dos_ds, table); - movedata(_dos_ds, table + 2, _my_ds(), (unsigned int)&(toupper(128)), size); + movedata(_dos_ds, table + 2, _my_ds(), (uint32_t)&(toupper(128)), size); // let's build lowercase table from uppercase... for(i = 0; i < size; i++) { int c = toupper(i + 128); diff --git a/goldlib/gall/gutlvers.cpp b/goldlib/gall/gutlvers.cpp index d6b32c9..914d812 100644 --- a/goldlib/gall/gutlvers.cpp +++ b/goldlib/gall/gutlvers.cpp @@ -256,9 +256,9 @@ char *gcpuid(char *_cpuname) #else char vendor[3*sizeof(dword)+1]; /* CPU vendor string 12 bytes, 13th byte is zero */ #endif - unsigned char family; /* CPU stepping number, 4 bits */ - unsigned char model; /* CPU model number, 4 bits */ - unsigned char stepping; /* CPU stepping value, 4 bits */ + uint8_t family; /* CPU stepping number, 4 bits */ + uint8_t model; /* CPU model number, 4 bits */ + uint8_t stepping; /* CPU stepping value, 4 bits */ // unsigned cpu_id; /* stepping ID, 12 bits: 0x0FMS */ // unsigned features; /* CPU features info */ }scpuid; /* ISO C: static variabled is initialised with 0 */ diff --git a/goldlib/gall/gvidbase.cpp b/goldlib/gall/gvidbase.cpp index 86082e3..fd38e40 100644 --- a/goldlib/gall/gvidbase.cpp +++ b/goldlib/gall/gvidbase.cpp @@ -113,14 +113,14 @@ extern int __gdvdetected; #endif #ifndef __DJGPP__ -const unsigned short _dos_ds = 0; +const uint16_t _dos_ds = 0; -inline unsigned short _my_ds(void) { +inline uint16_t _my_ds(void) { return 0; } -inline void _farpokew(unsigned short s, gdma ptr, word chat) { +inline void _farpokew(uint16_t s, gdma ptr, word chat) { NW(s); *ptr = chat; @@ -131,7 +131,7 @@ inline void _farnspokew(gdma ptr, word chat) { *ptr = chat; } -inline word _farpeekw(unsigned short s, gdma ptr) { +inline word _farpeekw(uint16_t s, gdma ptr) { NW(s); return *ptr; @@ -142,7 +142,7 @@ inline void _farnspokeb(byte *ptr, byte chr) { *ptr = chr; } -inline void _farsetsel(unsigned short s) { +inline void _farsetsel(uint16_t s) { NW(s); } @@ -154,7 +154,7 @@ const int ATTRSIZE = sizeof(word); const int ATTRSIZE = 1; #endif -inline void gdmacpy(unsigned short seg_d, gdma sel_d, unsigned short seg_s, gdma sel_s, int len) { +inline void gdmacpy(uint16_t seg_d, gdma sel_d, uint16_t seg_s, gdma sel_s, int len) { #ifdef __DJGPP__ movedata(seg_s, sel_s, seg_d, sel_d, len); diff --git a/goldlib/gcfg/gs_ez102.h b/goldlib/gcfg/gs_ez102.h index 28ad48d..20a7c58 100644 --- a/goldlib/gcfg/gs_ez102.h +++ b/goldlib/gcfg/gs_ez102.h @@ -66,7 +66,7 @@ typedef char AskType; // 0=yes, 1=no, 2=ask typedef char MsgType; // 0=localmail, 1=netmail, 2=echomail, 3=passthru, 4=waitthru, 5=allmail typedef char MsgKindsType; // 0=public, 1=private, 2=private or public typedef char UserString[36]; -typedef unsigned char EzFlagType[4]; +typedef uint8_t EzFlagType[4]; // ------------------------------------------------------------------ diff --git a/goldlib/gcfg/gs_opus.h b/goldlib/gcfg/gs_opus.h index f027455..5c35fe5 100644 --- a/goldlib/gcfg/gs_opus.h +++ b/goldlib/gcfg/gs_opus.h @@ -141,8 +141,8 @@ typedef struct { /*--------------------------------------------------------------------------*/ struct _stamp begin - unsigned short date; - unsigned short time; + uint16_t date; + uint16_t time; end; diff --git a/goldlib/gcfg/gs_qfrnt.h b/goldlib/gcfg/gs_qfrnt.h index ed515b3..feabbbf 100644 --- a/goldlib/gcfg/gs_qfrnt.h +++ b/goldlib/gcfg/gs_qfrnt.h @@ -34,13 +34,6 @@ #pragma pack(1) #endif -// ------------------------------------------------------------------ -// Typedefs - -typedef unsigned char _boolean; -typedef unsigned char byte; -typedef unsigned short word; - // ------------------------------------------------------------------ // Constants @@ -76,7 +69,7 @@ struct OriginLineRecord { struct EchoMailConferenceRecord { - _boolean PassThru; + bool PassThru; word ConfNum; word ConfTag; @@ -86,19 +79,19 @@ struct EchoMailConferenceRecord { word AreaLevel; - _boolean CheckForDupes; - _boolean ImportSeenByLines; - _boolean ImportPathLines; - _boolean KeepPrivate; + bool CheckForDupes; + bool ImportSeenByLines; + bool ImportPathLines; + bool KeepPrivate; - _boolean Deleted; + bool Deleted; byte OriginLine; byte Group; - _boolean ScanPrivate; - _boolean Mandatory; - _boolean ForcePrivate; + bool ScanPrivate; + bool Mandatory; + bool ForcePrivate; byte Extra[45]; }; diff --git a/goldlib/gcfg/gs_xmail.h b/goldlib/gcfg/gs_xmail.h index c2e7337..2105a7e 100644 --- a/goldlib/gcfg/gs_xmail.h +++ b/goldlib/gcfg/gs_xmail.h @@ -54,11 +54,11 @@ enum MailTypeDef { struct AddressRec { - unsigned short Zone; - unsigned short Net; - unsigned short Node; - unsigned short Point; - char Domain[21]; + uint16_t Zone; + uint16_t Net; + uint16_t Node; + uint16_t Point; + char Domain[21]; }; @@ -67,34 +67,34 @@ struct AddressRec { struct EchoAreaRec { - char Name[41]; // Area Name - char Descr[61]; // Description - unsigned char MailType; // (MailTypeDef) local, netmail or what - unsigned char StoreType; // (MsgBaseType) - char MsgDirectory[61]; // ... and the corresponding directory - unsigned short ReadSecurity; // Read access level - unsigned short WriteSecurity; // Write access level - char OriginLine[61]; // Origin line for this echo - AddressRec AreaAddress; // Adress of sender for this echo - unsigned char ConferenceNr; // The conference this echo belongs to. If 0 the echo has NO conference - unsigned short maxdays; - unsigned short maxrecv; - unsigned short maxcount; - unsigned short totalimp; - unsigned short totalexp; // Purge info - long totalimpL; - long totalexpL; // total # of msgs imported/exported in this echo - unsigned char BasePathStrip; // Don't import PATH line to base - unsigned char ExportPathStrip; // Strip PATH line for downlinks - unsigned char BaseSeenStrip; // Don't import SEEN-BY to base - unsigned char ExportSeenStrip; // Strip SEEN-BY for downlinks - unsigned short AbsCosts; - unsigned short RelCosts; // The cost for each mail in this echo - long LastActionDate; // Last date something happened in this echo - unsigned char NeverRemove; // Never remove this echo automatically - unsigned short MaxDupes; // Maximum nr. of Dupes - unsigned char SkipPathCheck; - unsigned char Dummy[106]; // unused + char Name[41]; // Area Name + char Descr[61]; // Description + uint8_t MailType; // (MailTypeDef) local, netmail or what + uint8_t StoreType; // (MsgBaseType) + char MsgDirectory[61]; // ... and the corresponding directory + uint16_t ReadSecurity; // Read access level + uint16_t WriteSecurity; // Write access level + char OriginLine[61]; // Origin line for this echo + AddressRec AreaAddress; // Adress of sender for this echo + uint8_t ConferenceNr; // The conference this echo belongs to. If 0 the echo has NO conference + uint16_t maxdays; + uint16_t maxrecv; + uint16_t maxcount; + uint16_t totalimp; + uint16_t totalexp; // Purge info + int32_t totalimpL; + int32_t totalexpL; // total # of msgs imported/exported in this echo + uint8_t BasePathStrip; // Don't import PATH line to base + uint8_t ExportPathStrip; // Strip PATH line for downlinks + uint8_t BaseSeenStrip; // Don't import SEEN-BY to base + uint8_t ExportSeenStrip; // Strip SEEN-BY for downlinks + uint16_t AbsCosts; + uint16_t RelCosts; // The cost for each mail in this echo + int32_t LastActionDate; // Last date something happened in this echo + uint8_t NeverRemove; // Never remove this echo automatically + uint16_t MaxDupes; // Maximum nr. of Dupes + uint8_t SkipPathCheck; + uint8_t Dummy[106]; // unused }; diff --git a/goldlib/glibc/regex.c b/goldlib/glibc/regex.c index 682459b..59383e1 100644 --- a/goldlib/glibc/regex.c +++ b/goldlib/glibc/regex.c @@ -4275,9 +4275,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) case charset_not: { register unsigned char c; - boolean not = (re_opcode_t) *(p - 1) == charset_not; + boolean not_bool = (re_opcode_t) *(p - 1) == charset_not; - DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); + DEBUG_PRINT2 ("EXECUTING charset%s.\n", not_bool ? "_not" : ""); PREFETCH (); c = TRANSLATE (*d); /* The character to match. */ @@ -4286,11 +4286,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) bit list is a full 32 bytes long. */ if (c < (unsigned) (*p * BYTEWIDTH) && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; + not_bool = !not_bool; p += 1 + *p; - if (!not) goto fail; + if (!not_bool) goto fail; SET_REGS_MATCHED (); d++; @@ -4759,15 +4759,15 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) else if ((re_opcode_t) p1[3] == charset || (re_opcode_t) p1[3] == charset_not) { - int not = (re_opcode_t) p1[3] == charset_not; + int not_int = (re_opcode_t) p1[3] == charset_not; if (c < (unsigned char) (p1[4] * BYTEWIDTH) && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; + not_int = !not_int; /* `not' is equal to 1 if c would match, which means that we can't change to pop_failure_jump. */ - if (!not) + if (!not_int) { p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); diff --git a/goldlib/glibc/regex.h b/goldlib/glibc/regex.h index 4ffe52c..33d77b0 100644 --- a/goldlib/glibc/regex.h +++ b/goldlib/glibc/regex.h @@ -37,6 +37,8 @@ extern "C" { # include #endif +#include + /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two diff --git a/goldlib/msgidlib/ffind.c b/goldlib/msgidlib/ffind.c index 442b5e6..8e1b636 100755 --- a/goldlib/msgidlib/ffind.c +++ b/goldlib/msgidlib/ffind.c @@ -55,7 +55,7 @@ * Returns: NULL == File not found. */ -FFIND *FFindOpen(const char *filespec, unsigned short attribute) +FFIND *FFindOpen(const char *filespec, uint16_t attribute) { FFIND *ff; diff --git a/goldlib/msgidlib/ffind.h b/goldlib/msgidlib/ffind.h index cecf5e0..fd88878 100755 --- a/goldlib/msgidlib/ffind.h +++ b/goldlib/msgidlib/ffind.h @@ -77,8 +77,8 @@ struct ffind { /* this is the public area of the struct */ char ff_attrib; - unsigned short ff_ftime; - unsigned short ff_fdate; + uint16_t ff_ftime; + uint16_t ff_fdate; long ff_fsize; char ff_name[256]; @@ -95,7 +95,7 @@ struct ffind #if defined(__386__) || defined(__FLAT__) unsigned long hdir; /* directory handle from DosFindFirst */ #else - unsigned short hdir; /* directory handle from DosFindFirst */ + uint16_t hdir; /* directory handle from DosFindFirst */ #endif #elif defined(UNIX) @@ -124,7 +124,7 @@ struct ffind * prevent name clashes with the Win32 API */ -FFIND *FFindOpen(const char *filespec, unsigned short attribute); +FFIND *FFindOpen(const char *filespec, uint16_t attribute); FFIND *FFindInfo(const char *filespec); int FFindNext(FFIND * ff); void FFindClose(FFIND * ff);