build with all the strict flags on

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@402 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2008-02-18 17:17:38 +00:00
parent 54fb9a3ca0
commit d809d5111d
16 changed files with 96 additions and 35 deletions

View File

@ -32,7 +32,7 @@ AX_COMPILER_VENDOR
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-Wall -Werror -Wextra -Wno-unused-parameter"
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
@ -41,7 +41,7 @@ sun)
fi
;;
*)
COMP_VENDOR_CFLAGS="-Wall -Werror -Wextra -Wno-unused-parameter"
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
;;
esac

View File

@ -27,6 +27,8 @@ hashtable_iterator(struct hashtable *h);
/*****************************************************************************/
/* hashtable_iterator_key
* - return the value of the (key,value) pair at the current position */
extern __inline__ void *
hashtable_iterator_key(struct hashtable_itr *i);
extern __inline__ void *
hashtable_iterator_key(struct hashtable_itr *i)
@ -37,6 +39,9 @@ hashtable_iterator_key(struct hashtable_itr *i)
/*****************************************************************************/
/* value - return the value of the (key,value) pair at the current position */
extern __inline__ void *
hashtable_iterator_value(struct hashtable_itr *i);
extern __inline__ void *
hashtable_iterator_value(struct hashtable_itr *i)
{

View File

@ -77,7 +77,7 @@ struct zap_config {
/*! FILE stream buffer to the opened file */
FILE *file;
/*! path to the file */
char *path;
const char *path;
/*! current category */
char category[256];
/*! current section */
@ -100,7 +100,7 @@ struct zap_config {
\param file_path path to the file
\return 1 (true) on success 0 (false) on failure
*/
int zap_config_open_file(zap_config_t * cfg, char *file_path);
int zap_config_open_file(zap_config_t * cfg, const char *file_path);
/*!
\brief Close a previously opened configuration file

View File

@ -412,7 +412,7 @@ typedef zap_status_t (*zio_write_t) ZIO_WRITE_ARGS ;
typedef struct zap_fsk_data_state zap_fsk_data_state_t;
typedef int (*zap_fsk_data_decoder_t)(zap_fsk_data_state_t *state);
typedef zap_status_t (*zap_fsk_write_sample_t)(int16_t *buf, zap_size_t buflen, void *user_data);
typedef void (*zap_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...);
typedef void (*zap_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...);
typedef struct zap_io_interface zap_io_interface_t;
typedef struct hashtable zap_hash_t;
typedef struct hashtable_itr zap_hash_itr_t;

View File

@ -50,8 +50,9 @@
however run smoothly under the generic space, so these functions are more
for show
*/
void EuroISDNCreateTE(L3UCHAR i)
#if 0
static void EuroISDNCreateTE(L3UCHAR i)
{
Q931CreateTE(i);
}
#endif

View File

@ -84,7 +84,7 @@ void Q921_InitTrunk(L2TRUNK trunk,
trunk->T203Timeout = 10000;
}
static int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size)
int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size)
{
return trunk->Q921Tx21Proc(trunk->PrivateData21, Msg, size);
}
@ -105,10 +105,10 @@ int Q921Tx23Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size)
Return Value: none
*****************************************************************************/
L2ULONG (*Q921GetTimeProc) ()=NULL; /* callback for func reading time in ms */
static L2ULONG tLast={0};
L2ULONG (*Q921GetTimeProc) (void) = NULL; /* callback for func reading time in ms */
L2ULONG tLast = {0};
L2ULONG Q921GetTime()
L2ULONG Q921GetTime(void)
{
L2ULONG tNow = 0;
if(Q921GetTimeProc != NULL)
@ -182,7 +182,7 @@ void Q921TimerTick(L2TRUNK trunk)
}
void Q921SetGetTimeCB(L2ULONG (*callback)())
void Q921SetGetTimeCB(L2ULONG (*callback)(void))
{
Q921GetTimeProc = callback;
}

View File

@ -96,7 +96,7 @@ L3INT Q931L2HeaderSpace = {4}; /* Q921 header space, sapi, tei etc */
Q931ErrorCB_t Q931ErrorProc;
/* callback for error messages. */
L3ULONG (*Q931GetTimeProc) ()=NULL; /* callback for func reading time in ms */
L3ULONG (*Q931GetTimeProc) (void) = NULL; /* callback for func reading time in ms */
/*****************************************************************************
@ -606,7 +606,7 @@ L3ULONG Q931GetTime()
return tNow;
}
void Q931SetGetTimeCB(L3ULONG (*callback)())
void Q931SetGetTimeCB(L3ULONG (*callback)(void))
{
Q931GetTimeProc = callback;
}

View File

@ -131,7 +131,29 @@ int Q921QueueHDLCFrame(L2TRUNK trunk, L2UCHAR *b, L2INT size);
int Q921Rx12(L2TRUNK trunk);
int Q921Rx32(L2TRUNK trunk, L2UCHAR * Mes, L2INT Size);
int Q921Start(L2TRUNK trunk);
void Q921SetGetTimeCB(L2ULONG (*callback)());
void Q921SetGetTimeCB(L2ULONG (*callback)(void));
void Q921TimerTick(L2TRUNK trunk);
int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size);
int Q921Tx23Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size);
extern L2ULONG tLast;
L2ULONG Q921GetTime(void);
void Q921T200TimerStart(L2TRUNK trunk);
void Q921T200TimerStop(L2TRUNK trunk);
void Q921T200TimerReset(L2TRUNK trunk);
void Q921T203TimerStart(L2TRUNK trunk);
void Q921T203TimerStop(L2TRUNK trunk);
void Q921T203TimerReset(L2TRUNK trunk);
void Q921T200TimerExpire(L2TRUNK trunk);
void Q921T203TimerExpire(L2TRUNK trunk);
int Q921SendI(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, L2INT size);
int Q921SendRNR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921SendREJ(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921SendSABME(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921SendDM(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921SendDISC(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921SendUA(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
int Q921ProcSABME(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
#endif

View File

@ -126,10 +126,10 @@
Enum helper macros <Need description of these macros>
*****************************************************************************/
#define Q931_ENUM_NAMES(_NAME, _STRINGS) static char * _NAME [] = { _STRINGS , NULL };
#define Q931_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (char *name); char * _FUNC2 (_TYPE type);
#define Q931_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
#define Q931_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type);
#define Q931_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
_TYPE _FUNC1 (char *name) \
_TYPE _FUNC1 (const char *name) \
{ \
int i; \
_TYPE t = _MAX ; \
@ -143,7 +143,7 @@
\
return t; \
} \
char * _FUNC2 (_TYPE type) \
const char * _FUNC2 (_TYPE type) \
{ \
if (type > _MAX) { \
type = _MAX; \
@ -904,14 +904,14 @@ void Q931SetDefaultErrorCB(Q931ErrorCB_t Q931ErrorPar);
void Q931CreateTE(L3UCHAR i);
void Q931CreateNT(L3UCHAR i);
void Q931SetMesCreateCB(L3INT (*callback)());
void Q931SetMesCreateCB(L3INT (*callback)(void));
void Q931SetDialectCreateCB(L3INT (*callback)(L3INT));
void Q931SetHeaderSpace(L3INT space);
void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, q931proc_func_t *Q931ProcFunc, q931umes_func_t *Q931UmesFunc, q931pmes_func_t *Q931PmesFunc);
void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, q931pie_func_t *Q931PieProc, q931uie_func_t *Q931UieProc);
void Q931Initialize();
void Q931Initialize(void);
void Q931AddDialect(L3UCHAR iDialect, void (*Q931CreateDialectCB)(L3UCHAR iDialect));
L3INT Q931InitMesSetup(Q931mes_Generic *p);
L3INT Q931InitMesRestartAck(Q931mes_Generic * pMes);
@ -924,8 +924,8 @@ L3INT Q931GetCallState(Q931_TrunkInfo_t *pTrunk, L3INT iCRV);
L3INT Q931StartTimer(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3USHORT iTimer);
L3INT Q931StopTimer(Q931_TrunkInfo_t *pTrunk, L3INT callindex, L3USHORT iTimer);
L3INT Q931SetState(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3INT iState);
L3ULONG Q931GetTime();
void Q931SetGetTimeCB(L3ULONG (*callback)());
L3ULONG Q931GetTime(void);
void Q931SetGetTimeCB(L3ULONG (*callback)(void));
void Q931AddStateEntry(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir);
L3BOOL Q931IsEventLegal(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir);
@ -970,4 +970,21 @@ L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk,
void *PrivateData32,
void *PrivateData34);
L3INT Q931GetMesSize(Q931mes_Generic *pMes);
L3INT Q931InitMesResume(Q931mes_Generic * pMes);
void Q931SetL4HeaderSpace(L3INT space);
void Q931SetL2HeaderSpace(L3INT space);
L3INT Q931ProcDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b,L3INT c);
L3INT Q931UmesDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size);
L3INT Q931UieDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff);
L3INT Q931PmesDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT Q931PieDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet);
L3INT Q931TxDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT n);
L3INT Q931ErrorDummy(void *priv, L3INT a, L3INT b, L3INT c);
#endif /* _Q931_NL */

View File

@ -1161,4 +1161,12 @@ q931uie_func_t Q931Uie_UserUser;
q931uie_func_t Q931Uie_GenericDigits;
L3INT Q931ReadExt(L3UCHAR * IBuf, L3INT Off);
L3INT Q931Uie_CongLevel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff);
L3INT Q931Pie_CongLevel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet);
L3INT Q931Uie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff);
L3INT Q931Pie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet);
#endif /* _Q931IE_NL */

View File

@ -34,10 +34,10 @@
#include "openzap.h"
#include "zap_config.h"
int zap_config_open_file(zap_config_t *cfg, char *file_path)
int zap_config_open_file(zap_config_t *cfg, const char *file_path)
{
FILE *f;
char *path = NULL;
const char *path = NULL;
char path_buf[1024];
if (file_path[0] == '/') {
@ -136,8 +136,8 @@ int zap_config_next_pair(zap_config_t *cfg, char **var, char **val)
}
cfg->catno = 0;
cfg->lineno = 0;
*var = "";
*val = "";
*var = (char *) "";
*val = (char *) "";
return 1;
} else {
zap_copy_string(cfg->category, *var, sizeof(cfg->category));

View File

@ -111,9 +111,9 @@ ZAP_STR2ENUM(zap_str2zap_channel_state, zap_channel_state2str, zap_channel_state
ZAP_ENUM_NAMES(MDMF_TYPE_NAMES, MDMF_STRINGS)
ZAP_STR2ENUM(zap_str2zap_mdmf_type, zap_mdmf_type2str, zap_mdmf_type_t, MDMF_TYPE_NAMES, MDMF_INVALID)
static char *cut_path(char *in)
static const char *cut_path(const char *in)
{
char *p, *ret = in;
const char *p, *ret = in;
char delims[] = "/\\";
char *i;
@ -126,7 +126,7 @@ static char *cut_path(char *in)
return ret;
}
static void null_logger(char *file, const char *func, int line, int level, char *fmt, ...)
static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...)
{
if (file && func && line && level && fmt) {
return;
@ -135,7 +135,7 @@ static void null_logger(char *file, const char *func, int line, int level, char
}
static char *LEVEL_NAMES[] = {
static const char *LEVEL_NAMES[] = {
"EMERG",
"ALERT",
"CRIT",
@ -149,9 +149,9 @@ static char *LEVEL_NAMES[] = {
static int zap_log_level = 7;
static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...)
static void default_logger(const char *file, const char *func, int line, int level, const char *fmt, ...)
{
char *fp;
const char *fp;
char data[1024];
va_list ap;

View File

@ -44,7 +44,7 @@
#define LINE "--------------------------------------------------------------------------------"
//#define IODEBUG
static L2ULONG zap_time_now()
static L2ULONG zap_time_now(void)
{
return (L2ULONG)zap_current_time_in_ms();
}

View File

@ -42,6 +42,8 @@
#define TRY_OR_DIE(__code, __status, __label) if ((status = __code ) != __status) goto __label
#define pk_atof(__a) (PK_FLOAT) atof(__a)
PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event);
ZAP_ENUM_NAMES(PIKA_SPAN_NAMES, PIKA_SPAN_STRINGS)
ZAP_STR2ENUM(pika_str2span, pika_span2str, PIKA_TSpanFraming, PIKA_SPAN_NAMES, PIKA_SPAN_INVALID)
@ -126,7 +128,7 @@ struct pika_chan_data {
};
typedef struct pika_chan_data pika_chan_data_t;
static char *pika_board_type_string(PK_UINT type)
static const char *pika_board_type_string(PK_UINT type)
{
if (type == PKH_BOARD_TYPE_DIGITAL_GATEWAY) {
return "digital_gateway";

View File

@ -55,6 +55,9 @@ static struct {
/* a bunch of this stuff should go into the wanpipe_tdm_api_iface.h */
ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event);
ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event);
#define WP_INVALID_SOCKET -1
/* on windows right now, there is no way to specify if we want to read events here or not, we allways get them here */
/* we need some what to select if we are reading regular tdm msgs or events */

View File

@ -48,6 +48,9 @@ static struct {
static const char ctlpath[] = "/dev/zap/ctl";
static zap_socket_t CONTROL_FD = ZT_INVALID_SOCKET;
ZIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event);
ZIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event);
static unsigned zt_open_range(zap_span_t *span, unsigned start, unsigned end, zap_chan_type_t type, char *name, char *number)
{
unsigned configured = 0, x;