normalize using unsigned char for buffers instead of mixed signed/unsigned in isdn code.

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@68 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2007-05-21 18:53:58 +00:00
parent 23043a7e4d
commit bd9ea03197
6 changed files with 38 additions and 33 deletions

View File

@ -43,7 +43,7 @@
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q921.h"
#include "q921.h"
#include <stdlib.h>
#include "mfifo.h"
@ -111,7 +111,7 @@ void Q921SetTx23CB(int (*callback)(int dev, unsigned char *, int))
size size of frame in bytes
*****************************************************************************/
int Q921QueueHDLCFrame(int trunk, char *b, int size)
int Q921QueueHDLCFrame(int trunk, unsigned char *b, int size)
{
return MFIFOWriteMes(Q921DevSpace[trunk].HDLCInQueue, b, size);
}
@ -135,7 +135,7 @@ int Q921QueueHDLCFrame(int trunk, char *b, int size)
Return Value: 0 if failed, 1 if Send.
*****************************************************************************/
int Q921SendI(int trunk, unsigned char Sapi, char cr, unsigned char Tei, char pf, char *mes, int size)
int Q921SendI(int trunk, unsigned char Sapi, char cr, unsigned char Tei, char pf, unsigned char *mes, int size)
{
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -164,7 +164,7 @@ int Q921SendI(int trunk, unsigned char Sapi, char cr, unsigned char Tei, char pf
int Q921SendRR(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -191,7 +191,7 @@ int Q921SendRR(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendRNR(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -218,7 +218,7 @@ int Q921SendRNR(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendREJ(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -245,7 +245,7 @@ int Q921SendREJ(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendSABME(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -271,7 +271,7 @@ int Q921SendSABME(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendDM(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -316,7 +316,7 @@ int Q921SendDM(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendDISC(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -342,7 +342,7 @@ int Q921SendDISC(int trunk, int Sapi, int cr, int Tei, int pf)
*****************************************************************************/
int Q921SendUA(int trunk, int Sapi, int cr, int Tei, int pf)
{
char mes[400];
unsigned char mes[400];
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
@ -389,7 +389,7 @@ int Q921SendUA(int trunk, int Sapi, int cr, int Tei, int pf)
//{
//}
int Q921ProcSABME(int trunk, char *mes, int size)
int Q921ProcSABME(int trunk, unsigned char *mes, int size)
{
Q921DevSpace[trunk].vr=0;
Q921DevSpace[trunk].vs=0;
@ -417,9 +417,9 @@ int Q921ProcSABME(int trunk, char *mes, int size)
*****************************************************************************/
int Q921Rx12(long trunk)
{
char *mes;
unsigned char *mes;
int rs,size; /* receive size & Q921 frame size*/
char *smes = MFIFOGetMesPtr(Q921DevSpace[trunk].HDLCInQueue, &size);
unsigned char *smes = MFIFOGetMesPtr(Q921DevSpace[trunk].HDLCInQueue, &size);
if(smes != NULL)
{
rs = size - Q921HeaderSpace;

View File

@ -48,7 +48,6 @@ L3INT Q932Umes_Facility(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3I
L3INT i = IOff;
L3INT ir=0;
L3INT OOff=0;
L3INT rc=Q931E_NO_ERROR;
Q932mes_Facility *mes = (Q932mes_Facility*)IBuf;
//TODO

View File

@ -85,7 +85,7 @@
typedef struct
{
char HDLCInQueue[Q921MAXHDLCSPACE];
unsigned char HDLCInQueue[Q921MAXHDLCSPACE];
unsigned char vs;
unsigned char vr;
int state;
@ -95,7 +95,7 @@ void Q921Init();
void Q921SetHeaderSpace(int hspace);
void Q921SetTx21CB(int (*callback)(int dev, unsigned char *, int));
void Q921SetTx23CB(int (*callback)(int dev, unsigned char *, int));
int Q921QueueHDLCFrame(int trunk, char *b, int size);
int Q921QueueHDLCFrame(int trunk, unsigned char *b, int size);
int Q921Rx12(long trunk);
#endif

View File

@ -112,6 +112,12 @@
#include "stdio.h"
#ifdef _MSC_VER
/* warning C4100 : unreferenced formal parameter */
/* warning C4189 : local variable is initialized but not referenced TODO: This one should not be disabled*/
#pragma warning(disable:4100 4189)
#endif
/*****************************************************************************
Error Codes

View File

@ -63,7 +63,7 @@ typedef struct _mfifo
int first; /* first out */
int last; /* last in + 1 */
int bsize; /* buffer size */
char *buf; /* ptr to start of buffer */
unsigned char *buf; /* ptr to start of buffer */
int ixsize; /* index size */
MINDEX ix[1]; /* message index */
}MFIFO;
@ -71,13 +71,13 @@ typedef struct _mfifo
/*****************************************************************************
Function prototypes.
*****************************************************************************/
int MFIFOCreate(char *buf, int size, int index);
void MFIFOClear(char * buf);
int MFIFOGetLBOffset(char *buf);
int MFIFOGetFBOffset(char *buf);
void MFIFOWriteIX(char *buf, char *mes, int size, int ix, int off);
int MFIFOWriteMes(char *buf, char *mes, int size);
char * MFIFOGetMesPtr(char *buf, int *size);
void MFIFOKillNext(char *buf);
int MFIFOCreate(unsigned char *buf, int size, int index);
void MFIFOClear(unsigned char * buf);
int MFIFOGetLBOffset(unsigned char *buf);
int MFIFOGetFBOffset(unsigned char *buf);
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off);
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size);
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size);
void MFIFOKillNext(unsigned char *buf);
#endif

View File

@ -82,7 +82,7 @@
Return value: 0 if failure, 1 if ok.
*****************************************************************************/
int MFIFOCreate(char *buf, int size, int index)
int MFIFOCreate(unsigned char *buf, int size, int index)
{
MFIFO * mf;
mf = (MFIFO*)buf;
@ -110,7 +110,7 @@ int MFIFOCreate(char *buf, int size, int index)
Return Value: none
*****************************************************************************/
void MFIFOClear(char * buf)
void MFIFOClear(unsigned char * buf)
{
MFIFO * mf;
mf = (MFIFO*)buf;
@ -128,7 +128,7 @@ void MFIFOClear(char * buf)
Return Value: offset.
*****************************************************************************/
int MFIFOGetLBOffset(char *buf)
int MFIFOGetLBOffset(unsigned char *buf)
{
MFIFO * mf;
mf = (MFIFO*)buf;
@ -151,7 +151,7 @@ int MFIFOGetLBOffset(char *buf)
Return Value: offset
*****************************************************************************/
int MFIFOGetFBOffset(char *buf)
int MFIFOGetFBOffset(unsigned char *buf)
{
int x;
MFIFO * mf;
@ -182,7 +182,7 @@ int MFIFOGetFBOffset(char *buf)
Return Value: none
*****************************************************************************/
void MFIFOWriteIX(char *buf, char *mes, int size, int ix, int off)
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off)
{
int x;
MFIFO * mf;
@ -207,7 +207,7 @@ void MFIFOWriteIX(char *buf, char *mes, int size, int ix, int off)
Return Value:
*****************************************************************************/
int MFIFOWriteMes(char *buf, char *mes, int size)
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size)
{
int of,ol,x;
MFIFO * mf;
@ -260,7 +260,7 @@ int MFIFOWriteMes(char *buf, char *mes, int size)
Return Value:
*****************************************************************************/
char * MFIFOGetMesPtr(char *buf, int *size)
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size)
{
MFIFO * mf;
mf = (MFIFO*)buf;
@ -281,7 +281,7 @@ char * MFIFOGetMesPtr(char *buf, int *size)
Return Value:
*****************************************************************************/
void MFIFOKillNext(char *buf)
void MFIFOKillNext(unsigned char *buf)
{
int x;
MFIFO * mf;