Prevent crash of golded while formatting status line

This commit is contained in:
Ianos Gnatiuc 2006-01-10 23:53:52 +00:00
parent 7d9c48a05f
commit 5c13c7c8c9
22 changed files with 80 additions and 50 deletions

View File

@ -10,6 +10,8 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
- Prevent crash of golded while formatting status line.
- Added "news:" and "ed2k://" to the list of known URLs beginning.
+ New reader key READGotoThNextUnread (default: @Down) added, that will

View File

@ -116,7 +116,7 @@ void GPickArealist::do_delayed() {
char buf[256], tmp[200];
strcpy(tmp, area->echoid());
update_statuslinef("%s: %u %s, %u %s, %u %s", tmp, area->Msgn.Count(), (area->Msgn.Count() == 1 ? LNG->msg : LNG->msgs), area->unread, LNG->unread, area->PMrk.Count(), LNG->personal);
update_statuslinef("%s: %u %s, %u %s, %u %s", "", tmp, area->Msgn.Count(), (area->Msgn.Count() == 1 ? LNG->msg : LNG->msgs), area->unread, LNG->unread, area->PMrk.Count(), LNG->personal);
strcpy(stpcpy(buf, title), area_maybe);
strsetsz(strcpy(tmp, buf), MAXCOL);
@ -464,7 +464,7 @@ void GPickArealist::AreaCatchUp(uint n) {
if((*AL.item)->isseparator())
continue;
update_statuslinef("%s ...", (*AL.item)->echoid());
update_statuslinef("%s ...", "", (*AL.item)->echoid());
AA = (*AL.item);
AA->Open();
@ -651,7 +651,7 @@ bool GPickArealist::handle_key() {
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[index-1])) {
update_statuslinef("%s %s", 1+LNG->ScanningArea, (*AL.item)->echoid());
update_statuslinef("%s %s", "", 1+LNG->ScanningArea, (*AL.item)->echoid());
(*AL.item)->SetHighwaterMark();
}
}
@ -666,7 +666,7 @@ bool GPickArealist::handle_key() {
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[index-1])) {
update_statuslinef("%s %s", 1+LNG->ScanningArea, (*AL.item)->echoid());
update_statuslinef("%s %s", "", 1+LNG->ScanningArea, (*AL.item)->echoid());
(*AL.item)->ResetHighwaterMark();
}
}

View File

@ -183,7 +183,7 @@ void Area::DelMsgs(GMsg* msg) {
break;
}
}
update_statuslinef(LNG->DeletingMsg, x+1, Mark.Count());
update_statuslinef(LNG->DeletingMsg, "ST_DELETINGMSG", x+1, Mark.Count());
w_progress(MODE_UPDATE, C_INFOW, x+1, Mark.Count(), LNG->Deleting);
uint msgno = Mark[x];
if(Msgn.ToReln(msgno)) {
@ -303,6 +303,7 @@ void CmfMsgs(GMsg* msg, bool torecycle)
char* markstr = NULL;
char* progstr = NULL;
char* statstr = NULL;
char* tokenstr = "";
int loadmode = GMSG_UNS_NOT_RCV;
switch(cmf) {
case MODE_COPY:
@ -311,6 +312,7 @@ void CmfMsgs(GMsg* msg, bool torecycle)
markstr = LNG->Copy;
progstr = LNG->Copying;
statstr = LNG->CopyingMsg;
tokenstr = "ST_COPYINGMSG";
loadmode |= GMSG_COPY;
break;
case MODE_MOVE:
@ -335,6 +337,7 @@ void CmfMsgs(GMsg* msg, bool torecycle)
markstr = LNG->Move;
progstr = LNG->Moving;
statstr = LNG->MovingMsg;
tokenstr = "ST_MOVINGMSG";
}
loadmode |= GMSG_MOVE;
@ -498,7 +501,7 @@ void CmfMsgs(GMsg* msg, bool torecycle)
// Show progress and load the marked msg
if(do_mode == MODE_MARKED) {
update_statuslinef(statstr, mrk+1, mrks, echoid);
update_statuslinef(statstr, tokenstr, mrk+1, mrks, echoid);
loadmsgno = *mrkp++;
}

View File

@ -227,7 +227,7 @@ static void WriteMsgs(GMsg* msg) {
break;
}
}
update_statuslinef(LNG->WritingMsg, n+1, AA->Mark.Count());
update_statuslinef(LNG->WritingMsg, "ST_WRITINGMSG", n+1, AA->Mark.Count());
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Writing);
AA->LoadMsg(msg, AA->Mark[n], prnmargin);
if(target & WRITE_PRINTER) {

View File

@ -2629,7 +2629,7 @@ void IEclass::statusline() {
}
uint chr = currline->txt[col];
update_statuslinef(LNG->EditStatus, 1+thisrow, 1+col, chr, _buf);
update_statuslinef(LNG->EditStatus, "ST_EDITSTATUS", 1+thisrow, 1+col, chr, _buf);
if(*_buf and CFG->switches.get(beepcomment)) {
HandleGEvent(EVTT_EDITCOMMENT);
}

View File

@ -973,7 +973,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
// Set selection window title and statusline
set_title(LNG->ImportTitle, TCENTER, C_MENUT);
update_statuslinef(LNG->ImportStatus, filenamebuf.c_str());
update_statuslinef(LNG->ImportStatus, "ST_IMPORTSTATUS", filenamebuf.c_str());
// Start the file picker
fileselected = wpickfile(win_minrow, win_mincol, win_maxrow, win_maxcol, W_BMENU, C_MENUB, C_MENUW, C_MENUS, NO, filenamebuf, maketitle_and_status);
@ -1005,7 +1005,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
imp_filename = (getclip or isPipe) ? filenamebuf.c_str() : CleanFilename(filenamebuf.c_str());
}
update_statuslinef(LNG->ImportStatus, filenamebuf.c_str());
update_statuslinef(LNG->ImportStatus, "ST_IMPORTSTATUS", filenamebuf.c_str());
// Allocate paragraph read buffer
char* _parabuf = (char*)throw_malloc(EDIT_PARABUFLEN);
@ -1291,7 +1291,7 @@ void IEclass::editexport(Line* __exportline, int __endat) {
FILE* _fp = fsopen(_filenameptr, (*Edit__exportfilename == '+') ? "at" : "wt", CFG->sharemode);
if(_fp) {
update_statuslinef(LNG->ExportStatus, Edit__exportfilename);
update_statuslinef(LNG->ExportStatus, "ST_EXPORTSTATUS", Edit__exportfilename);
fputc('\n', _fp);
while((__endat ? __exportline != currline : 1) and __exportline) {

View File

@ -534,18 +534,22 @@ void CreateFileMsgs(int mode, GMsg* msg) {
char* LNG_File = NULL;
char* LNG_Fileing = NULL;
char* tokenstr = "";
if(msg->attr.att()) {
LNG_File = LNG->File_Attach;
LNG_Fileing = LNG->FileAttaching;
tokenstr = "ST_FILEATTACHING";
}
else if(msg->attr.frq()) {
LNG_File = LNG->File_Request;
LNG_Fileing = LNG->FileRequesting;
tokenstr = "ST_FILEREQUESTING";
}
else if(msg->attr.urq()) {
LNG_File = LNG->File_Updreq;
LNG_Fileing = LNG->FileUpdreqing;
tokenstr = "ST_FILEUPDREQING";
}
*buf = NUL;
@ -574,7 +578,7 @@ void CreateFileMsgs(int mode, GMsg* msg) {
for(m=0; m<fspec[x].files; m++,n++) {
if(specfiles > 1) {
w_progress(MODE_UPDATE, C_INFOW, n+1, specfiles, LNG_File);
update_statuslinef(LNG_Fileing, n+1, specfiles,
update_statuslinef(LNG_Fileing, tokenstr, n+1, specfiles,
msg->dest.zone, msg->dest.net, msg->dest.node, msg->dest.point
);
}

View File

@ -113,7 +113,7 @@ bool FindString(GMsg* msg, const char* prompt, int what) {
do {
update_statuslinef(LNG->ReadingMsg, AA->lastread(), AA->Msgn.Count());
update_statuslinef(LNG->ReadingMsg, "ST_READINGMSG", AA->lastread(), AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, AA->lastread(), AA->Msgn.Count(), LNG->AdvancedSearch);
bool success = false;

View File

@ -1031,7 +1031,7 @@ void Initialize(int argc, char* argv[]) {
update_statuslines();
// Initialize the messagebases
update_statuslinef(LNG->LockShareCap, LNG->Checking);
update_statuslinef(LNG->LockShareCap, "ST_LOCKSHARECAP", LNG->Checking);
WideLog = &LOG;
WideDebug = cmdlinedebughg;
WideCanLock = CFG->sharemode ? TestLockPath(CFG->temppath) : false;
@ -1049,64 +1049,64 @@ void Initialize(int argc, char* argv[]) {
LoadLanguage(CFG->loadlanguage);
if(find(AL.basetypes, "OPUS") or find(AL.basetypes, "FTS1")) {
update_statuslinef("%s Fido", LNG->Checking);
update_statuslinef("%s Fido", "", LNG->Checking);
FidoInit(CFG->fidolastread, CFG->switches.get(fidohwmarks), CFG->switches.get(fidonullfix), CFG->fidouserno, CFG->squishuserpath);
}
#ifndef GMB_NOEZY
if(find(AL.basetypes, "EZYCOM")) {
update_statuslinef("%s Ezycom", LNG->Checking);
update_statuslinef("%s Ezycom", "", LNG->Checking);
EzycomInit(CFG->ezycom.msgbasepath, CFG->ezycom.userbasepath, CFG->ezycomuserno);
}
#endif
#ifndef GMB_NOGOLD
if(find(AL.basetypes, "GOLDBASE")) {
update_statuslinef("%s Goldbase", LNG->Checking);
update_statuslinef("%s Goldbase", "", LNG->Checking);
GoldInit(CFG->goldbasepath, CFG->goldbasesyspath, CFG->goldbaseuserno);
}
#endif
#ifndef GMB_NOHUDS
if(find(AL.basetypes, "HUDSON")) {
update_statuslinef("%s Hudson", LNG->Checking);
update_statuslinef("%s Hudson", "", LNG->Checking);
HudsInit(CFG->hudsonpath, CFG->hudsonsyspath, CFG->hudsonuserno, CFG->hudsonsizewarn, CFG->ra2usersbbs);
}
#endif
#ifndef GMB_NOJAM
if(find(AL.basetypes, "JAM")) {
update_statuslinef("%s JAM", LNG->Checking);
update_statuslinef("%s JAM", "", LNG->Checking);
JamInit(CFG->jampath, CFG->switches.get(jamharddelete), CFG->switches.get(jamsmapihw));
}
#endif
#ifndef GMB_NOPCB
if(find(AL.basetypes, "PCBOARD")) {
update_statuslinef("%s PCBoard", LNG->Checking);
update_statuslinef("%s PCBoard", "", LNG->Checking);
PcbInit(CFG->pcboardpath, CFG->pcboarduserno);
}
#endif
#ifndef GMB_NOSQSH
if(find(AL.basetypes, "SQUISH")) {
update_statuslinef("%s Squish", LNG->Checking);
update_statuslinef("%s Squish", "", LNG->Checking);
SquishInit(CFG->squishuserpath, CFG->squishuserno, CFG->switches.get(squishdirect), true, CFG->squishscan);
}
#endif
#ifndef GMB_NOWCAT
if(find(AL.basetypes, "WILDCAT")) {
update_statuslinef("%s WildCat!", LNG->Checking);
update_statuslinef("%s WildCat!", "", LNG->Checking);
WCatInit(CFG->wildcatuserno);
}
#endif
#ifndef GMB_NOXBBS
if(find(AL.basetypes, "ADEPTXBBS")) {
update_statuslinef("%s AdeptXBBS", LNG->Checking);
update_statuslinef("%s AdeptXBBS", "", LNG->Checking);
XbbsInit(CFG->adeptxbbspath, CFG->adeptxbbsuserno);
}
#endif
#ifndef GMB_NOSMB
if(find(AL.basetypes, "SMB")) {
update_statuslinef("%s Synchronet", LNG->Checking);
update_statuslinef("%s Synchronet", "", LNG->Checking);
SMBInit();
}
#endif
update_statuslinef("...");
update_statuslinef("...", "");
// Delete the D'Bridge "mail waiting" semaphore files
if(dbedit) {

View File

@ -250,7 +250,7 @@ void GMsgList::do_delayed() {
if(CFG->switches.get(msglistpagebar))
wscrollbar(W_VERT, maximum_index+1, maximum_index, index);
update_statuslinef(LNG->MsgLister, index+1, maximum_index+1, maximum_index-index);
update_statuslinef(LNG->MsgLister, "ST_MSGLISTER", index+1, maximum_index+1, maximum_index-index);
}
@ -803,7 +803,7 @@ void GThreadlist::do_delayed() {
if(CFG->switches.get(msglistpagebar))
wscrollbar(W_VERT, maximum_index+1, maximum_index, index);
update_statuslinef(LNG->MsgLister, index+1, maximum_index+1, maximum_index-index);
update_statuslinef(LNG->MsgLister, "ST_MSGLISTER", index+1, maximum_index+1, maximum_index-index);
}

View File

@ -303,7 +303,7 @@ int GMenuDomarks::Run(char* dowhat) {
else if(CFG->menumarked == MODE_DONT)
_prevtag = AA->Mark.Count() ? TAG_MARKED : TAG_CURRENT;
update_statuslinef("%i %s %s", AA->Mark.Count(), AA->Mark.Count() == 1 ? LNG->is : LNG->are, LNG->marked);
update_statuslinef("%i %s %s", "", AA->Mark.Count(), AA->Mark.Count() == 1 ? LNG->is : LNG->are, LNG->marked);
AskInit(6, 0, dowhat, H_AskDoMarks);
@ -481,7 +481,7 @@ int GMenuEditfile::Run(GMsg* __msg) {
for(;;) {
update_statuslinef(LNG->Quotepct, __msg->quotepct, __msg->quotepct > 80 ? "!!!" : "");
update_statuslinef(LNG->Quotepct, "ST_QUOTEPCT", __msg->quotepct, __msg->quotepct > 80 ? "!!!" : "");
char _title[80];
sprintf(_title, LNG->SaveMsg, __msg->lines);

View File

@ -195,7 +195,7 @@ void MarkMsgs_Txt(int item, char* markstring) {
}
}
update_statuslinef(LNG->SearchingMsg, n, AA->Msgn.Count(), marked);
update_statuslinef(LNG->SearchingMsg, "ST_SEARCHINGMSG", n, AA->Msgn.Count(), marked);
w_progress(MODE_UPDATE, C_INFOW, n, AA->Msgn.Count(), NULL);
if(AA->LoadMsg(msg, AA->Msgn[n-1], CFG->dispmargin-(int)CFG->switches.get(disppagebar))) {
@ -204,7 +204,7 @@ void MarkMsgs_Txt(int item, char* markstring) {
if(srchmgr.reverse ? not success : success) {
AA->Mark.Add(msg->msgno);
update_statuslinef(LNG->SearchingMsg, n, AA->Msgn.Count(), ++marked);
update_statuslinef(LNG->SearchingMsg, "ST_SEARCHINGMSG", n, AA->Msgn.Count(), ++marked);
}
}
}

View File

@ -280,7 +280,7 @@ static void MakeMsg3(int& mode, GMsg* msg) {
if(cc) {
std::string temp;
update_statuslinef(LNG->StatusCC, msg->to, msg->dest.make_string(temp).c_str());
update_statuslinef(LNG->StatusCC, "ST_STATUSCC", msg->to, msg->dest.make_string(temp).c_str());
}
msg->LinesToText();
@ -369,7 +369,7 @@ static void MakeMsg3(int& mode, GMsg* msg) {
AA->NewMsgno(cmsg);
{
std::string temp;
update_statuslinef(LNG->StatusCC, cmsg->to, cmsg->dest.make_string(temp).c_str());
update_statuslinef(LNG->StatusCC, "ST_STATUSCC", cmsg->to, cmsg->dest.make_string(temp).c_str());
}
// Do aka matching
@ -1227,7 +1227,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
throw_release(fspec);
if(crosspost and post_xparea.size())
update_statuslinef(LNG->Crossposting, AL[post_xparea.back()]->echoid());
update_statuslinef(LNG->Crossposting, "ST_CROSSPOSTING", AL[post_xparea.back()]->echoid());
} while(post_xparea.size());
_in_editor = NO;

View File

@ -408,7 +408,7 @@ int SearchTaglist(Echo* taglist, char* tag);
void set_title(const char* t, int p, int a);
void title_shadow();
void update_statusline(const char* info);
void update_statuslinef(const char* format, ...) __attribute__ ((format (printf, 1, 2)));
void update_statuslinef(const char* format, const char *token, ...) __attribute__ ((format (printf, 1, 3)));
void update_statuslines();
void w_info(const char* info=NULL);
void w_infof(const char* format, ...) __attribute__ ((format (printf, 1, 2)));

View File

@ -231,7 +231,7 @@ int ImportQWK() {
imported++;
AA->istossed = true;
update_statuslinef("%s: %u", AA->echoid(), imported);
update_statuslinef("%s: %u", "", AA->echoid(), imported);
msg->TextToLines(CFG->dispmargin-1);
if(msg->messageid or msg->references or msg->inreplyto or *msg->ifrom) {
@ -498,7 +498,7 @@ int ExportQwkArea(int areano, gfile& fp, int confno, int& pktmsgno) {
if(AA->LoadMsg(msg, AA->Expo[n], 80)) {
if(msg->attr.uns()) {
exported += ExportQwkMsg(msg, fp, confno, pktmsgno);
update_statuslinef("%s: %u", AA->echoid(), exported);
update_statuslinef("%s: %u", "", AA->echoid(), exported);
}
}
}

View File

@ -888,7 +888,7 @@ void Make_Userlist(const char* userlist) {
if(fp) {
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), LNG->GenUserlist);
for(n=AA->Msgn.Count(); n; n--) {
update_statuslinef(LNG->ReadingMsg, n, AA->Msgn.Count());
update_statuslinef(LNG->ReadingMsg, "ST_READINGMSG", n, AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, (AA->Msgn.Count()-n)+1, AA->Msgn.Count(), NULL);
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin);
crc = strCrc16(msg->by, false);
@ -950,7 +950,7 @@ void make_pathreport(const char* reportfile) {
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), "Generating PATH report");
for(int n=AA->Msgn.Count(); n>=AA->lastread(); n--) {
update_statuslinef(LNG->ReadingMsg, n, AA->Msgn.Count());
update_statuslinef(LNG->ReadingMsg, "ST_READINGMSG", n, AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, n, AA->Msgn.Count(), NULL);
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin-(int)CFG->switches.get(disppagebar));
address = msg->orig;

View File

@ -243,7 +243,7 @@ int AreaList::AreaScan(int mode, uint currno, int pmscan, int& pmails, int& pmar
}
scanned = YES;
if(not blanked)
update_statuslinef("%s %s", 1+LNG->ScanningArea, AA->echoid());
update_statuslinef("%s %s", "", 1+LNG->ScanningArea, AA->echoid());
if(dopmscan and (not dopmscanexcl or dopmscanincl)) {
AA->ScanAreaPM();
uint count = AA->PMrk.Count();

View File

@ -350,7 +350,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
if(lineno) {
AA->istossed = true;
update_statuslinef("%s: %u", AA->echoid(), msgs);
update_statuslinef("%s: %u", "", AA->echoid(), msgs);
msg->LinesToText();
AA->SaveMsg(GMSG_NEW, msg);
@ -731,7 +731,7 @@ int ExportSoupArea(int areano, char* msgfile, gfile& fp, int ismail) {
if(AA->LoadMsg(msg, AA->Expo[n], CFG->soupexportmargin)) {
if(msg->attr.uns() and not (msg->attr.del() or msg->attr.lok())) {
exported += ExportSoupMsg(msg, msgfile, fp, ismail);
update_statuslinef("%s: %u", AA->echoid(), exported);
update_statuslinef("%s: %u", "", AA->echoid(), exported);
}
}
}

View File

@ -191,7 +191,7 @@ void guserbase::close() {
void guserbase::do_delayed() {
wscrollbar(W_VERT, maximum_index+1, maximum_index, index);
update_statuslinef(LNG->UserStatusline, index+1, maximum_index+1, maximum_index-index);
update_statuslinef(LNG->UserStatusline, "ST_USERSTATUSLINE", index+1, maximum_index+1, maximum_index-index);
}

View File

@ -132,14 +132,35 @@ void update_statusline(const char* info) {
// ------------------------------------------------------------------
void update_statuslinef(const char* format, ...) {
void update_statuslinef(const char *format, const char *token, ...)
{
bool error = false;
char winfobuf[350];
va_list argptr;
va_start(argptr, format);
vsprintf(winfobuf, format, argptr);
va_start(argptr, token);
try
{
vsprintf(winfobuf, format, argptr);
}
catch(...)
{
if (*token)
sprintf(winfobuf, "ERROR: Update %s in your GOLDLANG.CFG or report to author.", token);
else
sprintf(winfobuf, "ERROR: \"%s\". Report to author.", format);
error = true;
}
va_end(argptr);
update_statusline(winfobuf);
if (error)
{
SayBibi();
waitkeyt(1000);
}
}
@ -286,7 +307,7 @@ void maketitle() {
int maketitle_and_status(char *dir) {
maketitle();
update_statuslinef(LNG->ImportStatus, dir);
update_statuslinef(LNG->ImportStatus, "ST_IMPORTSTATUS", dir);
return 0;
}

View File

@ -100,7 +100,7 @@ bool PopupLocked(long tries, int isopen, const char* file) {
else
strcpy(buf, file);
w_infof(LNG->WaitLocked, buf);
update_statuslinef(LNG->RetryOrESC, isopen ? LNG->RetryLock : LNG->RetryOpen , tries);
update_statuslinef(LNG->RetryOrESC, "ST_RETRYORESC", isopen ? LNG->RetryLock : LNG->RetryOpen , tries);
// Check for keypress
if(kbxhit()) {

View File

@ -183,7 +183,7 @@ void RenumberArea() {
TouchFile(AddPath(CFG->areapath, CFG->semaphore.netscan));
// Tell user we are finished
update_statuslinef("%u %s", AA->Msgn.Count(), LNG->Renumbered);
update_statuslinef("%u %s", "", AA->Msgn.Count(), LNG->Renumbered);
waitkeyt(5000);
}
}