From bd9ea0319792ba5be0932ae9cdc9b2c610af9095 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 21 May 2007 18:53:58 +0000 Subject: [PATCH] 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 --- libs/openzap/src/isdn/Q921.c | 26 +++++++++++++------------- libs/openzap/src/isdn/Q932mes.c | 1 - libs/openzap/src/isdn/include/Q921.h | 4 ++-- libs/openzap/src/isdn/include/Q931.h | 6 ++++++ libs/openzap/src/isdn/include/mfifo.h | 18 +++++++++--------- libs/openzap/src/isdn/mfifo.c | 16 ++++++++-------- 6 files changed, 38 insertions(+), 33 deletions(-) diff --git a/libs/openzap/src/isdn/Q921.c b/libs/openzap/src/isdn/Q921.c index 81e709ba19..1396471570 100644 --- a/libs/openzap/src/isdn/Q921.c +++ b/libs/openzap/src/isdn/Q921.c @@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include "Q921.h" +#include "q921.h" #include #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; diff --git a/libs/openzap/src/isdn/Q932mes.c b/libs/openzap/src/isdn/Q932mes.c index 0540fa80f0..c0cf6505c3 100644 --- a/libs/openzap/src/isdn/Q932mes.c +++ b/libs/openzap/src/isdn/Q932mes.c @@ -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 diff --git a/libs/openzap/src/isdn/include/Q921.h b/libs/openzap/src/isdn/include/Q921.h index acb830383f..5537a17aeb 100644 --- a/libs/openzap/src/isdn/include/Q921.h +++ b/libs/openzap/src/isdn/include/Q921.h @@ -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 diff --git a/libs/openzap/src/isdn/include/Q931.h b/libs/openzap/src/isdn/include/Q931.h index dd8261cff3..6e71a27420 100644 --- a/libs/openzap/src/isdn/include/Q931.h +++ b/libs/openzap/src/isdn/include/Q931.h @@ -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 diff --git a/libs/openzap/src/isdn/include/mfifo.h b/libs/openzap/src/isdn/include/mfifo.h index 21a053173e..788adfdb10 100644 --- a/libs/openzap/src/isdn/include/mfifo.h +++ b/libs/openzap/src/isdn/include/mfifo.h @@ -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 diff --git a/libs/openzap/src/isdn/mfifo.c b/libs/openzap/src/isdn/mfifo.c index adf6bc9ebd..9e409f8a92 100644 --- a/libs/openzap/src/isdn/mfifo.c +++ b/libs/openzap/src/isdn/mfifo.c @@ -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;