EditMsgSize removed, TEMPPATH used for temporary files storage instead of GOLDPATH, more accurate error handling in JAM, fix formatting

This commit is contained in:
Alexander S. Aganichev
2001-12-15 23:56:43 +00:00
parent b6740ee13d
commit b92274e3f8
21 changed files with 115 additions and 108 deletions

View File

@@ -38,12 +38,6 @@ uint WideSharemode = SH_DENYNO;
int WideDispsoftcr = false;
int WidePersonalmail = 0;
#if defined(GOLD_16BIT)
long WideMsgSize = 64000L;
#else
long WideMsgSize = 512000L;
#endif
// ------------------------------------------------------------------

View File

@@ -271,7 +271,6 @@ const int PM_LISTONLY = 0x0004;
extern glog* WideLog;
extern int WideDebug;
extern int WideCanLock;
extern long WideMsgSize;
extern const char** WideUsername;
extern int WideUsernames;
extern uint WideSharemode;

View File

@@ -129,15 +129,12 @@ int FidoArea::load_message(int __mode, gmsg* __msg, FidoHdr& __hdr) {
// If message text is used
if(__mode & GMSG_TXT) {
// Get length of message text and adjust if necessary
long _fillen = filelength(_fh);
long _txtlen = _fillen >= sizeof(FidoHdr) ? _fillen - sizeof(FidoHdr) : 0;
if((_txtlen+256) > WideMsgSize)
_txtlen = WideMsgSize;
uint _alloclen = (uint)(_txtlen+256);
// Get length of message text
size_t _fillen = filelength(_fh);
uint _txtlen = (uint) ((_fillen >= sizeof(FidoHdr)) ? (_fillen - sizeof(FidoHdr)) : 0);
// Allocate space for the message text
__msg->txt = (char*)throw_calloc(1, _alloclen);
__msg->txt = (char*)throw_calloc(1, _txtlen+256);
// Read the message text
read(_fh, __msg->txt, (uint)_txtlen);

View File

@@ -163,16 +163,11 @@ int _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::load_message(in
// If message text is used
if(__mode & GMSG_TXT) {
// Get length of message text and adjust if necessary
// Get length of message text
uint _numrecs = __hdr.numrecs;
long _txtlen = (long)(_numrecs+1)*256L;
if(_txtlen > WideMsgSize) {
_txtlen = WideMsgSize;
_numrecs = (uint)(_txtlen/256L);
}
// Allocate memory for message text
__msg->txt = (char*)throw_realloc(__msg->txt, (_numrecs+1)*256);
__msg->txt = (char*)throw_realloc(__msg->txt, _numrecs*256+256);
*__msg->txt = NUL;
// Read message text and convert it to a NUL-terminated C string

View File

@@ -56,6 +56,15 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
lseekset(data->fhjhr, _idx.hdroffset);
read(data->fhjhr, &__hdr, sizeof(JamHdr));
if(strncmp(__hdr.signature, "JAM", 4) != 0) {
WideLog->printf("! Invalid signature found in %s (msgno %ld).", path(), __msg->msgno);
WideLog->printf(": Info: Your msgbase is corrupted.");
WideLog->printf("+ Advice: Run a msgbase index rebuild/recover utility.");
GFTRK(NULL);
return false;
}
__msg->link.to_set(__hdr.replyto);
__msg->link.first_set(__hdr.reply1st);
__msg->link.next_set(__hdr.replynext);
@@ -327,11 +336,7 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
uint _kludgelen1 = strlen(_kludges);
uint _kludgelen2 = strlen(_kludges2);
uint _kludgelen = _kludgelen1 + _kludgelen2;
// Make sure the msg size is within user/system limits
ulong _msgsize = __hdr.txtlen;
if((_msgsize+_kludgelen) > (uint) WideMsgSize)
_msgsize = WideMsgSize - _kludgelen;
// Allocate memory for the message text
__msg->txt = (char*)throw_realloc(_kludges, (uint)(_msgsize+_kludgelen+256));

View File

@@ -92,10 +92,7 @@ int PcbArea::load_message(int __mode, gmsg* __msg, PcbHdr& __hdr) {
strtrim(strncpy(__msg->re, __hdr.subject, 25));
strtrim(strncpy(__msg->pcboard.password, __hdr.password, 12));
// Make sure the msg size is within user/system limits
uint _msgsize = (uint)__msg->txtlength;
if(_msgsize > WideMsgSize)
_msgsize = (uint)WideMsgSize;
// Allocate memory for the message text
__msg->txt = (char*)throw_realloc(__msg->txt, _msgsize+256);

View File

@@ -170,14 +170,11 @@ int WCatArea::load_message(int __mode, gmsg* __msg, WCatHdr& __hdr) {
// If message text is requested
if(__mode & GMSG_TXT) {
// Get length of message text
uint _txtlen = __hdr.msgbytes;
if((_txtlen+256) > WideMsgSize)
_txtlen = (uint)WideMsgSize;
uint _alloclen = (uint)(_txtlen+256);
// Get length of message text and adjust if necessary
// Allocate space for the message text
__msg->txt = (char*)throw_calloc(1, _alloclen);
__msg->txt = (char*)throw_calloc(1, _txtlen+256);
// Read the message text
read(_fhdat, __msg->txt, _txtlen);
@@ -185,7 +182,7 @@ int WCatArea::load_message(int __mode, gmsg* __msg, WCatHdr& __hdr) {
// Convert kludge char from NUL to CTRL-A
char* p = __msg->txt;
for(int n=0; n<_txtlen; n++,p++) {
if(!*p)
if(*p == '\0')
*p = CTRL_A;
}
}

View File

@@ -132,14 +132,11 @@ int XbbsArea::load_message(int __mode, gmsg* __msg, XbbsHdr& __hdr) {
// If message text is requested
if(__mode & GMSG_TXT) {
// Get length of message text
uint _txtlen = __hdr.length;
if((_txtlen+256) > WideMsgSize)
_txtlen = WideMsgSize;
uint _alloclen = (uint)(_txtlen+256);
// Get length of message text and adjust if necessary
// Allocate space for the message text
__msg->txt = (char*)throw_calloc(1, _alloclen);
__msg->txt = (char*)throw_calloc(1, _txtlen+256);
// Read the message text
lseekset(data->fhtext, __hdr.start);