64 bit platforms support
This commit is contained in:
@@ -98,7 +98,7 @@ void __gftrk_track(const char* text) {
|
||||
if(__gftrk_statusline)
|
||||
update_statusline(text);
|
||||
if(cmdlinedebughg)
|
||||
LOG.printf("- %08lu %*s%s", __gftrk_ptr->tick, __gftrk_ptr->indent*2, "", __gftrk_ptr->text);
|
||||
LOG.printf("- %08u %*s%s", __gftrk_ptr->tick, __gftrk_ptr->indent*2, "", __gftrk_ptr->text);
|
||||
}
|
||||
__gftrk_curr = (++__gftrk_curr) % __gftrk_max;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void __gftrk_log() {
|
||||
LOG.printf("! Function track dump follows:");
|
||||
_first = false;
|
||||
}
|
||||
LOG.printf("- %08lu %*s%s", _ptr->tick, _ptr->indent*2, "", _ptr->text);
|
||||
LOG.printf("- %08u %*s%s", _ptr->tick, _ptr->indent*2, "", _ptr->text);
|
||||
}
|
||||
_count++;
|
||||
_curr--;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <gcmpall.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Disable some MS Visual C warnings
|
||||
@@ -106,13 +107,16 @@ typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned char byte;
|
||||
typedef signed char sbyte;
|
||||
typedef unsigned short word;
|
||||
typedef signed short sword;
|
||||
typedef unsigned long dword;
|
||||
typedef signed long sdword;
|
||||
|
||||
typedef unsigned char bit;
|
||||
typedef uint8_t byte;
|
||||
typedef int8_t sbyte;
|
||||
typedef uint16_t word;
|
||||
typedef int16_t sword;
|
||||
typedef uint32_t dword;
|
||||
typedef int32_t sdword;
|
||||
|
||||
typedef uint32_t time32_t; /* 32-bit time_t type */
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Common function-pointer types
|
||||
|
@@ -123,7 +123,7 @@ extern const char* gmonths[];
|
||||
// ------------------------------------------------------------------
|
||||
// Prototypes
|
||||
|
||||
#ifdef __WIN32__
|
||||
#if defined(__WIN32__) && MAXINT > 0x0FFFFFFF // 64-bit
|
||||
extern struct tm dummy_struct_tm;
|
||||
inline struct tm* ggmtime(time_t* arg) {
|
||||
struct tm* a = gmtime(arg);
|
||||
@@ -172,6 +172,10 @@ char* TimeToStr(char* buf, time_t t);
|
||||
long YMD2JDN(unsigned yr, unsigned mo, unsigned day) __attribute__ ((const));
|
||||
void JDN2YMD(long scalar, unsigned *yr, unsigned *mo, unsigned *day);
|
||||
|
||||
inline struct tm *gmtime(const time32_t *timep) {
|
||||
const time_t temp(*timep);
|
||||
return gmtime(&temp);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
|
@@ -108,67 +108,67 @@ struct XbbsUsers {
|
||||
char bus_phone[21]; // Users business/office number
|
||||
char interests[78]; // Interest Line
|
||||
char SysOpComment[78]; // Room for Sysops comment
|
||||
ushort banktime; // Time in the bank
|
||||
ushort computer_type; // Computer type
|
||||
long userid; // User ID
|
||||
short pointid; // Point Mail ID
|
||||
time_t initial_logon; // Time/Date of initial logon
|
||||
time_t expires; // Time/Date user expires
|
||||
time_t last_logon; // Time/Date of last logon
|
||||
time_t logon_today; // Last time the user logged on today
|
||||
short birthyear; // Birth Year
|
||||
uint16_t banktime; // Time in the bank
|
||||
uint16_t computer_type; // Computer type
|
||||
int32_t userid; // User ID
|
||||
int16_t pointid; // Point Mail ID
|
||||
time32_t initial_logon; // Time/Date of initial logon
|
||||
time32_t expires; // Time/Date user expires
|
||||
time32_t last_logon; // Time/Date of last logon
|
||||
time32_t logon_today; // Last time the user logged on today
|
||||
int16_t birthyear; // Birth Year
|
||||
char birthmonth; // Birth Month
|
||||
char birthday; // Birth day
|
||||
char gender; // Gender
|
||||
long credit; // User credit
|
||||
long minlimit; // Minimum limit
|
||||
long group; // Group number the user belongs to
|
||||
long currlastread; // Last read pointer for current area
|
||||
long time_today; // Number of minutes user used today
|
||||
long time_per_day; // Time limit per day
|
||||
long time_per_call; // Time limit per call
|
||||
long numcalls; // Number of total calls user made to BBS
|
||||
long ulnum; // Total number of uploads
|
||||
long dlnum; // Total number of downloads
|
||||
long ulk; // Total uploads in K-bytes
|
||||
long dlk; // Total downloads in K-bytes
|
||||
long uktoday; // Uploads in K-bytes made today
|
||||
long dktoday; // Download in k-bytes made today
|
||||
long ukperday; // Max k-bytes user can upload a day
|
||||
long dkperday; // Max k-byes a user can download a day
|
||||
long numposts; // Number of messages ever written
|
||||
long security1; // Security level #1
|
||||
long security2; // Security level #2
|
||||
long flags1; // Sysop definable 32 flags
|
||||
long flags2; // Sysop definable 32 flags
|
||||
long attribs; // User attributes
|
||||
long attribs2; // User attributes
|
||||
short length; // Screen length
|
||||
short width; // Screen width
|
||||
short lastmsgarea; // Last message area user was in
|
||||
short lastfilearea; // Last file area user was in
|
||||
int32_t credit; // User credit
|
||||
int32_t minlimit; // Minimum limit
|
||||
int32_t group; // Group number the user beint32_ts to
|
||||
int32_t currlastread; // Last read pointer for current area
|
||||
int32_t time32_today; // Number of minutes user used today
|
||||
int32_t time_per_day; // Time limit per day
|
||||
int32_t time_per_call; // Time limit per call
|
||||
int32_t numcalls; // Number of total calls user made to BBS
|
||||
int32_t ulnum; // Total number of uploads
|
||||
int32_t dlnum; // Total number of downloads
|
||||
int32_t ulk; // Total uploads in K-bytes
|
||||
int32_t dlk; // Total downloads in K-bytes
|
||||
int32_t uktoday; // Uploads in K-bytes made today
|
||||
int32_t dktoday; // Download in k-bytes made today
|
||||
int32_t ukperday; // Max k-bytes user can upload a day
|
||||
int32_t dkperday; // Max k-byes a user can download a day
|
||||
int32_t numposts; // Number of messages ever written
|
||||
int32_t security1; // Security level #1
|
||||
int32_t security2; // Security level #2
|
||||
int32_t flags1; // Sysop definable 32 flags
|
||||
int32_t flags2; // Sysop definable 32 flags
|
||||
int32_t attribs; // User attributes
|
||||
int32_t attribs2; // User attributes
|
||||
int16_t length; // Screen length
|
||||
int16_t width; // Screen width
|
||||
int16_t lastmsgarea; // Last message area user was in
|
||||
int16_t lastfilearea; // Last file area user was in
|
||||
char lastprotocol; // Last protocol user chose
|
||||
char lastarchiver; // Last archiver user chose
|
||||
long forsysop; // unused
|
||||
int32_t forsysop; // unused
|
||||
char interface_; // obsolete
|
||||
char exp; // unused
|
||||
short leech_percent; // File leech ratio
|
||||
short maxbanktime; // Maximum time user can have in bank
|
||||
short timecredit; // Current time user has credit for
|
||||
short callstoday; // Number of calls user made to BBS today
|
||||
long totalminsever; // Total minutes users has used ever
|
||||
long netmaildebits; // Total spent on NetMail
|
||||
time_t lastpwchange; // Time/Date of last password change
|
||||
time_t lastlistednewfile; // Time/Date user last listed new files
|
||||
ulong filekcredit; // Amount of file k-byte credit user has
|
||||
int16_t leech_percent; // File leech ratio
|
||||
int16_t maxbanktime; // Maximum time user can have in bank
|
||||
int16_t timecredit; // Current time user has credit for
|
||||
int16_t callstoday; // Number of calls user made to BBS today
|
||||
int32_t totalminsever; // Total minutes users has used ever
|
||||
int32_t netmaildebits; // Total spent on NetMail
|
||||
time32_t lastpwchange; // Time/Date of last password change
|
||||
time32_t lastlistednewfile; // Time/Date user last listed new files
|
||||
uint32_t filekcredit; // Amount of file k-byte credit user has
|
||||
char unixid[8]; // Users Unix Specific ID
|
||||
byte _unused[94]; // reserved for future use
|
||||
byte mailtags[128]; // Message areas tagged for off-line mail
|
||||
byte usermsg[128]; // Message areas user can access
|
||||
byte userfile[128]; // File areas user can access
|
||||
ulong passwordcrc; // User password CRC
|
||||
ulong passwordcrc2; // User password CRC2
|
||||
ushort max_mail_pkt; // Max msgs to pack for off-line mail
|
||||
uint32_t passwordcrc; // User password CRC
|
||||
uint32_t passwordcrc2; // User password CRC2
|
||||
uint16_t max_mail_pkt; // Max msgs to pack for off-line mail
|
||||
char reasked; // Has user answered the ReAsk questionairre
|
||||
char reserved[75]; // reserved for future user
|
||||
};
|
||||
|
@@ -48,7 +48,7 @@ inline int atox(const char* s) { return (int)atoulx(s); }
|
||||
char* ltob(char* dst, ulong value, int fill=32);
|
||||
|
||||
int GetYesno(const char* value);
|
||||
int Pct(dword x, dword y);
|
||||
int Pct(ulong x, ulong y);
|
||||
int tabstop(int col, int tabwidth);
|
||||
|
||||
char* ggetosstring();
|
||||
@@ -57,7 +57,7 @@ char* ggetosstring();
|
||||
dword B2L(dword b);
|
||||
dword L2B(dword l);
|
||||
|
||||
inline void SwapWord32(long* dw) { *dw = (long)(((dword)(*dw) << 16) | ((dword)(*dw) >> 16)); }
|
||||
inline void SwapWord32(uint32_t* dw) { *dw = ((*dw) << 16) | ((*dw) >> 16); }
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@@ -66,7 +66,7 @@ void GTag::Reset() {
|
||||
// Resize tag array.
|
||||
// Returns NULL if realloc failed.
|
||||
|
||||
ulong* GTag::Resize(uint __tags) {
|
||||
uint32_t* GTag::Resize(uint __tags) {
|
||||
|
||||
register uint newsize = 0;
|
||||
|
||||
@@ -78,7 +78,7 @@ ulong* GTag::Resize(uint __tags) {
|
||||
}
|
||||
|
||||
if(newsize) {
|
||||
tag = (ulong*)throw_realloc(tag, newsize*sizeof(ulong));
|
||||
tag = (uint32_t*)throw_realloc(tag, newsize*sizeof(uint32_t));
|
||||
allocated = newsize;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ ulong* GTag::Resize(uint __tags) {
|
||||
// Appends a new tag number to the end of the tag array.
|
||||
// NOTE - Does not check for duplicates or correct sequence!
|
||||
|
||||
ulong* GTag::Append(ulong __tagn) {
|
||||
uint32_t* GTag::Append(uint32_t __tagn) {
|
||||
|
||||
Resize(tags+1);
|
||||
tag[tags-1] = __tagn;
|
||||
@@ -125,7 +125,7 @@ ulong* GTag::Append(ulong __tagn) {
|
||||
//
|
||||
// Dry test result: Works!
|
||||
|
||||
ulong* GTag::Add(ulong __tagn) {
|
||||
uint32_t* GTag::Add(uint32_t __tagn) {
|
||||
|
||||
// Find closest tag number
|
||||
uint _reln = ToReln(__tagn, TAGN_CLOSEST);
|
||||
@@ -147,7 +147,7 @@ ulong* GTag::Add(ulong __tagn) {
|
||||
_reln--;
|
||||
|
||||
// Move data to make room for the new tag number
|
||||
memmove(tag+_reln+1, tag+_reln, (tags-_reln-1)*sizeof(ulong));
|
||||
memmove(tag+_reln+1, tag+_reln, (tags-_reln-1)*sizeof(uint32_t));
|
||||
|
||||
// Copy the new tag number to the insert position
|
||||
tag[_reln] = __tagn;
|
||||
@@ -162,7 +162,7 @@ ulong* GTag::Add(ulong __tagn) {
|
||||
// Returns the relative tag number or RELN_INVALID if missing.
|
||||
// NOTE - Does not resize the array.
|
||||
|
||||
uint GTag::Del(ulong __tagn) {
|
||||
uint GTag::Del(uint32_t __tagn) {
|
||||
|
||||
return DelReln(ToReln(__tagn));
|
||||
}
|
||||
@@ -173,7 +173,7 @@ uint GTag::Del(ulong __tagn) {
|
||||
uint GTag::DelReln(uint __reln) {
|
||||
|
||||
if(__reln) {
|
||||
memmove(tag+__reln-1, tag+__reln, (tags-__reln)*sizeof(ulong));
|
||||
memmove(tag+__reln-1, tag+__reln, (tags-__reln)*sizeof(uint32_t));
|
||||
count--;
|
||||
tags--;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ uint GTag::DelReln(uint __reln) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
uint GTag::DelResize(ulong __tagn) {
|
||||
uint GTag::DelResize(uint32_t __tagn) {
|
||||
|
||||
uint _reln = Del(__tagn);
|
||||
Resize(tags);
|
||||
@@ -193,7 +193,7 @@ uint GTag::DelResize(ulong __tagn) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
static int TagnCmp(const ulong* __a, const ulong* __b) {
|
||||
static int TagnCmp(const uint32_t* __a, const uint32_t* __b) {
|
||||
|
||||
return CmpV(*__a, *__b);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ static int TagnCmp(const ulong* __a, const ulong* __b) {
|
||||
|
||||
void GTag::Sort() {
|
||||
|
||||
qsort(tag, tags, sizeof(ulong), (StdCmpCP)TagnCmp);
|
||||
qsort(tag, tags, sizeof(uint32_t), (StdCmpCP)TagnCmp);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@@ -212,10 +212,10 @@ void GTag::ElimDups() {
|
||||
|
||||
if(tags > 1) {
|
||||
uint _before = tags;
|
||||
ulong _last = tag[0];
|
||||
uint32_t _last = tag[0];
|
||||
for(uint n=1; n<tags; n++) {
|
||||
if(_last == tag[n]) {
|
||||
memmove(&tag[n-1], &tag[n], (tags-n)*sizeof(ulong));
|
||||
memmove(&tag[n-1], &tag[n], (tags-n)*sizeof(uint32_t));
|
||||
tags--;
|
||||
n--;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ void GTag::ElimDups() {
|
||||
// Return the tag number corresponding to a relative tag number.
|
||||
// Returns TAGN_INVALID, if the requested number did not exist.
|
||||
|
||||
ulong GTag::CvtReln(uint __reln) {
|
||||
uint32_t GTag::CvtReln(uint __reln) {
|
||||
|
||||
if(tag and __reln and (__reln <= tags))
|
||||
return tag[__reln-1];
|
||||
@@ -246,7 +246,7 @@ ulong GTag::CvtReln(uint __reln) {
|
||||
// If __closest is true, the closest smaller tag number is returned.
|
||||
// If no tags exist at all, RELN_INVALID is returned.
|
||||
|
||||
uint GTag::ToReln(ulong __tagn, int __closest) {
|
||||
uint GTag::ToReln(uint32_t __tagn, int __closest) {
|
||||
|
||||
uint _lastreln = RELN_INVALID;
|
||||
|
||||
@@ -258,9 +258,9 @@ uint GTag::ToReln(ulong __tagn, int __closest) {
|
||||
|
||||
if(tags and __tagn) {
|
||||
|
||||
register long _mid;
|
||||
register long _left = 0;
|
||||
register long _right = tags;
|
||||
int _mid;
|
||||
int _left = 0;
|
||||
int _right = tags;
|
||||
|
||||
do {
|
||||
_mid = (_left+_right)/2;
|
||||
@@ -285,7 +285,7 @@ uint GTag::ToReln(ulong __tagn, int __closest) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
uint GTag::ToReln(ulong __tagn) {
|
||||
uint GTag::ToReln(uint32_t __tagn) {
|
||||
|
||||
return ToReln(__tagn, TAGN_EXACT);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ void GTag::Load(gfile& fp) {
|
||||
count = (uint) val;
|
||||
if(count) {
|
||||
Resize(count);
|
||||
fp.fread(tag, sizeof(ulong), count);
|
||||
fp.fread(tag, sizeof(uint32_t), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ void GTag::Save(gfile& fp) {
|
||||
fp.fwrite(&val, sizeof(dword));
|
||||
|
||||
if(tag and count)
|
||||
fp.fwrite(tag, sizeof(ulong), count);
|
||||
fp.fwrite(tag, sizeof(uint32_t), count);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -37,10 +37,10 @@
|
||||
// ------------------------------------------------------------------
|
||||
// Constants
|
||||
|
||||
const ulong TAGN_INVALID = 0;
|
||||
const uint32_t TAGN_INVALID = 0;
|
||||
const uint RELN_INVALID = 0;
|
||||
|
||||
const ulong TAGN_MAX = ((ulong)-1);
|
||||
const uint32_t TAGN_MAX = ((uint32_t)-1);
|
||||
const uint RELN_MAX = ((uint)-1);
|
||||
|
||||
const int TAGN_CLOSEST = true;
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
// ----------------------------------------------------------------
|
||||
// Internal data
|
||||
|
||||
ulong* tag; // tag array
|
||||
uint32_t* tag; // tag array
|
||||
uint tags; // tags in array
|
||||
uint count; // fake tags count
|
||||
uint allocated; // actual allocated tags
|
||||
@@ -75,31 +75,31 @@ public:
|
||||
void Reset();
|
||||
void ResetAll() { Reset(); count = 0; }
|
||||
|
||||
ulong* Resize(uint __tags);
|
||||
uint32_t* Resize(uint __tags);
|
||||
|
||||
ulong* Append(ulong __tagn);
|
||||
ulong* Add(ulong __tagn);
|
||||
uint Del(ulong __tagn);
|
||||
uint32_t* Append(uint32_t __tagn);
|
||||
uint32_t* Add(uint32_t __tagn);
|
||||
uint Del(uint32_t __tagn);
|
||||
uint DelReln(uint __reln);
|
||||
uint DelResize(ulong __tagn);
|
||||
uint DelResize(uint32_t __tagn);
|
||||
void Sort();
|
||||
void ElimDups();
|
||||
|
||||
ulong CvtReln(uint __reln);
|
||||
uint ToReln(ulong __tagn);
|
||||
uint ToReln(ulong __tagn, int __closest);
|
||||
uint32_t CvtReln(uint __reln);
|
||||
uint ToReln(uint32_t __tagn);
|
||||
uint ToReln(uint32_t __tagn, int __closest);
|
||||
|
||||
uint Find(ulong __tagn) { return ToReln(__tagn); }
|
||||
uint Find(uint32_t __tagn) { return ToReln(__tagn); }
|
||||
|
||||
uint Tags() const { return tags; }
|
||||
uint Count() const { return count; }
|
||||
uint SetCount(uint n) { tags = count = n; return count; }
|
||||
|
||||
void Set(uint n, ulong t) { tag[n] = t; }
|
||||
ulong Get(uint n) { return (tags and (n<tags)) ? tag[n] : TAGN_INVALID; }
|
||||
void Set(uint n, uint32_t t) { tag[n] = t; }
|
||||
uint32_t Get(uint n) { return (tags and (n<tags)) ? tag[n] : TAGN_INVALID; }
|
||||
|
||||
ulong& operator[](uint n) { return tag[n]; }
|
||||
ulong& at(uint n) { return tag[n]; }
|
||||
uint32_t& operator[](uint n) { return tag[n]; }
|
||||
uint32_t& at(uint n) { return tag[n]; }
|
||||
|
||||
void Load(gfile& fp);
|
||||
void Save(gfile& fp);
|
||||
|
Reference in New Issue
Block a user