From 4a77b5a598982d63738b46417176ef956da5c000 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Fri, 26 Aug 2005 23:14:24 +0000 Subject: [PATCH] Apply changes to MS Visual C build. Patch from Ianos Gnatiuc 2:469/335.155 --- golded3/gccfgg0.cpp | 12 ++++++++++-- golded3/gckeys.cpp | 14 ++++++++------ golded3/gealst.cpp | 11 +++++++++-- golded3/gearea.cpp | 8 ++++---- golded3/gectrl.cpp | 6 +++--- golded3/geedit.h | 13 +++++++------ golded3/geedit2.cpp | 14 +++++++++++--- golded3/geedit3.cpp | 10 +++++++++- golded3/gefile.cpp | 20 ++++++++++++++++++++ golded3/gehdre.cpp | 10 ++++++++++ golded3/geinit.cpp | 6 +++--- golded3/geline.cpp | 23 +++++++++++++++-------- golded3/gemlst.cpp | 17 ++++++++++++----- golded3/gemsgs.cpp | 9 ++++++++- golded3/geview.cpp | 33 ++++++++++++++++++++------------- golded3/golded3.cpp | 25 ++++++++++++++++--------- goldlib/gall/gcmpall.h | 3 --- goldlib/gall/gdefs.h | 18 +++++++++++++++++- goldlib/gall/gutlwin.cpp | 7 +++++++ goldlib/gall/gvidall.h | 4 +++- goldlib/gcfg/gxfm116.cpp | 14 +++++++++----- goldlib/gcfg/gximail6.cpp | 6 +++++- goldlib/gcfg/gxinter.cpp | 4 +++- goldlib/msgidlib/fexist.c | 5 +++++ goldlib/msgidlib/genmsgid.c | 2 +- goldlib/msgidlib/hsksupp.h | 11 +++++++++++ goldlib/smblib/filewrap.h | 4 ++++ goldlib/smblib/genwrap.h | 18 +++++++++++++++++- goldlib/uulib/config.h | 16 ++++++++++++++-- goldlib/uulib/uulib.c | 24 ++++++++++++------------ 30 files changed, 273 insertions(+), 94 deletions(-) diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index 68e6aeb..f139b85 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -637,7 +637,7 @@ End: return true; } - + // ------------------------------------------------------------------ @@ -783,7 +783,15 @@ int ReadCfg(const char* cfgfile, int ignoreunknown) { // Tell the world what we found if(veryverbose) - std::cout << " " << (cfgignore ? '-' : '+') << std::setw(4) << std::setfill('0') << line << std::setfill(' ') << ": " << key << " " << val << std::endl; + { +#if defined(_MSC_VER) + char buff[256]; + sprintf(buff, " %c %04d: %s %s\n", cfgignore ? '-' : '+', line, key, val); + std::cout << buff; +#else + std::cout << " " << (cfgignore ? '-' : '+') << std::setw(4) << std::setfill('0') << line << std::setfill(' ') << ": " << key << " " << val << std::endl; +#endif + } // Call switch function to act on the key if(not cfgignore) { diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index 48dd106..815b750 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -350,11 +350,11 @@ CmdKey DefaultKeyset[] = { { Key_A_1 , KK_HeaderToggleReserved , KT_H }, { Key_A_P , KK_HeaderTogglePvt , KT_H }, { Key_A_S , KK_HeaderToggleSent , KT_H }, - + { 0xFFFF , 0xFFFF , 0xFF } }; - + // ------------------------------------------------------------------ // must be sorted by crc_token @@ -889,7 +889,7 @@ static gkey SwitchKeyDefs(word crc, int* type) { *type = globalkeys[middle].keytype; return globalkeys[middle].keyval; } - + } while(left <= right); return 0; @@ -964,7 +964,8 @@ static void SetKeybDefaults() { // ------------------------------------------------------------------ -bool CmdKeyCmp(CmdKey a, CmdKey b) { +//bool CmdKeyCmp(CmdKey a, CmdKey b) { +bool operator<(CmdKey &a, CmdKey &b) { int cmp = CmpV(a.type, b.type); if(cmp != 0) @@ -1126,7 +1127,8 @@ int ReadKeysCfg(int force) { SetKeybDefaults(); // Prepare keyboard and macro tables for binary searching - CFG->cmdkey.sort(CmdKeyCmp); +// CFG->cmdkey.sort(CmdKeyCmp); + CFG->cmdkey.sort(); // Count keys std::list::iterator ck = CFG->cmdkey.begin(); @@ -1162,7 +1164,7 @@ int ReadKeysCfg(int force) { } } } - + return true; } diff --git a/golded3/gealst.cpp b/golded3/gealst.cpp index 82cebbf..602dd3d 100644 --- a/golded3/gealst.cpp +++ b/golded3/gealst.cpp @@ -24,6 +24,9 @@ // Arealist functions. // ------------------------------------------------------------------ +#if defined(__MINGW32__) || defined(_MSC_VER) +#include +#endif #include #include @@ -84,7 +87,7 @@ int compare_groups(int _ga, int _gb) else g++; } - + if(gap == NULL) { if(gbp != NULL) return 1; @@ -471,7 +474,11 @@ void SelMaskPick::close() { void SelMaskPick::print_line(uint idx, uint pos, bool isbar) { - __extension__ char buf[DESC_LEN+3]; +#if defined(__WIN32__) + char *buf = (char*)alloca(DESC_LEN+3); +#else + __extension__ char buf[DESC_LEN+3]; +#endif *buf = ' '; strxcpy(buf+1, AL.alistselections[idx], DESC_LEN); window.printns(pos, 0, isbar ? sattr : wattr, buf, xlen); diff --git a/golded3/gearea.cpp b/golded3/gearea.cpp index 5015e4e..6c12473 100644 --- a/golded3/gearea.cpp +++ b/golded3/gearea.cpp @@ -419,8 +419,8 @@ void GPickArealist::print_line(uint idx, uint pos, bool isbar) { int sep_pos = (desc_pos != -1) ? desc_pos : echoid_pos; - for(int c = 0; c < sep_pos; c++) - vbuf[c] = _box_table(btype, 1); + {for(int c = 0; c < sep_pos; c++) + vbuf[c] = _box_table(btype, 1);} vbuf[sep_pos] = NUL; wprintvs(pos, 0, battr|ACSET, vbuf); wprints(pos, sep_pos, tattr, area->desc()); @@ -428,8 +428,8 @@ void GPickArealist::print_line(uint idx, uint pos, bool isbar) { int l = strlen(area->desc()); int n = MAXCOL-2-sep_pos-l; - for(int c = 0; c < n; c++) - vbuf[c] = _box_table(btype,1); + {for(int c = 0; c < n; c++) + vbuf[c] = _box_table(btype,1);} vbuf[n] = NUL; wprintvs(pos, sep_pos+l, battr|ACSET, vbuf); } diff --git a/golded3/gectrl.cpp b/golded3/gectrl.cpp index 971dea0..50246a7 100644 --- a/golded3/gectrl.cpp +++ b/golded3/gectrl.cpp @@ -163,7 +163,7 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) { lp = s + strlen(s); - while((lp>s) and in_range(lp[-1], ' ', '\x7F')) + while((lp>s) and in_range(char(lp[-1]), char(' '), char('\x7F'))) lp--; for(const char* ptr = s; *ptr and (ptrnext; } - + // Make sure there is a blank line at the bottom, just before the tearline // Unless the line is a tagline (..., ___ etc). line = LastLine(msg->lin); diff --git a/golded3/geedit.h b/golded3/geedit.h index a0dedf4..ea13f98 100644 --- a/golded3/geedit.h +++ b/golded3/geedit.h @@ -136,6 +136,7 @@ public: text_item(uint __col, uint __len) : col(__col), len(__len) { } void* operator new(size_t size, uint text_len = 0) { return malloc(sizeof(text_item) + size + text_len); } void operator delete(void* ptr) { free(ptr); } + void operator delete(void* ptr, uint) { free(ptr); } }; // ---------------------------------------------------------------- @@ -159,20 +160,20 @@ struct col_rec { class UndoItem { static UndoItem** last_item; - + friend class UndoStack; - + public: UndoItem* prev; - + Line* line; // Cursor line col_rec col; // Cursor column uint pcol; // After undo move cursor to pcol, prow uint prow; // uint action; // Undo action data_rec data; // Undo data - + UndoItem() { this->prev = *last_item; } ~UndoItem() { *last_item = this->prev; } }; @@ -194,7 +195,7 @@ class UndoStack { uint& thisrow; Line*& currline; bool& undo_ready; - + public: UndoItem* last_item; @@ -335,7 +336,7 @@ public: IEclass(int __scol, int __ecol, int __srow, int __erow, int __border); ~IEclass(); - + // ---------------------------------------------------------------- // Function to start the editor diff --git a/golded3/geedit2.cpp b/golded3/geedit2.cpp index d71fa1b..300ac58 100644 --- a/golded3/geedit2.cpp +++ b/golded3/geedit2.cpp @@ -24,6 +24,10 @@ // The Internal Editor (IE), part 2. // ------------------------------------------------------------------ +#if defined(__MINGW32__) || defined(_MSC_VER) +#include +#endif + #include #include #include @@ -274,7 +278,7 @@ void IEclass::DelRtWord() { GFTRK(NULL); return; } - + int _ptr, _ptr2; _ptr = _ptr2 = col; @@ -391,7 +395,7 @@ void IEclass::GoBotLine() { Line *_oldcurrline = currline; int _oldrow = row; - + while((row < maxrow) and currline->next) { currline = currline->next; thisrow++; @@ -569,7 +573,7 @@ void IEclass::BlockCopy() { // Continue with the next line _firstcopyline = _firstcopyline->next; - } + } selecting = NO; blockcol = -1; @@ -1086,7 +1090,11 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) { else { int tabsz = CFG->disptabsize ? CFG->disptabsize : 1; +#if defined(_MSC_VER) || defined(__MINGW32__) + char *spaces = (char*)alloca(tabsz+1); +#else __extension__ char spaces[tabsz+1]; +#endif memset(spaces, ' ', tabsz); spaces[tabsz] = NUL; int level = LoadCharset(AA->Xlatimport(), CFG->xlatlocalset); diff --git a/golded3/geedit3.cpp b/golded3/geedit3.cpp index 20727eb..25c127c 100644 --- a/golded3/geedit3.cpp +++ b/golded3/geedit3.cpp @@ -24,6 +24,10 @@ // OS/2 clipboard to/from edit paste buffer. // ------------------------------------------------------------------ +#if defined(__MINGW32__) || defined(_MSC_VER) +#include +#endif + #include #include #include @@ -36,7 +40,11 @@ void IEclass::Clip2Buf() { return; int tabsz = CFG->disptabsize ? CFG->disptabsize : 1; +#if defined(__MINGW32__) || defined(_MSC_VER) + char *spaces = (char*)alloca(tabsz+1); +#else __extension__ char spaces[tabsz+1]; +#endif memset(spaces, ' ', tabsz); spaces[tabsz] = NUL; @@ -46,7 +54,7 @@ void IEclass::Clip2Buf() { Line *__line = NULL; Undo->undo_enabled = NO; - + // Read paragraphs while(clipbrd.read(buf, EDIT_PARABUFLEN-6)) { diff --git a/golded3/gefile.cpp b/golded3/gefile.cpp index 72a2691..6779797 100644 --- a/golded3/gefile.cpp +++ b/golded3/gefile.cpp @@ -24,6 +24,10 @@ // File handling. // ------------------------------------------------------------------ +#if defined(__MINGW32__) || defined(_MSC_VER) +#include +#endif + #include #include #include @@ -773,7 +777,11 @@ void FileRequest(GMsg* msg) { else ptr1 = ptr2; ptr2 = strskip_txt(ptr1); +#if defined(_MSC_VER) + char *tmpbuf = (char*)alloca(ptr2-ptr1+1); +#else __extension__ char tmpbuf[ptr2-ptr1+1]; +#endif strxcpy(tmpbuf, ptr1, ptr2-ptr1+1); frqgetfile(file, desc, filesize, tmpbuf); *desc = NUL; // Description never comes before filename @@ -811,7 +819,11 @@ void FileRequest(GMsg* msg) { if(txtptr[16] == '/' and txtptr[19] == '/' and txtptr[24] == '(' /*)*/) { ptr1 = strskip_wht(txtptr); ptr2 = strskip_txt(ptr1); +#if defined(_MSC_VER) + char *tmpbuf = (char*)alloca(ptr2-ptr1+1); +#else __extension__ char tmpbuf[ptr2-ptr1+1]; +#endif strxcpy(tmpbuf, ptr1, ptr2-ptr1+1); frqgetfile(file, desc, filesize, tmpbuf); *desc = NUL; // Description never comes before filename @@ -943,7 +955,11 @@ void FileRequest(GMsg* msg) { msg->attr.frq1(); ptr = freqfile[n]+1; // 01234567890123456 ptr2 = strskip_txt(ptr); +#if defined(_MSC_VER) + char *tmpbuf = (char*)alloca(ptr2-ptr+1); +#else __extension__ char tmpbuf[ptr2-ptr+1]; +#endif strxcpy(tmpbuf, ptr, ptr2-ptr+1); ptr2 = strskip_wht(ptr2); if((strlen(msg->re) + strlen(tmpbuf)) < sizeof(ISub)) { // We can only fill one subject line in this version... @@ -962,7 +978,11 @@ void FileRequest(GMsg* msg) { msg->attr.frq1(); ptr = freqfile[crsr]+1; // 01234567890123456 ptr2 = strskip_txt(ptr); +#if defined(_MSC_VER) + char *tmpbuf = (char*)alloca(ptr2-ptr+1); +#else __extension__ char tmpbuf[ptr2-ptr+1]; +#endif strxcpy(tmpbuf, ptr, ptr2-ptr+1); ptr2 = strskip_wht(ptr2); if((strlen(msg->re) + strlen(tmpbuf)) < sizeof(ISub)) { // We can only fill one subject line in this version... diff --git a/golded3/gehdre.cpp b/golded3/gehdre.cpp index beee559..58365e4 100644 --- a/golded3/gehdre.cpp +++ b/golded3/gehdre.cpp @@ -24,6 +24,10 @@ // Header edit. // ------------------------------------------------------------------ +#if defined(__MINGW32__) || defined(_MSC_VER) +#include +#endif + #include #include @@ -318,8 +322,14 @@ bool GMsgHeaderEdit::validate() { bool res = set_to_address(msg, &toname, &toaddr, &fromaddr, &subj, 0, LNG->SelectDestNode, lookup); vcurshow(); +#if defined(_MSC_VER) || defined(__MINGW32__) + size_t bot2size = EDIT->HdrNodeLen()+1; + char *bot2 = (char*)alloca(bot2size); + MakeAttrStr(bot2, bot2size, &msg->attr); +#else __extension__ char bot2[EDIT->HdrNodeLen()+1]; MakeAttrStr(bot2, sizeof(bot2), &msg->attr); +#endif strsetsz(bot2, EDIT->HdrNodeLen()); window.prints(1, EDIT->HdrNodePos(), C_HEADW, bot2); diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 58a4623..c6cd1da 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -447,7 +447,7 @@ static bool ExistCfg(char* path, char* file) { static bool FindCfg(char* path) { bool found = false; - + if(!is_dir(path)) { if(fexist(path)) return true; @@ -702,8 +702,8 @@ void Initialize(int argc, char* argv[]) { // Read/compile various configs compiled |= ReadLangCfg(cmdlineforce); - compiled |= ReadKeysCfg(cmdlineforce); - compiled |= ReadHelpCfg(cmdlineforce); + compiled |= bool(ReadKeysCfg(cmdlineforce)); + compiled |= bool(ReadHelpCfg(cmdlineforce)); // Initialize sound system InitSound(); diff --git a/golded3/geline.cpp b/golded3/geline.cpp index c40be70..9234e96 100644 --- a/golded3/geline.cpp +++ b/golded3/geline.cpp @@ -24,13 +24,16 @@ // Conversion of a raw message to a linked list of lines. // ------------------------------------------------------------------ +#if defined(_MSC_VER) || defined(__MINGW32__) + #include +#endif + #include #include #include #include #include - // ------------------------------------------------------------------ #ifdef __UNIX__ @@ -1388,7 +1391,11 @@ int ScanLine(GMsg* msg, Line* line, const char* ptr, int getvalue, int mask) { ptr++; char endchar = *ptr; +#if defined(_MSC_VER) || defined(__MINGW32__) + char *kludge = (char*)alloca(ptr-kludge1+1); +#else __extension__ char kludge[ptr-kludge1+1]; +#endif strxcpy(kludge, kludge1, ptr-kludge1+1); // Search for it in the known kludges list @@ -1585,7 +1592,7 @@ void ScanKludges(GMsg* msg, int getvalue) { nnel = cnd ? next_non_empty(line->next->next) : NULL; bool nextor = cnd ? (not nnel or nnel->type & GLINE_KLUDGE) and (line->next->txt.find(/*(*/')') != line->next->txt.npos) : false; if(not line->next or nextkl or nextor) { - + gotorig = YES; originlineno = lineno; line->type |= GLINE_ORIG; @@ -1647,11 +1654,11 @@ void ScanKludges(GMsg* msg, int getvalue) { if(getvalue) { // This is the new code (experimental) - // It looks for an Origin before taking MSGID + // It looks for an Origin before taking MSGID // Trust msg->orig if valid and we're in netmail area. // (msg->orig is already merged with INTL/FMPT/TOPT) - if(not (AA->isnet() and msg->orig.valid())) { + if(not (AA->isnet() and msg->orig.valid())) { if(CFG->addresslookupfirst and msg->msgid.valid()) msg->orig = msg->msgid; else if((ptr = strrchr(msg->origin, '(' /*)*/ )) != NULL) { @@ -2030,7 +2037,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) { // Get type of line if(wraps == 0) { - + if(gotmultipart) { if(*ptr == '-' and ptr[1] == '-') { gstrarray::iterator ib; @@ -2043,10 +2050,10 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) { else if(*ptr == '\n' or *ptr == '\r') inheader = false; } - + if(inheader and (*ptr != '-')) line->type |= GLINE_HIDD; - + para = 0; if(*ptr == CTRL_A or inheader) { // Found kludge/hidden line para = GLINE_KLUD; @@ -3019,7 +3026,7 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr, bool detect_ *__name = *__addr = NUL; char* commaptr = NULL; - + if(strchr(__string, ',')) { bool inquotes = false; commaptr = __string; diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index 47e82b6..5934087 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -24,12 +24,15 @@ // Message lister. // ------------------------------------------------------------------ +#if defined(_MSC_VER) || defined(__MINGW32__) + #include +#endif + #include #include #include #include - // ------------------------------------------------------------------ extern GMsg* reader_msg; @@ -210,7 +213,7 @@ void GMsgList::ReadMlst(int n) { // ------------------------------------------------------------------ void GMsgList::do_delayed() { - + // Update header and statusline if(AA->Msglistheader()) { ReadMlst(index); @@ -733,7 +736,7 @@ void GThreadlist::update_title() { // ------------------------------------------------------------------ void GThreadlist::do_delayed() { - + // Update header and statusline if(AA->Msglistheader()) { AA->LoadMsg(&msg, list[index].msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); @@ -839,7 +842,11 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) { char buf[256]; ulong maxlev = (window.width()+h_offset+1)/2; +#if defined(_MSC_VER) || defined(__MINGW32__) + char *buf2 = (char*)alloca(maxlev*2+2); +#else __extension__ char buf2[maxlev*2+2]; +#endif int attrh, attrw; uint tdlen; @@ -868,11 +875,11 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) { } GenTree(buf2, idx, maxlev); - + #if defined(__UNIX__) && !defined(__USE_NCURSES__) gvid_boxcvt(buf2); #endif - + char marks[3]; strcpy(marks, " "); diff --git a/golded3/gemsgs.cpp b/golded3/gemsgs.cpp index f4af6e3..1092d3f 100644 --- a/golded3/gemsgs.cpp +++ b/golded3/gemsgs.cpp @@ -24,11 +24,14 @@ // Misc. msg handling. // ------------------------------------------------------------------ +#if defined(_MSC_VER) || defined(__MINGW32__) + #include +#endif + #include #include #include - // ------------------------------------------------------------------ static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int cnt = 0, ...) { @@ -450,7 +453,11 @@ void LoadText(GMsg* msg, const char* textfile) { buf = (char*)throw_malloc(PBUFSIZE); int tabsz = CFG->disptabsize ? CFG->disptabsize : 1; +#if defined(_MSC_VER) || defined(__MINGW32__) + char *spaces = (char*)alloca(tabsz+1); +#else __extension__ char spaces[tabsz+1]; +#endif memset(spaces, ' ', tabsz); spaces[tabsz] = NUL; diff --git a/golded3/geview.cpp b/golded3/geview.cpp index 44d9912..c642430 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -24,10 +24,13 @@ // Message viewer class implementation. // ------------------------------------------------------------------ +#if defined(_MSC_VER) || defined(__MINGW32__) + #include +#endif + #include #include - // ------------------------------------------------------------------ GMsgHeaderView::GMsgHeaderView() { @@ -86,7 +89,7 @@ void GMsgHeaderView::Use(Area *areaptr, GMsg *msgptr) { msg = msgptr; } - + // ------------------------------------------------------------------ void GMsgHeaderView::Paint() { @@ -107,7 +110,11 @@ void GMsgHeaderView::Paint() { else *buf1 = NUL; +#if defined(_MSC_VER) || defined(__MINGW32__) + char *top = (char*)alloca(width+1); +#else __extension__ char top[width+1]; +#endif strxmerge(top, width+1, " ", buf1, strtrim(strtmp(area->desc())), " (", area->isinternet() ? area->Internetaddress() : area->Aka().addr.make_string(buf), ") ", NULL); @@ -413,7 +420,7 @@ void GMsgBodyView::Use(Area *areaptr, GMsg *msgptr, int startline) { window.set_scrollbar_color(scrollbar_visible ? scrollbar_color : -1); } - + // ------------------------------------------------------------------ void GMsgBodyView::PaintLine(int row, Line *line) { @@ -452,7 +459,7 @@ void GMsgBodyView::PaintLine(int row, Line *line) { void GMsgBodyView::Paint() { window.activate_quick(); - + Line* dummy_index = NULL; Line** line_index = msg->line ? (msg->line + upperline) : &dummy_index; @@ -474,7 +481,7 @@ int GMsgBodyView::Top(int redraw) { Paint(); return true; } - + return false; } @@ -482,7 +489,7 @@ int GMsgBodyView::Top(int redraw) { // ------------------------------------------------------------------ int GMsgBodyView::Bottom() { - + if(msg->lines > height) { if(msg->lines <= height) { can_pagedown = true; @@ -496,7 +503,7 @@ int GMsgBodyView::Bottom() { Paint(); return true; } - + return false; } @@ -516,7 +523,7 @@ int GMsgBodyView::PageUp() { return true; } } - + return false; } @@ -537,7 +544,7 @@ int GMsgBodyView::PageDown() { } } } - + return false; } @@ -545,7 +552,7 @@ int GMsgBodyView::PageDown() { // ------------------------------------------------------------------ int GMsgBodyView::LineUp() { - + if(msg->lines > height) { if(upperline) { window.scroll_down(); @@ -596,10 +603,10 @@ int GMsgBodyView::LineDown() { // ------------------------------------------------------------------ int GMsgBodyView::Continue() { - + if(can_pagedown) return PageDown(); - + return false; } @@ -615,7 +622,7 @@ int GMsgBodyView::ThumbTrack(int pos) { // ------------------------------------------------------------------ int GMsgBodyView::ThumbPosition(int pos) { - + upperline = pos; lowerline = upperline + height - 1; can_pagedown = lowerline < (msg->lines-1); diff --git a/golded3/golded3.cpp b/golded3/golded3.cpp index 691c560..63ce40c 100644 --- a/golded3/golded3.cpp +++ b/golded3/golded3.cpp @@ -29,18 +29,19 @@ // ------------------------------------------------------------------ -#define __GVER_PID__(A,SIZE) __GVER_PRE##SIZE##NAME__ __GVER_##SIZE##NAME__ __GVER_POST##SIZE##NAME__ __GVER_##SIZE##PLATFORM__ +#define __GVER_LONGPID__ __GVER_PRENAME__ __GVER_NAME__ __GVER_POSTNAME__ __GVER_PLATFORM__ +#define __GVER_SHORTPID__ __GVER_PRESHORTNAME__ __GVER_SHORTNAME__ __GVER_POSTSHORTNAME__ __GVER_SHORTPLATFORM__ #define __GVER_VER__(A,B,C) __GVER_PREVERSION__ #A "." #B "." #C __GVER_POSTVERSION__ #define __GVER_SVER__(A,B,C) #A "." #B "." #C #define __GVER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__) \ -int __gver_major__ = __GVER_MAJOR__; \ -int __gver_minor__ = __GVER_MINOR__; \ -int __gver_release__ = __GVER_RELEASE__; \ -const char* __gver_longpid__ = __GVER_PID__(,); \ -const char* __gver_shortpid__ = __GVER_PID__(,SHORT); \ -const char* __gver_ver__ = __GVER_VER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__); \ -const char* __gver_shortver__ = __GVER_SVER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__); + int __gver_major__ = __GVER_MAJOR__; \ + int __gver_minor__ = __GVER_MINOR__; \ + int __gver_release__ = __GVER_RELEASE__; \ + const char* __gver_longpid__ = __GVER_LONGPID__; \ + const char* __gver_shortpid__ = __GVER_SHORTPID__; \ + const char* __gver_ver__ = __GVER_VER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__); \ + const char* __gver_shortver__ = __GVER_SVER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__); // ------------------------------------------------------------------ @@ -97,7 +98,13 @@ const char* __gver_shortver__ = __GVER_SVER__(__GVER_MAJOR__,__GVER_MINOR__,__GV #define __GVER_SHORTLOGNAME__ "2" #define __GVER_CFGEXT__ ".geo" #elif defined(__WIN32__) +#if defined(_MSC_VER) +#define __GVER_PLATFORM__ "/W32-MSVC" +#elif defined(__MINGW32__) +#define __GVER_PLATFORM__ "/W32-MINGW" +#else #define __GVER_PLATFORM__ "/W32" +#endif #define __GVER_SHORTPLATFORM__ "W32" #define __GVER_SHORTLOGNAME__ "W" #define __GVER_CFGEXT__ ".gew" @@ -106,7 +113,7 @@ const char* __gver_shortver__ = __GVER_SVER__(__GVER_MAJOR__,__GVER_MINOR__,__GV #define __GVER_SHORTPLATFORM__ "LNX" #define __GVER_SHORTLOGNAME__ "L" #define __GVER_CFGEXT__ ".gel" -#elif defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #define __GVER_PLATFORM__ "/BSD" #define __GVER_SHORTPLATFORM__ "BSD" #define __GVER_SHORTLOGNAME__ "B" diff --git a/goldlib/gall/gcmpall.h b/goldlib/gall/gcmpall.h index 9241adc..2874a3c 100644 --- a/goldlib/gall/gcmpall.h +++ b/goldlib/gall/gcmpall.h @@ -119,7 +119,4 @@ /* --------------------------------------------------------------- */ - #endif - -/* --------------------------------------------------------------- */ diff --git a/goldlib/gall/gdefs.h b/goldlib/gall/gdefs.h index 135585d..9d81069 100644 --- a/goldlib/gall/gdefs.h +++ b/goldlib/gall/gdefs.h @@ -28,12 +28,28 @@ #ifndef __goldall_h #define __goldall_h - // ------------------------------------------------------------------ #include #include +// ------------------------------------------------------------------ +// Disable some MS Visual C warnings + +#if defined(_MSC_VER) +// +// C4786: 'identifier' : identifier was truncated to 'number' +// characters in the debug information +// +// C4800: 'type' : forcing value to bool 'true' or 'false' +// (performance warning) +// +// C4065: switch statement contains 'default' but no 'case' labels +// +// C4200: nonstandard extension used : zero-sized array in struct/union +// +#pragma warning(disable: 4200 4786 4800 4065) +#endif // ------------------------------------------------------------------ // Define portability and shorthand notation diff --git a/goldlib/gall/gutlwin.cpp b/goldlib/gall/gutlwin.cpp index 35a560c..2721520 100644 --- a/goldlib/gall/gutlwin.cpp +++ b/goldlib/gall/gutlwin.cpp @@ -46,6 +46,10 @@ char ge_win_coldtitle[GMAXTITLE+1] = ""; char ge_win_title[GMAXTITLE+1] = ""; int ge_win_ext_title; +#if defined(_MSC_VER) +extern "C" +{ +#endif char tu[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -115,6 +119,9 @@ char tl[256] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; +#if defined(_MSC_VER) +} +#endif WCHAR oem2unicode[256]; diff --git a/goldlib/gall/gvidall.h b/goldlib/gall/gvidall.h index f230d3a..5051611 100644 --- a/goldlib/gall/gvidall.h +++ b/goldlib/gall/gvidall.h @@ -31,7 +31,9 @@ // ------------------------------------------------------------------ - +#if defined(_MSC_VER) +#pragma warning(disable: 4200) +#endif #include #if defined(__USE_NCURSES__) #include diff --git a/goldlib/gcfg/gxfm116.cpp b/goldlib/gcfg/gxfm116.cpp index 14040b4..1c92822 100644 --- a/goldlib/gcfg/gxfm116.cpp +++ b/goldlib/gcfg/gxfm116.cpp @@ -153,7 +153,7 @@ void gareafile::ReadFMail116(FILE* fp, char* path, char* file, char* options) { aa.setdesc("FMail Personal Mail"); aa.setautoid("ECHO_PERSONAL"); AddNewArea(aa); - } + } headerType hdr; @@ -232,7 +232,7 @@ void gareafile::ReadFMail116(FILE* fp, char* path, char* file, char* options) { fclose(fp); } - + throw_delete(cfg); } @@ -278,7 +278,7 @@ void gareafile::ReadFMail(char* tag) { rewind(fp); uint fmver = (_rev.vmajor << 8) | _rev.vminor; - + if(fmver < 94) ReadFMail092(fp, path, file, options); else { @@ -297,8 +297,12 @@ void gareafile::ReadFMail(char* tag) { ReadFMail098(fp, path, file, options); else if((ar_rev >= 0x0110) and (ar_rev < 0x0200)) ReadFMail116(fp, path, file, options); - else - std::cout << "* Error: Unknown FMail config revision " << std::setfill('0') << std::setw(4) << std::hex << ar_rev << "h - Skipping." << std::endl; + else { + char buff[56+sizeof(uint)*2]; + sprintf(buff, "* Error: Unknown FMail config revision %04Xh - Skipping.\n", ar_rev); + std::cout << buff; +// std::cout << "* Error: Unknown FMail config revision " << std::setfill('0') << std::setw(4) << std::hex << ar_rev << "h - Skipping." << std::endl; + } } } } diff --git a/goldlib/gcfg/gximail6.cpp b/goldlib/gcfg/gximail6.cpp index f6f0050..315604f 100644 --- a/goldlib/gcfg/gximail6.cpp +++ b/goldlib/gcfg/gximail6.cpp @@ -218,7 +218,11 @@ void gareafile::ReadIMail(char* tag) { #endif } } - std::cout << "* Error: IMAIL " << imver[0] << '.' << std::setfill('0') << std::setw(2) << imver[1] << " (structure revision " << imstructver[0] << '.' << std::setfill('0') << std::setw(2) << imstructver[1] << ") is not supported - Skipping." << std::endl; + char buff[78]; + sprintf(buff, "* Error: IMAIL %c.%02c (structure revision %c.%02c) is not supported - Skipping.\n", imver[0], imver[1], imstructver[0], imstructver[1]); + std::cout << buff; + +// std::cout << "* Error: IMAIL " << imver[0] << '.' << std::setfill('0') << std::setw(2) << imver[1] << " (structure revision " << imstructver[0] << '.' << std::setfill('0') << std::setw(2) << imstructver[1] << ") is not supported - Skipping." << std::endl; } } diff --git a/goldlib/gcfg/gxinter.cpp b/goldlib/gcfg/gxinter.cpp index dc35ebe..7da3cf0 100644 --- a/goldlib/gcfg/gxinter.cpp +++ b/goldlib/gcfg/gxinter.cpp @@ -216,7 +216,9 @@ void gareafile::ReadInterMail(char* tag) { } } else { - std::cout << "* Error: InterMail revision " << std::setfill('0') << std::setw(4) << std::hex << ctl->sysrev << "h is not supported - Skipping." << std::endl; + char buff[62+sizeof(ctl->sysrev)*2]; + sprintf(buff, "* Error: InterMail revision %04Xh is not supported - Skipping.\n", ctl->sysrev); + std::cout << buff; } throw_free(ctl); } diff --git a/goldlib/msgidlib/fexist.c b/goldlib/msgidlib/fexist.c index 6dc7eae..80b58a5 100755 --- a/goldlib/msgidlib/fexist.c +++ b/goldlib/msgidlib/fexist.c @@ -42,6 +42,11 @@ #include #endif #endif +#if defined(_MSC_VER) +#include +#include +#endif + #include "hsksupp.h" #include "ffind.h" diff --git a/goldlib/msgidlib/genmsgid.c b/goldlib/msgidlib/genmsgid.c index 68784b9..153f684 100755 --- a/goldlib/msgidlib/genmsgid.c +++ b/goldlib/msgidlib/genmsgid.c @@ -37,7 +37,7 @@ #endif #if defined(UNIX) || defined(__DJGPP__) || defined(__EMX__) # include -#endif +#endif #if defined(UNIX) #define stricmp strcasecmp diff --git a/goldlib/msgidlib/hsksupp.h b/goldlib/msgidlib/hsksupp.h index 9f71dfe..62246b2 100755 --- a/goldlib/msgidlib/hsksupp.h +++ b/goldlib/msgidlib/hsksupp.h @@ -46,6 +46,17 @@ #define O_BINARY 0 #endif +#if defined(_MSC_VER) +# define sleep(x) Sleep(1000L*(x)) +#endif + +# ifndef S_ISDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# endif +# ifndef S_ISREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# endif + /* fexists.c */ int fexist(const char *filename); long fsize(const char *filename); diff --git a/goldlib/smblib/filewrap.h b/goldlib/smblib/filewrap.h index 71b5c08..ba8bae4 100644 --- a/goldlib/smblib/filewrap.h +++ b/goldlib/smblib/filewrap.h @@ -1,7 +1,11 @@ #ifndef __filewrap_h #define __filewrap_h +#if defined(_MSC_VER) +#include +#else #include +#endif #define sopen(fn,access,share) (sopen)((fn),(access),(share),S_IREAD|S_IWRITE) diff --git a/goldlib/smblib/genwrap.h b/goldlib/smblib/genwrap.h index 34d5487..cbe7c87 100644 --- a/goldlib/smblib/genwrap.h +++ b/goldlib/smblib/genwrap.h @@ -1,12 +1,28 @@ #ifndef __genwrap_h #define __genwrap_h +#if defined(_MSC_VER) +#include +#include +#include +#else #include +#endif #ifndef __BEOS__ -#define SLEEP(a) usleep(a) + #if defined(_MSC_VER) + #define SLEEP(a) Sleep(a) + #else + #define SLEEP(a) usleep(a) + #endif #else #include #define SLEEP(a) snooze(a) #endif + +#if defined(_MSC_VER) +int lock(int handle, long offset, long length); +int unlock(int handle, long offset, long length); +#endif + #endif // __genwrap_h diff --git a/goldlib/uulib/config.h b/goldlib/uulib/config.h index 3a44872..dd49171 100644 --- a/goldlib/uulib/config.h +++ b/goldlib/uulib/config.h @@ -1,6 +1,14 @@ /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader. */ +/* if not defined by make */ +#if !defined(VERSION) +#define VERSION "0.5" +#endif +#if !defined(PATCH) +#define PATCH "15" +#endif + /* Define to `unsigned' if doesn't define. */ /* #undef size_t */ @@ -8,7 +16,9 @@ #define STDC_HEADERS 1 /* Define if you can safely include both and . */ +#ifndef _MSC_VER #define TIME_WITH_SYS_TIME 1 +#endif /* * If your system is kinda special @@ -26,12 +36,12 @@ /* * how to declare functions that are exported from the UU library */ -#define UUEXPORT +#define UUEXPORT /* * how to declare functions that are exported from the fptools library */ -#define TOOLEXPORT +#define TOOLEXPORT /* * define if your compiler supports function prototypes @@ -69,7 +79,9 @@ /* #undef HAVE_STDARG_H */ /* Define if you have the header file. */ +#ifndef _MSC_VER #define HAVE_SYS_TIME_H 1 +#endif /* Define if you have the header file. */ #ifndef _MSC_VER diff --git a/goldlib/uulib/uulib.c b/goldlib/uulib/uulib.c index c497e95..dbed3cc 100644 --- a/goldlib/uulib/uulib.c +++ b/goldlib/uulib/uulib.c @@ -84,7 +84,7 @@ char * uulib_id = "$Id$"; #ifdef SYSTEM_WINDLL -BOOL _export WINAPI +BOOL _export WINAPI DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, LPVOID lpCmdLine) { @@ -574,7 +574,7 @@ UUstrerror (int code) */ int UUEXPORT -UUSetMsgCallback (void *opaque, +UUSetMsgCallback (void *opaque, void (*func) _ANSI_ARGS_((void *, char *, int))) { uu_MsgCallback = func; @@ -713,7 +713,7 @@ UULoadFile (char *filename, char *fileid, int delflag) fileid = filename; while (!feof (datei) && !ferror (datei)) { - /* + /* * Peek file, or some systems won't detect EOF */ res = fgetc (datei); @@ -721,7 +721,7 @@ UULoadFile (char *filename, char *fileid, int delflag) break; else ungetc (res, datei); - + if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) { if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) { UUkillfread (loaded); @@ -769,7 +769,7 @@ UULoadFile (char *filename, char *fileid, int delflag) if (uu_fast_scanning && sr != UURET_CONT) break; continue; } - + if ((fload = UUPreProcessPart (loaded, &res)) == NULL) { /* * no useful data found @@ -799,7 +799,7 @@ UULoadFile (char *filename, char *fileid, int delflag) (loaded->end) ? "end" : "", codenames[loaded->uudet]); } - + if ((res = UUInsertPartToList (fload))) { /* * couldn't use the data @@ -897,7 +897,7 @@ UUDecodeFile (uulist *thefile, char *destname) /* * Determine the name of the target file according to the rules: - * + * * IF (destname!=NULL) THEN filename=destname; * ELSE * filename = thefile->filename @@ -1044,7 +1044,7 @@ UUInfoFile (uulist *thefile, void *opaque, */ if (uu_FileCallback) { - if ((res = (*uu_FileCallback) (uu_FileCBArg, + if ((res = (*uu_FileCallback) (uu_FileCBArg, thefile->thisfile->data->sfname, uugen_fnbuffer, 1)) != UURET_OK) @@ -1061,7 +1061,7 @@ UUInfoFile (uulist *thefile, void *opaque, else { if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), + uustring (S_NOT_OPEN_FILE), thefile->thisfile->data->sfname, strerror (uu_errno=errno)); return UURET_IOERR; @@ -1076,7 +1076,7 @@ UUInfoFile (uulist *thefile, void *opaque, fseek (inpfile, thefile->thisfile->data->startpos, SEEK_SET); maxpos = thefile->thisfile->data->startpos + thefile->thisfile->data->length; - while (!feof (inpfile) && + while (!feof (inpfile) && (uu_fast_scanning || ftell(inpfile) < maxpos)) { if (_FP_fgets (uugen_inbuffer, 511, inpfile) == NULL) break; @@ -1112,7 +1112,7 @@ UUInfoFile (uulist *thefile, void *opaque, fclose (inpfile); if (uu_FileCallback) - (*uu_FileCallback) (uu_FileCBArg, + (*uu_FileCallback) (uu_FileCBArg, thefile->thisfile->data->sfname, uugen_fnbuffer, 0); @@ -1121,7 +1121,7 @@ UUInfoFile (uulist *thefile, void *opaque, return UURET_OK; } - + int UUEXPORT UURenameFile (uulist *thefile, char *newname) {