Fixed compilation issues caused by the last commit of SMB, fixed hang on broken SMB

This commit is contained in:
Alexander S. Aganichev 2002-09-03 07:17:19 +00:00
parent 765ec7097d
commit 36ab81f044
2 changed files with 21 additions and 17 deletions

View File

@ -435,15 +435,16 @@ add:
} }
common: common:
fseek(data->sdt_fp, smsg.hdr.offset + smsg.dfield[i].offset, SEEK_SET); fseek(data->sdt_fp, smsg.hdr.offset + smsg.dfield[i].offset, SEEK_SET);
fread(&xlat, 2, 1, data->sdt_fp); l = sizeof(xlat);
l = 2; fread(&xlat, sizeof(xlat), 1, data->sdt_fp);
lzh = false; lzh = false;
while(xlat != XLAT_NONE) { if(xlat == XLAT_LZH) {
if(xlat == XLAT_LZH) lzh = true;
lzh = true; fread(&xlat, sizeof(xlat), 1, data->sdt_fp);
fread(&xlat, 2, 1, data->sdt_fp); l += sizeof(xlat);
l += 2;
} }
if(xlat != XLAT_NONE) /* no other translations currently supported */
continue;
if(lzh) { if(lzh) {
inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length); inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length);
fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp); fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp);
@ -459,7 +460,7 @@ common:
} }
else else
outlen = 0; outlen = 0;
txt_len+=outlen; txt_len += outlen;
msg->txt[txt_len-1] = NUL; msg->txt[txt_len-1] = NUL;
break; break;
} }
@ -1059,15 +1060,16 @@ Line* SMBArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head)
} }
common: common:
fseek(data->sdt_fp, smsg.hdr.offset + smsg.dfield[i].offset, SEEK_SET); fseek(data->sdt_fp, smsg.hdr.offset + smsg.dfield[i].offset, SEEK_SET);
fread(&xlat, 2, 1, data->sdt_fp); l = sizeof(xlat);
l = 2; fread(&xlat, sizeof(xlat), 1, data->sdt_fp);
lzh = false; lzh = false;
while(xlat != XLAT_NONE) { if(xlat == XLAT_LZH) {
if(xlat == XLAT_LZH) lzh = true;
lzh = true; fread(&xlat, sizeof(xlat), 1, data->sdt_fp);
fread(&xlat, 2, 1, data->sdt_fp); l += sizeof(xlat);
l += 2;
} }
if(xlat != XLAT_NONE) /* no other translations currently supported */
continue;
if(lzh) { if(lzh) {
inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length); inbuf = (uchar *)throw_xmalloc(smsg.dfield[i].length);
fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp); fread(inbuf, smsg.dfield[i].length - l, 1, data->sdt_fp);

View File

@ -377,7 +377,9 @@ enum {
/************/ /************/
#if defined(_WIN32) || defined(__BORLANDC__) #if defined(_WIN32) || defined(__BORLANDC__)
#define PRAGMA_PACK #ifndef PRAGMA_PACK
#define PRAGMA_PACK
#endif
#endif #endif
#if defined(PRAGMA_PACK) #if defined(PRAGMA_PACK)
@ -487,7 +489,7 @@ typedef struct _PACK { // Network (type and address)
#if defined(PRAGMA_PACK) #if defined(PRAGMA_PACK)
#if defined(__GNUC__) #if defined(__GNUC__)
#define pack() #pragma pack()
#else #else
#pragma pack(pop) /* original packing */ #pragma pack(pop) /* original packing */
#endif #endif