Fixing warnings and errors for MSVS 2005 compiler

This commit is contained in:
Ianos Gnatiuc
2006-04-21 19:57:30 +00:00
parent e3bbfbee86
commit df0f689816
44 changed files with 417 additions and 289 deletions

View File

@@ -326,16 +326,17 @@ const int REPLYRE_NUMERIC = 2;
// ------------------------------------------------------------------
// Name typedefs
typedef char Name[36];
typedef TCHAR Name[36];
// ------------------------------------------------------------------
// Combined name/address structure
struct Node {
struct Node
{
Name name;
Addr addr;
Node& operator=(const Node& a) { strcpy(name, a.name); addr=a.addr; return *this; }
Node &operator=(const Node &a) { strxcpy(name, a.name, ARRAYSIZE(name)); addr=a.addr; return *this; }
};

View File

@@ -578,12 +578,14 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
line->kludge = GKLUD_RFC;
}
struct tm* tm = ggmtime(&msg->written);
struct tm tm; ggmtime(&tm, &msg->written);
sprintf(buf, "%sDate: %s, %02d %s %04d %02d:%02d:%02d", rfc,
__gsweekday[tm->tm_wday],
tm->tm_mday, __gsmonth[tm->tm_mon], 1900+tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec
);
__gsweekday[tm.tm_wday],
tm.tm_mday, __gsmonth[tm.tm_mon], 1900+tm.tm_year,
tm.tm_hour, tm.tm_min, tm.tm_sec
);
if(AA->Usetzutc())
sprintf(buf + strlen(buf), " %+05d", tzoffset());

View File

@@ -176,8 +176,12 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
*buf1 = NUL;
strsetsz(buf1, nodewidth);
if(msg->written)
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&msg->written));
if (msg->written)
{
struct tm tm; ggmtime(&tm, &msg->written);
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, &tm);
}
strsetsz(buf2, datewidth);
// write from line
@@ -205,8 +209,12 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
*buf2 = NUL;
strsetsz(buf2, nodewidth);
if(msg->arrived)
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&msg->arrived));
if (msg->arrived)
{
struct tm tm; ggmtime(&tm, &msg->arrived);
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, &tm);
}
strsetsz(buf2, datewidth);
// write to line

View File

@@ -792,7 +792,8 @@ void KludgeDATE(GMsg* msg, const char* ptr) {
}
}
if(date_ok) {
if (date_ok)
{
struct tm t;
t.tm_year = (year < 80) ? (year+100) : (year > 1900) ? (year-1900) : year;
t.tm_mon = month - 1;
@@ -801,11 +802,11 @@ void KludgeDATE(GMsg* msg, const char* ptr) {
t.tm_min = minute;
t.tm_sec = second;
t.tm_isdst = -1;
time32_t a = gmktime(&t);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
msg->written = a + a - b;
time32_t a = gmktime(&t);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
msg->written = a + a - b;
}
}

View File

@@ -332,8 +332,13 @@ void GMsgList::print_line(uint idx, uint pos, bool isbar) {
case MSGLISTDATE_ARRIVED: dt = ml->arrived; break;
case MSGLISTDATE_RECEIVED: dt = ml->received; break;
}
if(dt)
strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
if (dt)
{
struct tm tm; ggmtime(&tm, &dt);
strftimei(dbuf, 20, "%d %b %y", &tm);
}
if(AA->Msglistdate())
strsetsz(dbuf, 10);
else
@@ -934,8 +939,12 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
case MSGLISTDATE_RECEIVED: dt = msg.received; break;
}
if(dt)
strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
if (dt)
{
struct tm tm; ggmtime(&tm, &dt);
strftimei(dbuf, 20, "%d %b %y", &tm);
}
strcat(buf, dbuf);
}
strcat(buf, " ");

View File

@@ -154,20 +154,20 @@ void TokenXlat(int mode, std::string &input, GMsg* msg, GMsg* oldmsg, int __orig
const char *osver = ggetosstring();
time32_t t = gtime(NULL);
struct tm* written_tm = glocaltime(&t);
struct tm written_tm; glocaltime(&written_tm, &t);
char cdate[80];
strftimei(cdate, 80, LNG->DateFmt, written_tm);
strftimei(cdate, 80, LNG->DateFmt, &written_tm);
char ctime[80];
strftimei(ctime, 80, LNG->TimeFmt, written_tm);
strftimei(ctime, 80, LNG->TimeFmt, &written_tm);
char cdtime[80];
strftimei(cdtime, 80, LNG->DateTimeFmt, written_tm);
written_tm = ggmtime(&oldmsg->written);
strftimei(cdtime, 80, LNG->DateTimeFmt, &written_tm);
ggmtime(&written_tm, &oldmsg->written);
char odate[80];
strftimei(odate, 80, LNG->DateFmt, written_tm);
strftimei(odate, 80, LNG->DateFmt, &written_tm);
char otime[80];
strftimei(otime, 80, LNG->TimeFmt, written_tm);
strftimei(otime, 80, LNG->TimeFmt, &written_tm);
char odtime[80];
strftimei(odtime, 80, LNG->DateTimeFmt, written_tm);
strftimei(odtime, 80, LNG->DateTimeFmt, &written_tm);
const char* origareaid = AL.AreaIdToPtr(__origarea)->echoid();
bool origareaisinet = make_bool(AL.AreaIdToPtr(__origarea)->isinternet());

View File

@@ -243,10 +243,10 @@ static void MakeMsg3(int& mode, GMsg* msg) {
// Do Timefields
if(msg->attr.fmu()) {
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
a += a - b;
if(AA->havereceivedstamp())
msg->received = a;
@@ -824,10 +824,10 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
dochgdate = false;
}
if(dochgdate) {
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
a += a - b;
msg->received = msg->arrived = msg->written = a;
}

View File

@@ -208,15 +208,15 @@ int ImportQWK() {
_tm.tm_min = _minute;
_tm.tm_sec = 0;
_tm.tm_isdst = -1;
time32_t a = gmktime(&_tm);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
msg->written = a + a - b;
time32_t a = gmktime(&_tm);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
msg->written = a + a - b;
a = gtime(NULL);
tp = ggmtime(&a);
tp->tm_isdst = -1;
b = gmktime(tp);
ggmtime(&tp, &a);
tp.tm_isdst = -1;
b = gmktime(&tp);
msg->arrived = a + a - b;
// Read message text
@@ -369,11 +369,11 @@ int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
hdr.status = msg->attr.pvt() ? '*' : ' ';
sprintf(buf, "%u", confno);
memcpy(hdr.msgno, buf, strlen(buf));
struct tm* _tm = ggmtime(&msg->written);
int _year = _tm->tm_year % 100;
sprintf(buf, "%02d-%02d-%02d", _tm->tm_mon+1, _tm->tm_mday, _year);
struct tm _tm; ggmtime(&_tm, &msg->written);
int _year = _tm.tm_year % 100;
sprintf(buf, "%02d-%02d-%02d", _tm.tm_mon+1, _tm.tm_mday, _year);
memcpy(hdr.date, buf, 8);
sprintf(buf, "%02d:%02d", _tm->tm_hour, _tm->tm_min);
sprintf(buf, "%02d:%02d", _tm.tm_hour, _tm.tm_min);
memcpy(hdr.time, buf, 5);
strxcpy(buf, msg->to, tolen+1);
if(not QWK->MixCaseAllowed())

View File

@@ -1181,10 +1181,10 @@ int LoadMessage(GMsg* msg, int margin) {
if(msg->attr.tou()) {
reader_rcv_noise = 1;
if(not msg->attr.rcv()) { // Have we seen it?
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
msg->received = a + a - b; // Get current date
msg->attr.rcv1(); // Mark as received
reader_rcv_noise++;
@@ -1426,7 +1426,10 @@ void GotoReplies() {
sprintf(rlist[replies].addr, " (%s) ", buf);
}
maxaddr = MaxV(maxaddr, (uint)strlen(rlist[replies].addr));
strftimei(rlist[replies].written, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&rmsg->written));
struct tm tm; ggmtime(&tm, &rmsg->written);
strftimei(rlist[replies].written, CFG->disphdrdateset.len, LNG->DateTimeFmt, &tm);
maxwritten = MaxV(maxwritten, (uint)strlen(rlist[replies].written));
rlist[replies].reln = reln;
replies++;

View File

@@ -171,11 +171,11 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
msg->orig = msg->oorig = CFG->internetgate.addr.valid() ? CFG->internetgate.addr : AA->aka();
msg->dest = msg->odest = AA->aka();
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
msg->arrived = a + a - b;
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
msg->arrived = a + a - b;
Line* line = NULL;
Line* fline = NULL;
@@ -697,11 +697,11 @@ int ExportSoupMsg(GMsg* msg, char* msgfile, gfile& fp, int ismail) {
msg->attr.snt1();
msg->attr.scn1();
msg->attr.uns0();
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
msg->arrived = a + a - b;
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
msg->arrived = a + a - b;
AA->SaveHdr(GMSG_UPDATE, msg);
if(msg->attr.k_s())
AA->DeleteMsg(msg, DIR_NEXT);

View File

@@ -343,11 +343,19 @@ bool guserbase::edit_entry(uint idx) {
char dbuf[16];
time32_t dt = entry.firstdate;
if(dt)
window.prints(13, 13, wattr, strftimei(dbuf, 16, "%d %b %y", ggmtime(&dt)));
if (dt)
{
struct tm tm; ggmtime(&tm, &dt);
window.prints(13, 13, wattr, strftimei(dbuf, 16, "%d %b %y", &tm));
}
dt = entry.lastdate;
if(dt)
window.prints(13, 38, wattr, strftimei(dbuf, 16, "%d %b %y", ggmtime(&dt)));
if (dt)
{
struct tm tm; ggmtime(&tm, &dt);
window.prints(13, 38, wattr, strftimei(dbuf, 16, "%d %b %y", &tm));
}
sprintf(dbuf, "%8u", entry.times);
window.prints(13, width-11, wattr, dbuf);
@@ -427,10 +435,10 @@ bool guserbase::find_entry(char* name, bool lookup) {
void guserbase::write_entry(uint idx, bool updateit) {
if(updateit and not entry.is_deleted) {
time32_t a = gtime(NULL);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time32_t b = gmktime(tp);
time32_t a = gtime(NULL);
struct tm tp; ggmtime(&tp, &a);
tp.tm_isdst = -1;
time32_t b = gmktime(&tp);
entry.lastdate = a + a - b;
if(not entry.firstdate)
entry.firstdate = entry.lastdate;

View File

@@ -53,9 +53,11 @@ void update_statuslines() {
*clkinfo = NUL;
*help = NUL;
if(CFG->switches.get(statuslineclock)) {
if(CFG->switches.get(statuslineclock))
{
time32_t t = gtime(NULL);
sprintf(clkinfo, " %s", strftimei(help, 40, LNG->StatusLineTimeFmt, glocaltime(&t)));
struct tm tm; glocaltime(&tm, &t);
sprintf(clkinfo, " %s", strftimei(help, 40, LNG->StatusLineTimeFmt, &tm));
}
if(CFG->statuslinehelp == -1)
@@ -464,7 +466,7 @@ bool is_quote2(Line* line, const char* ptr)
return true;
// found begin of citation?
char *begin = strrchr(ln->txt.c_str(), '<');
const char *begin = strrchr(ln->txt.c_str(), '<');
if (begin)
{
// found both '<' and '>'?

View File

@@ -267,13 +267,18 @@ void ScreenBlankIdle() {
char blankmsg1[80];
char blankmsg2[80];
time32_t t = gtime(NULL);
sprintf(blankmsg1, " %s %s %s ", __gver_longpid__, __gver_ver__, strftimei(blankmsg2, 40, LNG->StatusLineTimeFmt, glocaltime(&t)));
struct tm tm; glocaltime(&tm, &t);
sprintf(blankmsg1, " %s %s %s ", __gver_longpid__, __gver_ver__, strftimei(blankmsg2, 40, LNG->StatusLineTimeFmt, &tm));
sprintf(blankmsg2, " %s ", LNG->BlankMsg);
if(strblank(blankmsg2)) {
if (strblank(blankmsg2))
{
*blankmsg2 = NUL;
windowheight--;
}
int b1 = strlen(blankmsg1);
int b2 = strlen(blankmsg2);
int blankmsglen = MaxV(b1,b2);

View File

@@ -218,11 +218,16 @@ void GMsgHeaderView::Paint() {
color = GetColorName(msg->By(), msg->orig, color);
window.prints(2, CFG->disphdrnameset.pos, color, buf);
if(datewidth > 0) {
if(msg->written)
strftimei(buf, datewidth+1, LNG->DateTimeFmt, ggmtime(&msg->written));
if (datewidth > 0)
{
if (msg->written)
{
struct tm tm; ggmtime(&tm, &msg->written);
strftimei(buf, datewidth+1, LNG->DateTimeFmt, &tm);
}
else
*buf = NUL;
strsetsz(buf, datewidth);
window.prints(2, CFG->disphdrdateset.pos, from_color, buf);
}
@@ -262,11 +267,16 @@ void GMsgHeaderView::Paint() {
}
window.prints(3, CFG->disphdrnameset.pos, color, buf);
if(datewidth > 0) {
if(msg->arrived)
strftimei(buf, datewidth+1, LNG->DateTimeFmt, ggmtime(&msg->arrived));
if (datewidth > 0)
{
if (msg->arrived)
{
struct tm tm; ggmtime(&tm, &msg->arrived);
strftimei(buf, datewidth+1, LNG->DateTimeFmt, &tm);
}
else
*buf = NUL;
strsetsz(buf, datewidth);
window.prints(3, CFG->disphdrdateset.pos, to_color, buf);
}

View File

@@ -599,7 +599,7 @@ public:
int NextMsglistdate() { adat->msglistdate++; if(adat->msglistdate > MSGLISTDATE_RECEIVED) adat->msglistdate = MSGLISTDATE_NONE; return adat->msglistdate; }
const ftn_aka& SetAka(const ftn_addr& a) { adat->aka.addr = a; return adat->aka; }
const char* SetInputfile(const char* i) { return strcpy(adat->inputfile, i); }
const TCHAR *SetInputfile(const TCHAR *i) { return strxcpy(adat->inputfile, i, ARRAYSIZE(adat->inputfile)); }
int SetMsglistdate(int m) { adat->msglistdate = m; return adat->msglistdate; }
const char* SetOrigin(const char* o) { return strxcpy(adat->origin, o, sizeof(adat->origin)); }
const char* SetOutputfile(const char* o) { return strxcpy(adat->outputfile, o, sizeof(adat->outputfile)); }
@@ -608,8 +608,8 @@ public:
const char* SetTpl(const char* t) { return strxcpy(adat->tpl, t, sizeof(adat->tpl)); }
int SetTwitmode(int m) { adat->twitmode = m; return adat->twitmode; }
const Node& SetUsername(const Node& n) { adat->username = n; return adat->username; }
const char* SetXlatexport(const char* x) { return strcpy(adat->xlatexport, x); }
const char* SetXlatimport(const char* x) { return strcpy(adat->xlatimport, x); }
const TCHAR *SetXlatexport(const TCHAR *x) { return strxcpy(adat->xlatexport, x, ARRAYSIZE(adat->xlatexport)); }
const TCHAR *SetXlatimport(const TCHAR *x) { return strxcpy(adat->xlatimport, x, ARRAYSIZE(adat->xlatimport)); }
int ToggleMsglistwidesubj() { adat->msglistwidesubj = not adat->msglistwidesubj; return adat->msglistwidesubj; }
int ToggleViewhidden() { adat->viewhidden = not adat->viewhidden; return adat->viewhidden; }
int ToggleViewkludge() { adat->viewkludge = not adat->viewkludge; return adat->viewkludge; }