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

View File

@ -91,14 +91,14 @@
#ifdef LZH_DYNAMIC_BUF #ifdef LZH_DYNAMIC_BUF
unsigned char *lzh_text_buf; uint8_t *lzh_text_buf;
short int lzh_match_position, lzh_match_length, int16_t lzh_match_position, lzh_match_length,
*lzh_lson, *lzh_rson, *lzh_dad; *lzh_lson, *lzh_rson, *lzh_dad;
#else #else
unsigned char lzh_text_buf[LZH_N + LZH_F - 1]; uint8_t lzh_text_buf[LZH_N + LZH_F - 1];
short int lzh_match_position, lzh_match_length, int16_t lzh_match_position, lzh_match_length,
lzh_lson[LZH_N + 1], lzh_rson[LZH_N + 257], lzh_dad[LZH_N + 1]; lzh_lson[LZH_N + 1], lzh_rson[LZH_N + 257], lzh_dad[LZH_N + 1];
#endif #endif
@ -106,7 +106,7 @@ short int lzh_match_position, lzh_match_length,
void lzh_init_tree(void) /* Initializing tree */ void lzh_init_tree(void) /* Initializing tree */
{ {
short int i; int16_t i;
for (i = LZH_N + 1; i <= LZH_N + 256; i++) for (i = LZH_N + 1; i <= LZH_N + 256; i++)
lzh_rson[i] = LZH_NIL; /* root */ lzh_rson[i] = LZH_NIL; /* root */
@ -118,11 +118,11 @@ void lzh_init_tree(void) /* Initializing tree */
/* Inserting node to the tree */ /* Inserting node to the tree */
/* Only used during encoding */ /* Only used during encoding */
/******************************/ /******************************/
void lzh_insert_node(short int r) void lzh_insert_node(int16_t r)
{ {
short int i, p, cmp; int16_t i, p, cmp;
unsigned char *key; uint8_t *key;
unsigned c; uint32_t c;
cmp = 1; cmp = 1;
key = lzh_text_buf+r; key = lzh_text_buf+r;
@ -158,7 +158,7 @@ void lzh_insert_node(short int r)
} }
if (i == lzh_match_length) { if (i == lzh_match_length) {
if ((c = ((r - p) & (LZH_N - 1)) - 1) if ((c = ((r - p) & (LZH_N - 1)) - 1)
< (unsigned)lzh_match_position) { < (uint32_t)lzh_match_position) {
lzh_match_position = c; lzh_match_position = c;
} }
} }
@ -176,9 +176,9 @@ void lzh_insert_node(short int r)
lzh_dad[p] = LZH_NIL; /* remove p */ lzh_dad[p] = LZH_NIL; /* remove p */
} }
void lzh_delete_node(short int p) /* Deleting node from the tree */ void lzh_delete_node(int16_t p) /* Deleting node from the tree */
{ {
short int q; int16_t q;
if (lzh_dad[p] == LZH_NIL) if (lzh_dad[p] == LZH_NIL)
return; /* unregistered */ return; /* unregistered */
@ -224,7 +224,7 @@ void lzh_delete_node(short int p) /* Deleting node from the tree */
* sliding dictionary pointer * sliding dictionary pointer
*/ */
/* encoder table */ /* encoder table */
uchar lzh_p_len[64] = { uint8_t lzh_p_len[64] = {
0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
@ -235,7 +235,7 @@ uchar lzh_p_len[64] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08
}; };
uchar lzh_p_code[64] = { uint8_t lzh_p_code[64] = {
0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68, 0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68,
0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C, 0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C,
0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, 0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC,
@ -247,7 +247,7 @@ uchar lzh_p_code[64] = {
}; };
/* decoder table */ /* decoder table */
uchar lzh_d_code[256] = { uint8_t lzh_d_code[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -282,7 +282,7 @@ uchar lzh_d_code[256] = {
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
}; };
uchar lzh_d_len[256] = { uint8_t lzh_d_len[256] = {
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
@ -319,32 +319,32 @@ uchar lzh_d_len[256] = {
#ifdef LZH_DYNAMIC_BUF #ifdef LZH_DYNAMIC_BUF
unsigned short *lzh_freq=NULL; /* cumulative freq table */ uint16_t *lzh_freq = NULL; /* cumulative freq table */
/* /*
* pointing parent nodes. * pointing parent nodes.
* area [LZH_T..(LZH_T + LZH_N_CHAR - 1)] are pointers for leaves * area [LZH_T..(LZH_T + LZH_N_CHAR - 1)] are pointers for leaves
*/ */
short int *lzh_prnt=NULL; int16_t *lzh_prnt = NULL;
/* pointing children nodes (son[], son[] + 1)*/ /* pointing children nodes (son[], son[] + 1)*/
short int *lzh_son=NULL; int16_t *lzh_son = NULL;
#else /* STATIC */ #else /* STATIC */
unsigned short lzh_freq[LZH_T + 1]; /* cumulative freq table */ uint16_t lzh_freq[LZH_T + 1]; /* cumulative freq table */
short int lzh_prnt[LZH_T + LZH_N_CHAR]; int16_t lzh_prnt[LZH_T + LZH_N_CHAR];
short int lzh_son[LZH_T + 1]; /* bug fixed by Digital Dynamics */ int16_t lzh_son[LZH_T + 1]; /* bug fixed by Digital Dynamics */
#endif #endif
unsigned short lzh_getbuf = 0; /* Was just "unsigned" fixed 04/12/95 */ uint16_t lzh_getbuf = 0; /* Was just "unsigned" fixed 04/12/95 */
uchar lzh_getlen = 0; uint8_t lzh_getlen = 0;
int lzh_getbit(uchar *inbuf, long *incnt, long inlen) /* get one bit */ int lzh_getbit(uint8_t *inbuf, int32_t *incnt, int32_t inlen) /* get one bit */
{ {
short int i; int16_t i;
while (lzh_getlen <= 8) { while (lzh_getlen <= 8) {
if((*incnt)>=inlen) if((*incnt)>=inlen)
@ -360,9 +360,9 @@ int lzh_getbit(uchar *inbuf, long *incnt, long inlen) /* get one bit */
return (i < 0); return (i < 0);
} }
short int lzh_getbyte(uchar *inbuf, long *incnt, long inlen) /* get a byte */ int16_t lzh_getbyte(uint8_t *inbuf, int32_t *incnt, int32_t inlen) /* get a byte */
{ {
unsigned short i; uint16_t i;
while (lzh_getlen <= 8) { while (lzh_getlen <= 8) {
if((*incnt)>=inlen) if((*incnt)>=inlen)
@ -378,11 +378,11 @@ short int lzh_getbyte(uchar *inbuf, long *incnt, long inlen) /* get a byte */
return i >> 8; return i >> 8;
} }
unsigned lzh_putbuf = 0; uint32_t lzh_putbuf = 0;
uchar lzh_putlen = 0; uint8_t lzh_putlen = 0;
/* output c bits */ /* output c bits */
void lzh_putcode(short int l, unsigned short c, uchar *outbuf, long *outlen) void lzh_putcode(int16_t l, uint16_t c, uint8_t *outbuf, int32_t *outlen)
{ {
lzh_putbuf |= c >> lzh_putlen; lzh_putbuf |= c >> lzh_putlen;
if ((lzh_putlen += l) >= 8) { if ((lzh_putlen += l) >= 8) {
@ -402,12 +402,12 @@ void lzh_putcode(short int l, unsigned short c, uchar *outbuf, long *outlen)
void lzh_start_huff(void) void lzh_start_huff(void)
{ {
short int i, j; int16_t i, j;
lzh_getbuf = 0; /* Added by Digital Dynamics for repeating operations */ lzh_getbuf = 0; /* Added by Digital Dynamics for repeating operations */
lzh_getlen = 0; lzh_getlen = 0;
lzh_putbuf = 0; lzh_putbuf = 0;
lzh_putlen = 0; lzh_putlen = 0;
for (i = 0; i < LZH_N_CHAR; i++) { for (i = 0; i < LZH_N_CHAR; i++) {
lzh_freq[i] = 1; lzh_freq[i] = 1;
@ -430,8 +430,8 @@ lzh_putlen = 0;
void lzh_reconst(void) void lzh_reconst(void)
{ {
short int i, j, k; int16_t i, j, k;
unsigned short f, l; uint16_t f, l;
/* halven cumulative freq for leaf nodes */ /* halven cumulative freq for leaf nodes */
j = 0; j = 0;
@ -472,9 +472,9 @@ void lzh_reconst(void)
/* update freq tree */ /* update freq tree */
void lzh_update(short int c) void lzh_update(int16_t c)
{ {
short int i, j, k, l; int16_t i, j, k, l;
if (lzh_freq[LZH_R] == MAX_FREQ) { if (lzh_freq[LZH_R] == MAX_FREQ) {
lzh_reconst(); lzh_reconst();
@ -506,12 +506,12 @@ void lzh_update(short int c)
} while ((c = lzh_prnt[c]) != 0); /* do it until reaching the root */ } while ((c = lzh_prnt[c]) != 0); /* do it until reaching the root */
} }
unsigned short lzh_code, lzh_len; uint16_t lzh_code, lzh_len;
void lzh_encode_char(unsigned short c, uchar *outbuf, long *outlen) void lzh_encode_char(uint16_t c, uint8_t *outbuf, int32_t *outlen)
{ {
unsigned short i; uint16_t i;
short int j, k; int16_t j, k;
i = 0; i = 0;
j = 0; j = 0;
@ -535,28 +535,28 @@ void lzh_encode_char(unsigned short c, uchar *outbuf, long *outlen)
lzh_update(c); lzh_update(c);
} }
void lzh_encode_position(unsigned short c, uchar *outbuf, long *outlen) void lzh_encode_position(uint16_t c, uint8_t *outbuf, int32_t *outlen)
{ {
unsigned short i; uint16_t i;
/* output upper 6 bits with encoding */ /* output upper 6 bits with encoding */
i = c >> 6; i = c >> 6;
lzh_putcode(lzh_p_len[i], (unsigned short)(lzh_p_code[i] << 8), outbuf, outlen); lzh_putcode(lzh_p_len[i], (uint16_t)(lzh_p_code[i] << 8), outbuf, outlen);
/* output lower 6 bits directly */ /* output lower 6 bits directly */
lzh_putcode(6, (unsigned short)((c & 0x3f) << 10), outbuf, outlen); lzh_putcode(6, (uint16_t)((c & 0x3f) << 10), outbuf, outlen);
} }
void lzh_encode_end(uchar *outbuf, long *outlen) void lzh_encode_end(uint8_t *outbuf, int32_t *outlen)
{ {
if (lzh_putlen) { if (lzh_putlen) {
outbuf[(*outlen)++]=(lzh_putbuf >> 8); outbuf[(*outlen)++]=(lzh_putbuf >> 8);
} }
} }
short int lzh_decode_char(uchar *inbuf, long *incnt, long inlen) int16_t lzh_decode_char(uint8_t *inbuf, int32_t *incnt, int32_t inlen)
{ {
unsigned short c; uint16_t c;
c = lzh_son[LZH_R]; c = lzh_son[LZH_R];
@ -574,13 +574,13 @@ short int lzh_decode_char(uchar *inbuf, long *incnt, long inlen)
return c; return c;
} }
short int lzh_decode_position(uchar *inbuf, long *incnt, long inlen) int16_t lzh_decode_position(uint8_t *inbuf, int32_t *incnt, int32_t inlen)
{ {
unsigned short i, j, c; uint16_t i, j, c;
/* decode upper 6 bits from given table */ /* decode upper 6 bits from given table */
i = lzh_getbyte(inbuf,incnt,inlen); i = lzh_getbyte(inbuf,incnt,inlen);
c = (unsigned)lzh_d_code[i] << 6; c = (uint32_t)lzh_d_code[i] << 6;
j = lzh_d_len[i]; j = lzh_d_len[i];
/* input lower 6 bits directly */ /* input lower 6 bits directly */
@ -595,41 +595,41 @@ short int lzh_decode_position(uchar *inbuf, long *incnt, long inlen)
/* Encoding/Compressing */ /* Encoding/Compressing */
/* Returns length of outbuf */ /* Returns length of outbuf */
long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf) int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
{ {
short int i, c, len, r, s, last_match_length; int16_t i, c, len, r, s, last_match_length;
long incnt,outlen; /* textsize=0; */ int32_t incnt, outlen; /* textsize=0; */
#ifdef LZH_DYNAMIC_BUF #ifdef LZH_DYNAMIC_BUF
if((lzh_text_buf=(uchar *)MALLOC(LZH_N + LZH_F - 1))==NULL) if((lzh_text_buf=(uint8_t *)MALLOC(LZH_N + LZH_F - 1))==NULL)
return(-1); return(-1);
if((lzh_freq=(unsigned short*)MALLOC((LZH_T + 1)*sizeof(unsigned short)))==NULL) { if((lzh_freq=(uint16_t *)MALLOC((LZH_T + 1)*sizeof(uint16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
return(-1); } return(-1); }
if((lzh_prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) { if((lzh_prnt=(int16_t *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_freq); FREE(lzh_freq);
return(-1); } return(-1); }
if((lzh_son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) { if((lzh_son=(int16_t *)MALLOC((LZH_T + 1) * sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_prnt); FREE(lzh_prnt);
FREE(lzh_freq); FREE(lzh_freq);
return(-1); } return(-1); }
if((lzh_lson=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) { if((lzh_lson=(int16_t *)MALLOC((LZH_N + 1)*sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_prnt); FREE(lzh_prnt);
FREE(lzh_freq); FREE(lzh_freq);
FREE(lzh_son); FREE(lzh_son);
return(-1); } return(-1); }
if((lzh_rson=(short *)MALLOC((LZH_N + 257)*sizeof(short)))==NULL) { if((lzh_rson=(int16_t *)MALLOC((LZH_N + 257)*sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_prnt); FREE(lzh_prnt);
FREE(lzh_freq); FREE(lzh_freq);
FREE(lzh_son); FREE(lzh_son);
FREE(lzh_lson); FREE(lzh_lson);
return(-1); } return(-1); }
if((lzh_dad=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) { if((lzh_dad=(int16_t *)MALLOC((LZH_N + 1)*sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_prnt); FREE(lzh_prnt);
FREE(lzh_freq); FREE(lzh_freq);
@ -663,7 +663,7 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
lzh_text_buf[r + len] = inbuf[incnt++]; lzh_text_buf[r + len] = inbuf[incnt++];
/* textsize = len; */ /* textsize = len; */
for (i = 1; i <= LZH_F; i++) for (i = 1; i <= LZH_F; i++)
lzh_insert_node((short)(r - i)); lzh_insert_node((int16_t)(r - i));
lzh_insert_node(r); lzh_insert_node(r);
do { do {
if (lzh_match_length > len) if (lzh_match_length > len)
@ -672,7 +672,7 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
lzh_match_length = 1; lzh_match_length = 1;
lzh_encode_char(lzh_text_buf[r],outbuf,&outlen); lzh_encode_char(lzh_text_buf[r],outbuf,&outlen);
} else { } else {
lzh_encode_char((unsigned short)(255 - LZH_THRESHOLD + lzh_match_length) lzh_encode_char((uint16_t)(255 - LZH_THRESHOLD + lzh_match_length)
,outbuf,&outlen); ,outbuf,&outlen);
lzh_encode_position(lzh_match_position lzh_encode_position(lzh_match_position
,outbuf,&outlen); ,outbuf,&outlen);
@ -681,9 +681,9 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
for (i = 0; i < last_match_length && incnt<inlen; i++) { for (i = 0; i < last_match_length && incnt<inlen; i++) {
lzh_delete_node(s); lzh_delete_node(s);
c=inbuf[incnt++]; c=inbuf[incnt++];
lzh_text_buf[s] = (uchar)c; lzh_text_buf[s] = (uint8_t)c;
if (s < LZH_F - 1) if (s < LZH_F - 1)
lzh_text_buf[s + LZH_N] = (uchar)c; lzh_text_buf[s + LZH_N] = (uint8_t)c;
s = (s + 1) & (LZH_N - 1); s = (s + 1) & (LZH_N - 1);
r = (r + 1) & (LZH_N - 1); r = (r + 1) & (LZH_N - 1);
lzh_insert_node(r); lzh_insert_node(r);
@ -723,25 +723,25 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
/* Decoding/Uncompressing */ /* Decoding/Uncompressing */
/* Returns length of outbuf */ /* Returns length of outbuf */
long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf) int32_t LZHCALL lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
{ {
short int i, j, k, r, c; int16_t i, j, k, r, c;
unsigned long int count; uint32_t count;
long incnt,textsize; int32_t incnt, textsize;
#ifdef LZH_DYNAMIC_BUF #ifdef LZH_DYNAMIC_BUF
if((lzh_text_buf=(uchar *)MALLOC((LZH_N + LZH_F - 1)*2))==NULL) if((lzh_text_buf=(uint8_t *)MALLOC((LZH_N + LZH_F - 1)*2))==NULL)
return(-1); return(-1);
if((lzh_freq=(unsigned short *)MALLOC((LZH_T + 1)*sizeof(unsigned short))) if((lzh_freq=(uint16_t *)MALLOC((LZH_T + 1)*sizeof(uint16_t)))
==NULL) { ==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
return(-1); } return(-1); }
if((lzh_prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) { if((lzh_prnt=(int16_t *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_freq); FREE(lzh_freq);
return(-1); } return(-1); }
if((lzh_son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) { if((lzh_son=(int16_t *)MALLOC((LZH_T + 1) * sizeof(int16_t)))==NULL) {
FREE(lzh_text_buf); FREE(lzh_text_buf);
FREE(lzh_prnt); FREE(lzh_prnt);
FREE(lzh_freq); FREE(lzh_freq);
@ -764,17 +764,17 @@ long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
for (i = 0; i < LZH_N - LZH_F; i++) for (i = 0; i < LZH_N - LZH_F; i++)
*(lzh_text_buf+i) = ' '; *(lzh_text_buf+i) = ' ';
r = LZH_N - LZH_F; r = LZH_N - LZH_F;
for (count = 0; count < (unsigned long)textsize; ) { for (count = 0; count < (uint32_t)textsize; ) {
c = lzh_decode_char(inbuf,&incnt,inlen); c = lzh_decode_char(inbuf,&incnt,inlen);
if (c < 256) { if (c < 256) {
outbuf[count]=(uchar)c; outbuf[count]=(uint8_t)c;
#if 0 #if 0
if(r>(LZH_N + LZH_F - 1) || r<0) { if(r>(LZH_N + LZH_F - 1) || r<0) {
printf("Overflow! (%d)\n",r); printf("Overflow! (%d)\n",r);
getch(); getch();
exit(-1); } exit(-1); }
#endif #endif
*(lzh_text_buf+r) = (uchar)c; *(lzh_text_buf+r) = (uint8_t)c;
r++; r++;
r &= (LZH_N - 1); r &= (LZH_N - 1);
count++; count++;
@ -782,15 +782,15 @@ long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
i = (r - lzh_decode_position(inbuf,&incnt,inlen) - 1) i = (r - lzh_decode_position(inbuf,&incnt,inlen) - 1)
& (LZH_N - 1); & (LZH_N - 1);
j = c - 255 + LZH_THRESHOLD; j = c - 255 + LZH_THRESHOLD;
for (k = 0; k < j && count<(unsigned long)textsize; k++) { for (k = 0; k < j && count<(uint32_t)textsize; k++) {
c = lzh_text_buf[(i + k) & (LZH_N - 1)]; c = lzh_text_buf[(i + k) & (LZH_N - 1)];
outbuf[count]=(uchar)c; outbuf[count]=(uint8_t)c;
#if 0 #if 0
if(r>(LZH_N + LZH_F - 1) || r<0) { if(r>(LZH_N + LZH_F - 1) || r<0) {
printf("Overflow! (%d)\n",r); printf("Overflow! (%d)\n",r);
exit(-1); } exit(-1); }
#endif #endif
*(lzh_text_buf+r) = (uchar)c; *(lzh_text_buf+r) = (uint8_t)c;
r++; r++;
r &= (LZH_N - 1); r &= (LZH_N - 1);
count++; count++;

View File

@ -31,6 +31,8 @@
* 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
@ -64,15 +66,11 @@
#define LZHEXPORT #define LZHEXPORT
#endif #endif
#ifndef uchar
typedef unsigned char uchar;
#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

View File

@ -387,16 +387,16 @@ 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
@ -405,9 +405,9 @@ typedef struct _PACK { // Index record
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;
@ -415,21 +415,21 @@ 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)
@ -438,16 +438,16 @@ typedef struct _PACK { // Message header
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
@ -455,23 +455,23 @@ typedef struct _PACK { // Data field
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)
@ -529,16 +529,16 @@ typedef struct { // Message base
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

@ -661,8 +661,8 @@ 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) {
@ -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,7 +1175,7 @@ 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) {
@ -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) {
@ -1505,7 +1504,7 @@ 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

@ -105,15 +105,15 @@ 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);
@ -124,17 +124,17 @@ 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 */