Changed all integer types to intN_t types

This commit is contained in:
Ianos Gnatiuc 2005-10-21 17:47:34 +00:00
parent 6a9a1b0834
commit ec38c82df5
5 changed files with 933 additions and 936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,79 +5,77 @@
/* $Id$ */ /* $Id$ */
/**************************************************************************** /****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Rob Swindell's conversion of 1988 LZH (LHarc) encoding functions * * Rob Swindell's conversion of 1988 LZH (LHarc) encoding functions *
* Based on Japanese version 29-NOV-1988 * * Based on Japanese version 29-NOV-1988 *
* LZSS coded by Haruhiko Okumura * * LZSS coded by Haruhiko Okumura *
* Adaptive Huffman Coding coded by Haruyasu Yoshizaki * * Adaptive Huffman Coding coded by Haruyasu Yoshizaki *
* * * *
* Anonymous FTP access to the most recent released source is available at * * Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* * * *
* Anonymous CVS access to the development source and modification history * * Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: * * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) * * (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* * * *
* For Synchronet coding style and modification guidelines, see * * For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html * * http://www.synchro.net/source.html *
* * * *
* You are encouraged to submit any modifications (preferably in Unix diff * * You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net * * format) via e-mail to mods@synchro.net *
* * * *
* Note: If this box doesn't appear square, then you need to fix your tabs. * * Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/ ****************************************************************************/
#include <gdefs.h>
#ifdef LZHEXPORT #ifdef LZHEXPORT
#undef LZHEXPORT #undef LZHEXPORT
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifndef __FLAT__ #ifndef __FLAT__
#define __FLAT__ #define __FLAT__
#endif #endif
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#define LZHCALL __stdcall #define LZHCALL __stdcall
#else #else
#define LZHCALL #define LZHCALL
#endif #endif
#ifdef LZHDLL /* LZH functions in DLL */ #ifdef LZHDLL /* LZH functions in DLL */
#ifdef LZH_EXPORTS #ifdef LZH_EXPORTS
#define LZHEXPORT __declspec( dllexport ) #define LZHEXPORT __declspec( dllexport )
#else #else
#define LZHEXPORT __declspec( dllimport ) #define LZHEXPORT __declspec( dllimport )
#endif #endif
#else /* self-contained executable */ #else /* self-contained executable */
#define LZHEXPORT #define LZHEXPORT
#endif #endif
#elif defined(__unix__) || defined(__GNUC__) #elif defined(__unix__) || defined(__GNUC__)
#ifndef __FLAT__ #ifndef __FLAT__
#define __FLAT__ #define __FLAT__
#endif #endif
#define LZHCALL #define LZHCALL
#define LZHEXPORT #define LZHEXPORT
#else /* !_WIN32 */ #else /* !_WIN32 */
#define LZHCALL #define LZHCALL
#define LZHEXPORT #define LZHEXPORT
#endif
#ifndef uchar
typedef unsigned char uchar;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
LZHEXPORT long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf); LZHEXPORT int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
LZHEXPORT long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf); LZHEXPORT int32_t LZHCALL lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */ #ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux lzh_encode "_*" #pragma aux lzh_encode "_*"
#pragma aux lzh_decode "_*" #pragma aux lzh_decode "_*"
#endif #endif

View File

@ -386,93 +386,93 @@ enum {
typedef struct _PACK { // Time with time-zone typedef struct _PACK { // Time with time-zone
uint32_t time; // Local time (unix format) uint32_t time; // Local time (unix format)
short zone; // Time zone int16_t zone; // Time zone
} when_t; } when_t;
typedef struct _PACK { // Index record typedef struct _PACK { // Index record
ushort to; // 16-bit CRC of recipient name (lower case) uint16_t to; // 16-bit CRC of recipient name (lower case)
ushort from; // 16-bit CRC of sender name (lower case) uint16_t from; // 16-bit CRC of sender name (lower case)
ushort subj; // 16-bit CRC of subject (lower case, w/o RE:) uint16_t subj; // 16-bit CRC of subject (lower case, w/o RE:)
ushort attr; // attributes (read, permanent, etc.) uint16_t attr; // attributes (read, permanent, etc.)
uint32_t offset; // offset into header file uint32_t offset; // offset into header file
uint32_t number; // number of message (1 based) uint32_t number; // number of message (1 based)
uint32_t time; // time/date message was imported/posted uint32_t time; // time/date message was imported/posted
} idxrec_t; } idxrec_t;
typedef struct _PACK { // Message base header (fixed portion) typedef struct _PACK { // Message base header (fixed portion)
uchar id[LEN_HEADER_ID]; // SMB<^Z> uint8_t id[LEN_HEADER_ID]; // SMB<^Z>
ushort version; // version number (initially 100h for 1.00) uint16_t version; // version number (initially 100h for 1.00)
ushort length; // length including this struct uint16_t length; // length including this struct
} smbhdr_t; } smbhdr_t;
typedef struct _PACK { // Message base status header typedef struct _PACK { // Message base status header
uint32_t last_msg; // last message number uint32_t last_msg; // last message number
uint32_t total_msgs; // total messages uint32_t total_msgs; // total messages
uint32_t header_offset; // byte offset to first header record uint32_t header_offset;// byte offset to first header record
uint32_t max_crcs; // Maximum number of CRCs to keep in history uint32_t max_crcs; // Maximum number of CRCs to keep in history
uint32_t max_msgs; // Maximum number of message to keep in sub uint32_t max_msgs; // Maximum number of message to keep in sub
ushort max_age; // Maximum age of message to keep in sub (in days) uint16_t max_age; // Maximum age of message to keep in sub (in days)
ushort attr; // Attributes for this message base (SMB_HYPER,etc) uint16_t attr; // Attributes for this message base (SMB_HYPER,etc)
} smbstatus_t; } smbstatus_t;
typedef struct _PACK { // Message header typedef struct _PACK { // Message header
uchar id[LEN_HEADER_ID]; // SHD<^Z> uint8_t id[LEN_HEADER_ID]; // SHD<^Z>
ushort type; // Message type (normally 0) uint16_t type; // Message type (normally 0)
ushort version; // Version of type (initially 100h for 1.00) uint16_t version; // Version of type (initially 100h for 1.00)
ushort length; // Total length of fixed record + all fields uint16_t length; // Total length of fixed record + all fields
ushort attr; // Attributes (bit field) (duped in SID) uint16_t attr; // Attributes (bit field) (duped in SID)
uint32_t auxattr; // Auxillary attributes (bit field) uint32_t auxattr; // Auxillary attributes (bit field)
uint32_t netattr; // Network attributes uint32_t netattr; // Network attributes
when_t when_written; // Time message was written (unix format) when_t when_written; // Time message was written (unix format)
when_t when_imported; // Time message was imported when_t when_imported; // Time message was imported
uint32_t number; // Message number uint32_t number; // Message number
uint32_t thread_orig; // Original message number in thread uint32_t thread_orig; // Original message number in thread
uint32_t thread_next; // Next message in thread uint32_t thread_next; // Next message in thread
uint32_t thread_first; // First reply to this message uint32_t thread_first; // First reply to this message
ushort delivery_attempts; // Delivery attempt counter uint16_t delivery_attempts; // Delivery attempt counter
uchar reserved[14]; // Reserved for future use uint8_t reserved[14]; // Reserved for future use
uint32_t offset; // Offset for buffer into data file (0 or mod 256) uint32_t offset; // Offset for buffer into data file (0 or mod 256)
ushort total_dfields; // Total number of data fields uint16_t total_dfields; // Total number of data fields
} msghdr_t; } msghdr_t;
typedef struct _PACK { // Data field typedef struct _PACK { // Data field
ushort type; // Type of data field uint16_t type; // Type of data field
uint32_t offset; // Offset into buffer uint32_t offset; // Offset into buffer
uint32_t length; // Length of data field uint32_t length; // Length of data field
} dfield_t; } dfield_t;
typedef struct _PACK { // Header field typedef struct _PACK { // Header field
ushort type; uint16_t type;
ushort length; // Length of buffer uint16_t length; // Length of buffer
} hfield_t; } hfield_t;
typedef struct _PACK { // FidoNet address (zone:net/node.point) typedef struct _PACK { // FidoNet address (zone:net/node.point)
ushort zone; uint16_t zone;
ushort net; uint16_t net;
ushort node; uint16_t node;
ushort point; uint16_t point;
} fidoaddr_t; } fidoaddr_t;
typedef struct _PACK { // Network (type and address) typedef struct _PACK { // Network (type and address)
ushort type; uint16_t type;
void *addr; void *addr;
} net_t; } net_t;
@ -504,13 +504,13 @@ typedef struct { // Message
*ftn_msgid, // FTN MSGID *ftn_msgid, // FTN MSGID
*ftn_reply, // FTN REPLY *ftn_reply, // FTN REPLY
*subj; // Subject *subj; // Subject
ushort to_agent, // Type of agent message is to uint16_t to_agent, // Type of agent message is to
from_agent, // Type of agent message is from from_agent, // Type of agent message is from
replyto_agent; // Type of agent replies should be sent to replyto_agent; // Type of agent replies should be sent to
net_t to_net, // Destination network type and address net_t to_net, // Destination network type and address
from_net, // Origin network address from_net, // Origin network address
replyto_net; // Network type and address for replies replyto_net; // Network type and address for replies
ushort total_hfields; // Total number of header fields uint16_t total_hfields; // Total number of header fields
hfield_t *hfield; // Header fields (fixed length portion) hfield_t *hfield; // Header fields (fixed length portion)
void **hfield_dat; // Header fields (variable length portion) void **hfield_dat; // Header fields (variable length portion)
dfield_t *dfield; // Data fields (fixed length portion) dfield_t *dfield; // Data fields (fixed length portion)
@ -528,17 +528,17 @@ typedef struct { // Message base
FILE *sid_fp; // File pointer for index (.sid) file FILE *sid_fp; // File pointer for index (.sid) file
FILE *sda_fp; // File pointer for data allocation (.sda) file FILE *sda_fp; // File pointer for data allocation (.sda) file
FILE *sha_fp; // File pointer for header allocation (.sha) file FILE *sha_fp; // File pointer for header allocation (.sha) file
uint32_t retry_time; // Maximum number of seconds to retry opens/locks uint32_t retry_time; // Maximum number of seconds to retry opens/locks
uint32_t retry_delay; // Time-slice yield (milliseconds) while retrying uint32_t retry_delay;// Time-slice yield (milliseconds) while retrying
smbstatus_t status; // Status header record smbstatus_t status; // Status header record
int locked; // SMB header is locked int locked; // SMB header is locked
char shd_buf[SHD_BLOCK_LEN]; // File I/O buffer for header file char shd_buf[SHD_BLOCK_LEN]; // File I/O buffer for header file
char last_error[128]; // Last error message char last_error[128]; // Last error message
/* Private member variables (not initialized by or used by smblib) */ /* Private member variables (not initialized by or used by smblib) */
uint subnum; // Sub-board number uint32_t subnum; // Sub-board number
long msgs; // Number of messages loaded (for user) uint32_t msgs; // Number of messages loaded (for user)
long curmsg; // Current message number (for user) uint32_t curmsg; // Current message number (for user)
} smb_t; } smb_t;

View File

@ -659,11 +659,11 @@ uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg)
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg) int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
{ {
hfield_t *vp; hfield_t *vp;
void **vpp; void **vpp;
ushort i; uint16_t i;
uint32_t l,offset; uint32_t l, offset;
idxrec_t idx; idxrec_t idx;
if(smb->shd_fp==NULL) { if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open"); sprintf(smb->last_error,"msgbase not open");
@ -763,7 +763,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
break; break;
case SENDERAGENT: case SENDERAGENT:
if(!msg->forwarded) if(!msg->forwarded)
msg->from_agent=*(ushort *)msg->hfield_dat[i]; msg->from_agent=*(uint16_t *)msg->hfield_dat[i];
break; break;
case SENDEREXT: case SENDEREXT:
if(!msg->forwarded) if(!msg->forwarded)
@ -771,7 +771,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
break; break;
case SENDERNETTYPE: case SENDERNETTYPE:
if(!msg->forwarded) if(!msg->forwarded)
msg->from_net.type=*(ushort *)msg->hfield_dat[i]; msg->from_net.type=*(uint16_t *)msg->hfield_dat[i];
break; break;
case SENDERNETADDR: case SENDERNETADDR:
if(!msg->forwarded) if(!msg->forwarded)
@ -784,10 +784,10 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
msg->replyto_ext=(char *)msg->hfield_dat[i]; msg->replyto_ext=(char *)msg->hfield_dat[i];
break; break;
case REPLYTOAGENT: case REPLYTOAGENT:
msg->replyto_agent=*(ushort *)msg->hfield_dat[i]; msg->replyto_agent=*(uint16_t *)msg->hfield_dat[i];
break; break;
case REPLYTONETTYPE: case REPLYTONETTYPE:
msg->replyto_net.type=*(ushort *)msg->hfield_dat[i]; msg->replyto_net.type=*(uint16_t *)msg->hfield_dat[i];
break; break;
case REPLYTONETADDR: case REPLYTONETADDR:
msg->replyto_net.addr=(char *)msg->hfield_dat[i]; msg->replyto_net.addr=(char *)msg->hfield_dat[i];
@ -799,10 +799,10 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
msg->to_ext=(char *)msg->hfield_dat[i]; msg->to_ext=(char *)msg->hfield_dat[i];
break; break;
case RECIPIENTAGENT: case RECIPIENTAGENT:
msg->to_agent=*(ushort *)msg->hfield_dat[i]; msg->to_agent=*(uint16_t *)msg->hfield_dat[i];
break; break;
case RECIPIENTNETTYPE: case RECIPIENTNETTYPE:
msg->to_net.type=*(ushort *)msg->hfield_dat[i]; msg->to_net.type=*(uint16_t *)msg->hfield_dat[i];
break; break;
case RECIPIENTNETADDR: case RECIPIENTNETADDR:
msg->to_net.addr=(char *)msg->hfield_dat[i]; msg->to_net.addr=(char *)msg->hfield_dat[i];
@ -855,7 +855,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/ /****************************************************************************/
void SMBCALL smb_freemsgmem(smbmsg_t* msg) void SMBCALL smb_freemsgmem(smbmsg_t* msg)
{ {
ushort i; uint16_t i;
if(msg->dfield) { if(msg->dfield) {
FREE(msg->dfield); FREE(msg->dfield);
@ -925,7 +925,7 @@ int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/ /****************************************************************************/
/* Adds a header field to the 'msg' structure (in memory only) */ /* Adds a header field to the 'msg' structure (in memory only) */
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data) int SMBCALL smb_hfield(smbmsg_t* msg, uint16_t type, size_t length, void* data)
{ {
hfield_t* vp; hfield_t* vp;
void* *vpp; void* *vpp;
@ -956,7 +956,7 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
/****************************************************************************/ /****************************************************************************/
/* Searches for a specific header field (by type) and returns it */ /* Searches for a specific header field (by type) and returns it */
/****************************************************************************/ /****************************************************************************/
void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield) void* SMBCALL smb_get_hfield(smbmsg_t* msg, uint16_t type, hfield_t* hfield)
{ {
int i; int i;
@ -975,7 +975,7 @@ void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
/* Automatically figures out the offset into the data buffer from existing */ /* Automatically figures out the offset into the data buffer from existing */
/* dfield lengths */ /* dfield lengths */
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length) int SMBCALL smb_dfield(smbmsg_t* msg, uint16_t type, uint32_t length)
{ {
dfield_t* vp; dfield_t* vp;
int i,j; int i,j;
@ -1175,8 +1175,8 @@ int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg) int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
{ {
ushort i; uint16_t i;
uint32_t l; uint32_t l;
if(smb->shd_fp==NULL) { if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open"); sprintf(smb->last_error,"msgbase not open");
@ -1321,10 +1321,10 @@ uint32_t SMBCALL smb_hdrblocks(uint32_t length)
/* smb_close_da() should be called after */ /* smb_close_da() should be called after */
/* Returns negative on error */ /* Returns negative on error */
/****************************************************************************/ /****************************************************************************/
int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers) int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, uint16_t headers)
{ {
ushort i,j; uint16_t i, j;
uint32_t l,blocks,offset=0L; uint32_t l, blocks, offset = 0;
if(smb->sda_fp==NULL) { if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open"); sprintf(smb->last_error,"msgbase not open");
@ -1360,7 +1360,7 @@ int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers)
/* Allocates space for data, but doesn't search for unused blocks */ /* Allocates space for data, but doesn't search for unused blocks */
/* Returns negative on error */ /* Returns negative on error */
/****************************************************************************/ /****************************************************************************/
int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers) int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, uint16_t headers)
{ {
uint32_t l,blocks,offset; uint32_t l,blocks,offset;
@ -1388,13 +1388,12 @@ int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers)
/* De-allocates space for data */ /* De-allocates space for data */
/* Returns non-zero on error */ /* Returns non-zero on error */
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers)
, ushort headers)
{ {
int da_opened=0; int da_opened = 0;
int retval=0; int retval = 0;
ushort i; uint16_t i;
uint32_t l,blocks; uint32_t l, blocks;
if(smb->status.attr&SMB_HYPERALLOC) /* do nothing */ if(smb->status.attr&SMB_HYPERALLOC) /* do nothing */
return(0); return(0);
@ -1446,10 +1445,10 @@ int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length
/* Adds to data allocation records for blocks starting at 'offset' */ /* Adds to data allocation records for blocks starting at 'offset' */
/* Returns non-zero on error */ /* Returns non-zero on error */
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers) int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers)
{ {
ushort i; uint16_t i;
uint32_t l,blocks; uint32_t l, blocks;
if(smb->sda_fp==NULL) { if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open"); sprintf(smb->last_error,"msgbase not open");
@ -1480,7 +1479,7 @@ int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort head
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length) int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length)
{ {
uchar c=0; uint8_t c = 0;
uint32_t l,blocks; uint32_t l,blocks;
if(smb->sha_fp==NULL) { if(smb->sha_fp==NULL) {
@ -1504,8 +1503,8 @@ int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length)
/****************************************************************************/ /****************************************************************************/
int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg) int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg)
{ {
int i; int i;
ushort x; uint16_t x;
if(smb->status.attr&SMB_HYPERALLOC) /* Nothing to do */ if(smb->status.attr&SMB_HYPERALLOC) /* Nothing to do */
return(0); return(0);
@ -1530,9 +1529,9 @@ int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/ /****************************************************************************/
int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length) int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length)
{ {
uchar c; uint8_t c;
ushort i; uint16_t i;
uint32_t l,blocks,offset=0; uint32_t l, blocks, offset = 0;
if(smb->sha_fp==NULL) { if(smb->sha_fp==NULL) {
sprintf(smb->last_error,"msgbase not open"); sprintf(smb->last_error,"msgbase not open");
@ -1571,7 +1570,7 @@ int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length)
/****************************************************************************/ /****************************************************************************/
int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length) int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length)
{ {
uchar c=1; uint8_t c = 1;
uint32_t l,blocks,offset; uint32_t l,blocks,offset;
if(smb->sha_fp==NULL) { if(smb->sha_fp==NULL) {

View File

@ -5,34 +5,34 @@
/* $Id$ */ /* $Id$ */
/**************************************************************************** /****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 * * as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. * * of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or * * See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html * * http://www.fsf.org/copyleft/lesser.html *
* * * *
* Anonymous FTP access to the most recent released source is available at * * Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* * * *
* Anonymous CVS access to the development source and modification history * * Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: * * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) * * (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* * * *
* For Synchronet coding style and modification guidelines, see * * For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html * * http://www.synchro.net/source.html *
* * * *
* You are encouraged to submit any modifications (preferably in Unix diff * * You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net * * format) via e-mail to mods@synchro.net *
* * * *
* Note: If this box doesn't appear square, then you need to fix your tabs. * * Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/ ****************************************************************************/
#ifndef _SMBLIB_H #ifndef _SMBLIB_H
@ -41,183 +41,183 @@
#include "lzh.h" #include "lzh.h"
#ifdef SMBEXPORT #ifdef SMBEXPORT
#undef SMBEXPORT #undef SMBEXPORT
#endif #endif
#ifndef __FLAT__ #ifndef __FLAT__
#define __FLAT__ /* only supporting 32-bit targets now */ #define __FLAT__ /* only supporting 32-bit targets now */
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#define SMBCALL __stdcall #define SMBCALL __stdcall
#else #else
#define SMBCALL #define SMBCALL
#endif #endif
#if defined(SMB_IMPORTS) || defined(SMB_EXPORTS) #if defined(SMB_IMPORTS) || defined(SMB_EXPORTS)
#if defined(SMB_IMPORTS) #if defined(SMB_IMPORTS)
#define SMBEXPORT __declspec( dllimport ) #define SMBEXPORT __declspec( dllimport )
#else #else
#define SMBEXPORT __declspec( dllexport ) #define SMBEXPORT __declspec( dllexport )
#endif #endif
#else /* self-contained executable */ #else /* self-contained executable */
#define SMBEXPORT #define SMBEXPORT
#endif #endif
#elif defined __unix__ #elif defined __unix__
#define SMBCALL #define SMBCALL
#define SMBEXPORT #define SMBEXPORT
#else #else
#define SMBCALL #define SMBCALL
#define SMBEXPORT #define SMBEXPORT
#endif #endif
#include "smbdefs.h" #include "smbdefs.h"
#define SMB_STACK_LEN 4 /* Max msg bases in smb_stack() */ #define SMB_STACK_LEN 4 /* Max msg bases in smb_stack() */
#define SMB_STACK_POP 0 /* Pop a msg base off of smb_stack()*/ #define SMB_STACK_POP 0 /* Pop a msg base off of smb_stack()*/
#define SMB_STACK_PUSH 1 /* Push a msg base onto smb_stack() */ #define SMB_STACK_PUSH 1 /* Push a msg base onto smb_stack() */
#define SMB_STACK_XCHNG 2 /* Exchange msg base w/last pushed */ #define SMB_STACK_XCHNG 2 /* Exchange msg base w/last pushed */
#define GETMSGTXT_TAILS (1<<0) /* Get message tail(s) */ #define GETMSGTXT_TAILS (1<<0) /* Get message tail(s) */
#define GETMSGTXT_NO_BODY (1<<1) /* Do not retrieve message body */ #define GETMSGTXT_NO_BODY (1<<1) /* Do not retrieve message body */
#define SMB_IS_OPEN(smb) ((smb)->shd_fp!=NULL) #define SMB_IS_OPEN(smb) ((smb)->shd_fp!=NULL)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
SMBEXPORT int SMBCALL smb_ver(void); SMBEXPORT int SMBCALL smb_ver(void);
SMBEXPORT char* SMBCALL smb_lib_ver(void); SMBEXPORT char* SMBCALL smb_lib_ver(void);
SMBEXPORT int SMBCALL smb_open(smb_t* smb); SMBEXPORT int SMBCALL smb_open(smb_t* smb);
SMBEXPORT void SMBCALL smb_close(smb_t* smb); SMBEXPORT void SMBCALL smb_close(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_da(smb_t* smb); SMBEXPORT int SMBCALL smb_open_da(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_da(smb_t* smb); SMBEXPORT void SMBCALL smb_close_da(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_ha(smb_t* smb); SMBEXPORT int SMBCALL smb_open_ha(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_ha(smb_t* smb); SMBEXPORT void SMBCALL smb_close_ha(smb_t* smb);
SMBEXPORT int SMBCALL smb_create(smb_t* smb); SMBEXPORT int SMBCALL smb_create(smb_t* smb);
SMBEXPORT int SMBCALL smb_stack(smb_t* smb, int op); SMBEXPORT int SMBCALL smb_stack(smb_t* smb, int op);
SMBEXPORT int SMBCALL smb_trunchdr(smb_t* smb); SMBEXPORT int SMBCALL smb_trunchdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_locksmbhdr(smb_t* smb); SMBEXPORT int SMBCALL smb_locksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getstatus(smb_t* smb); SMBEXPORT int SMBCALL smb_getstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_putstatus(smb_t* smb); SMBEXPORT int SMBCALL smb_putstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_unlocksmbhdr(smb_t* smb); SMBEXPORT int SMBCALL smb_unlocksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx); SMBEXPORT int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx); SMBEXPORT int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT uint SMBCALL smb_getmsghdrlen(smbmsg_t* msg); SMBEXPORT uint32_t SMBCALL smb_getmsghdrlen(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg); SMBEXPORT uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc); SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc);
SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data); SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, uint16_t type, size_t length, void* data);
SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length); SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, uint16_t type, uint32_t length);
SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield); SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, uint16_t type, hfield_t* hfield);
SMBEXPORT int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg,int storage); SMBEXPORT int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg,int storage);
SMBEXPORT int SMBCALL smb_putmsg(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_putmsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT void SMBCALL smb_freemsgmem(smbmsg_t* msg); SMBEXPORT void SMBCALL smb_freemsgmem(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_hdrblocks(uint32_t length); SMBEXPORT uint32_t SMBCALL smb_hdrblocks(uint32_t length);
SMBEXPORT uint32_t SMBCALL smb_datblocks(uint32_t length); SMBEXPORT uint32_t SMBCALL smb_datblocks(uint32_t length);
SMBEXPORT int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length); SMBEXPORT int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length); SMBEXPORT int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_hallochdr(smb_t* smb); SMBEXPORT int32_t SMBCALL smb_hallochdr(smb_t* smb);
SMBEXPORT int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers); SMBEXPORT int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, uint16_t headers);
SMBEXPORT int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers); SMBEXPORT int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, uint16_t headers);
SMBEXPORT int32_t SMBCALL smb_hallocdat(smb_t* smb); SMBEXPORT int32_t SMBCALL smb_hallocdat(smb_t* smb);
SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers); SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers);
SMBEXPORT int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg); SMBEXPORT int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers); SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers);
SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length); SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length);
SMBEXPORT void SMBCALL smb_freemsgtxt(char* buf); SMBEXPORT void SMBCALL smb_freemsgtxt(char* buf);
SMBEXPORT int SMBCALL smb_copymsgmem(smbmsg_t* destmsg, smbmsg_t* srcmsg); SMBEXPORT int SMBCALL smb_copymsgmem(smbmsg_t* destmsg, smbmsg_t* srcmsg);
SMBEXPORT char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, uint32_t mode); SMBEXPORT char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, uint32_t mode);
SMBEXPORT int SMBCALL smb_tzutc(short timezone); SMBEXPORT int SMBCALL smb_tzutc(int16_t timezone);
/* FILE pointer I/O functions */ /* FILE pointer I/O functions */
SMBEXPORT int SMBCALL smb_feof(FILE* fp); SMBEXPORT int SMBCALL smb_feof(FILE* fp);
SMBEXPORT int SMBCALL smb_ferror(FILE* fp); SMBEXPORT int SMBCALL smb_ferror(FILE* fp);
SMBEXPORT int SMBCALL smb_fflush(FILE* fp); SMBEXPORT int SMBCALL smb_fflush(FILE* fp);
SMBEXPORT int SMBCALL smb_fgetc(FILE* fp); SMBEXPORT int SMBCALL smb_fgetc(FILE* fp);
SMBEXPORT int SMBCALL smb_fputc(int ch, FILE* fp); SMBEXPORT int SMBCALL smb_fputc(int ch, FILE* fp);
SMBEXPORT int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence); SMBEXPORT int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence);
SMBEXPORT int32_t SMBCALL smb_ftell(FILE* fp); SMBEXPORT int32_t SMBCALL smb_ftell(FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp); SMBEXPORT int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp); SMBEXPORT int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fgetlength(FILE* fp); SMBEXPORT int32_t SMBCALL smb_fgetlength(FILE* fp);
SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, int32_t length); SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, int32_t length);
SMBEXPORT void SMBCALL smb_rewind(FILE* fp); SMBEXPORT void SMBCALL smb_rewind(FILE* fp);
SMBEXPORT void SMBCALL smb_clearerr(FILE* fp); SMBEXPORT void SMBCALL smb_clearerr(FILE* fp);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */ #ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux smb_ver "_*" #pragma aux smb_ver "_*"
#pragma aux smb_lib_ver "_*" #pragma aux smb_lib_ver "_*"
#pragma aux smb_open "_*" #pragma aux smb_open "_*"
#pragma aux smb_close "_*" #pragma aux smb_close "_*"
#pragma aux smb_open_da "_*" #pragma aux smb_open_da "_*"
#pragma aux smb_close_da "_*" #pragma aux smb_close_da "_*"
#pragma aux smb_open_ha "_*" #pragma aux smb_open_ha "_*"
#pragma aux smb_close_ha "_*" #pragma aux smb_close_ha "_*"
#pragma aux smb_create "_*" #pragma aux smb_create "_*"
#pragma aux smb_stack "_*" #pragma aux smb_stack "_*"
#pragma aux smb_trunchdr "_*" #pragma aux smb_trunchdr "_*"
#pragma aux smb_locksmbhdr "_*" #pragma aux smb_locksmbhdr "_*"
#pragma aux smb_getstatus "_*" #pragma aux smb_getstatus "_*"
#pragma aux smb_putstatus "_*" #pragma aux smb_putstatus "_*"
#pragma aux smb_unlocksmbhdr "_*" #pragma aux smb_unlocksmbhdr "_*"
#pragma aux smb_getmsgidx "_*" #pragma aux smb_getmsgidx "_*"
#pragma aux smb_getfirstidx "_*" #pragma aux smb_getfirstidx "_*"
#pragma aux smb_getlastidx "_*" #pragma aux smb_getlastidx "_*"
#pragma aux smb_getmsghdrlen "_*" #pragma aux smb_getmsghdrlen "_*"
#pragma aux smb_getmsgdatlen "_*" #pragma aux smb_getmsgdatlen "_*"
#pragma aux smb_lockmsghdr "_*" #pragma aux smb_lockmsghdr "_*"
#pragma aux smb_getmsghdr "_*" #pragma aux smb_getmsghdr "_*"
#pragma aux smb_unlockmsghdr "_*" #pragma aux smb_unlockmsghdr "_*"
#pragma aux smb_addcrc "_*" #pragma aux smb_addcrc "_*"
#pragma aux smb_hfield "_*" #pragma aux smb_hfield "_*"
#pragma aux smb_dfield "_*" #pragma aux smb_dfield "_*"
#pragma aux smb_addmsghdr "_*" #pragma aux smb_addmsghdr "_*"
#pragma aux smb_putmsg "_*" #pragma aux smb_putmsg "_*"
#pragma aux smb_putmsgidx "_*" #pragma aux smb_putmsgidx "_*"
#pragma aux smb_putmsghdr "_*" #pragma aux smb_putmsghdr "_*"
#pragma aux smb_freemsgmem "_*" #pragma aux smb_freemsgmem "_*"
#pragma aux smb_hdrblocks "_*" #pragma aux smb_hdrblocks "_*"
#pragma aux smb_datblocks "_*" #pragma aux smb_datblocks "_*"
#pragma aux smb_allochdr "_*" #pragma aux smb_allochdr "_*"
#pragma aux smb_fallochdr "_*" #pragma aux smb_fallochdr "_*"
#pragma aux smb_hallochdr "_*" #pragma aux smb_hallochdr "_*"
#pragma aux smb_allocdat "_*" #pragma aux smb_allocdat "_*"
#pragma aux smb_fallocdat "_*" #pragma aux smb_fallocdat "_*"
#pragma aux smb_hallocdat "_*" #pragma aux smb_hallocdat "_*"
#pragma aux smb_incdat "_*" #pragma aux smb_incdat "_*"
#pragma aux smb_freemsg "_*" #pragma aux smb_freemsg "_*"
#pragma aux smb_freemsgdat "_*" #pragma aux smb_freemsgdat "_*"
#pragma aux smb_freemsghdr "_*" #pragma aux smb_freemsghdr "_*"
#pragma aux smb_getmsgtxt "_*" #pragma aux smb_getmsgtxt "_*"
#pragma aux smb_freemsgtxt "_*" #pragma aux smb_freemsgtxt "_*"
#pragma aux smb_feof "_*" #pragma aux smb_feof "_*"
#pragma aux smb_ferror "_*" #pragma aux smb_ferror "_*"
#pragma aux smb_fflush "_*" #pragma aux smb_fflush "_*"
#pragma aux smb_fgetc "_*" #pragma aux smb_fgetc "_*"
#pragma aux smb_fputc "_*" #pragma aux smb_fputc "_*"
#pragma aux smb_fseek "_*" #pragma aux smb_fseek "_*"
#pragma aux smb_ftell "_*" #pragma aux smb_ftell "_*"
#pragma aux smb_fread "_*" #pragma aux smb_fread "_*"
#pragma aux smb_fwrite "_*" #pragma aux smb_fwrite "_*"
#pragma aux smb_fgetlength "_*" #pragma aux smb_fgetlength "_*"
#pragma aux smb_fsetlength "_*" #pragma aux smb_fsetlength "_*"
#pragma aux smb_rewind "_*" #pragma aux smb_rewind "_*"
#pragma aux smb_clearerr "_*" #pragma aux smb_clearerr "_*"
#pragma aux lzh_encode "_*" #pragma aux lzh_encode "_*"
#pragma aux lzh_decode "_*" #pragma aux lzh_decode "_*"
#endif /* Watcom */ #endif /* Watcom */
#endif /* Don't add anything after this #endif statement */ #endif /* Don't add anything after this #endif statement */