Merge branch 'master' into coverity01
This commit is contained in:
commit
528afc8cea
4
Makefile
4
Makefile
|
@ -125,10 +125,10 @@ pjsua-test: cmp_wav
|
|||
cd tests/pjsua && python runall.py -t 2
|
||||
|
||||
cmp_wav:
|
||||
cd tests/pjsua/tools && make
|
||||
$(MAKE) -C tests/pjsua/tools
|
||||
|
||||
fuzz:
|
||||
cd tests/fuzz && make
|
||||
$(MAKE) -C tests/fuzz
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)$(libdir)/
|
||||
|
|
|
@ -149,7 +149,7 @@ $(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o | $(OBJDIRS)
|
|||
@echo all: >> $(OBJDIR)/Makefile
|
||||
@echo -e "\tmake -C $(KERNEL_DIR) M=`pwd`/$(OBJDIR) modules $(KERNEL_ARCH)" >> $(OBJDIR)/Makefile
|
||||
@echo Invoking kbuild...
|
||||
make -C $(OBJDIR)
|
||||
$(MAKE) -C $(OBJDIR)
|
||||
|
||||
../lib/$(app).ko: $(LIB) $(OBJDIR)/$(app).ko
|
||||
cp $(OBJDIR)/$(app).ko ../lib
|
||||
|
|
|
@ -126,7 +126,7 @@ static int xml_parse_print_test(const char *doc)
|
|||
int xml_test()
|
||||
{
|
||||
unsigned i;
|
||||
for (i=0; i<sizeof(xml_doc)/sizeof(xml_doc[0]); ++i) {
|
||||
for (i=0; i<PJ_ARRAY_SIZE(xml_doc); ++i) {
|
||||
int status;
|
||||
if ((status=xml_parse_print_test(xml_doc[i])) != 0)
|
||||
return status;
|
||||
|
|
|
@ -389,7 +389,7 @@ PJ_DEF(pj_status_t) pj_cli_create(pj_cli_cfg *cfg,
|
|||
pj_list_init(cli->root.sub_cmd);
|
||||
|
||||
/* Register some standard commands. */
|
||||
for (i = 0; i < sizeof(cmd_xmls)/sizeof(cmd_xmls[0]); i++) {
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(cmd_xmls); i++) {
|
||||
pj_str_t xml = pj_str(cmd_xmls[i]);
|
||||
|
||||
if (pj_cli_add_cmd_from_xml(cli, NULL, &xml,
|
||||
|
|
|
@ -95,7 +95,7 @@ static int pjlib_error(pj_status_t code, char *buf, pj_size_t size)
|
|||
#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0
|
||||
unsigned i;
|
||||
|
||||
for (i=0; i<sizeof(err_str)/sizeof(err_str[0]); ++i) {
|
||||
for (i=0; i<PJ_ARRAY_SIZE(err_str); ++i) {
|
||||
if (err_str[i].code == code) {
|
||||
pj_size_t len2 = pj_ansi_strlen(err_str[i].msg);
|
||||
if (len2 >= size) len2 = size-1;
|
||||
|
|
|
@ -1766,8 +1766,8 @@ static void ssl_ciphers_populate(void)
|
|||
};
|
||||
if (!ssl_cipher_num) {
|
||||
unsigned i;
|
||||
|
||||
ssl_cipher_num = sizeof(ciphers)/sizeof(ciphers[0]);
|
||||
|
||||
ssl_cipher_num = PJ_ARRAY_SIZE(ciphers);
|
||||
for (i = 0; i < ssl_cipher_num; i++) {
|
||||
ssl_ciphers[i].id = (pj_ssl_cipher)ciphers[i];
|
||||
ssl_ciphers[i].name = sslGetCipherSuiteString(ciphers[i]);
|
||||
|
|
|
@ -549,7 +549,7 @@ static int ioqueue_perf_test_imp(const pj_ioqueue_cfg *cfg)
|
|||
PJ_LOG(3,(THIS_FILE, " ======================================="));
|
||||
|
||||
best_bandwidth = 0;
|
||||
for (i=0; i<(int)(sizeof(test_param)/sizeof(test_param[0])); ++i) {
|
||||
for (i=0; i<(int)PJ_ARRAY_SIZE(test_param); ++i) {
|
||||
pj_size_t bandwidth;
|
||||
|
||||
rc = perform_test(cfg,
|
||||
|
|
|
@ -444,8 +444,7 @@ static int simple_sock_test(void)
|
|||
|
||||
PJ_LOG(3,("test", "...simple_sock_test()"));
|
||||
|
||||
for (i=0; i<(int)(sizeof(types)/sizeof(types[0])); ++i) {
|
||||
|
||||
for (i=0; i<(int)PJ_ARRAY_SIZE(types); ++i) {
|
||||
rc = pj_sock_socket(pj_AF_INET(), types[i], 0, &sock);
|
||||
if (rc != PJ_SUCCESS) {
|
||||
app_perror("...error: unable to create socket", rc);
|
||||
|
|
|
@ -437,6 +437,9 @@ PJ_DEF(pj_status_t) pjmedia_h264_unpacketize(pjmedia_h264_packetizer *pktz,
|
|||
while (q < q_end && p < p_end) {
|
||||
pj_uint16_t tmp_nal_size;
|
||||
|
||||
if (p + pktz->cfg.unpack_nal_start > p_end)
|
||||
return PJ_EINVAL;
|
||||
|
||||
/* Write NAL unit start code */
|
||||
pj_memcpy(p, nal_start_code, pktz->cfg.unpack_nal_start);
|
||||
p += pktz->cfg.unpack_nal_start;
|
||||
|
@ -444,7 +447,7 @@ PJ_DEF(pj_status_t) pjmedia_h264_unpacketize(pjmedia_h264_packetizer *pktz,
|
|||
/* Get NAL unit size */
|
||||
tmp_nal_size = (*q << 8) | *(q+1);
|
||||
q += 2;
|
||||
if (q + tmp_nal_size > q_end) {
|
||||
if (p + tmp_nal_size > p_end || q + tmp_nal_size > q_end) {
|
||||
/* Invalid bitstream, discard the rest of the payload */
|
||||
return PJ_EINVAL;
|
||||
}
|
||||
|
|
|
@ -307,8 +307,7 @@ PJ_DEF(pj_status_t) pjmedia_codec_silk_set_config(
|
|||
unsigned i;
|
||||
|
||||
/* Look up in factory modes table */
|
||||
for (i = 0; i < sizeof(silk_factory.silk_param)/
|
||||
sizeof(silk_factory.silk_param[0]); ++i)
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(silk_factory.silk_param); ++i)
|
||||
{
|
||||
if (silk_factory.silk_param[i].clock_rate == clock_rate) {
|
||||
int quality = PJMEDIA_CODEC_SILK_DEFAULT_QUALITY;
|
||||
|
|
|
@ -209,7 +209,7 @@ static pj_status_t cbar_factory_init(pjmedia_vid_dev_factory *f)
|
|||
ddi->info.has_callback = PJ_FALSE;
|
||||
|
||||
ddi->info.caps = PJMEDIA_VID_DEV_CAP_FORMAT;
|
||||
ddi->info.fmt_cnt = sizeof(cbar_fmts)/sizeof(cbar_fmts[0]);
|
||||
ddi->info.fmt_cnt = PJ_ARRAY_SIZE(cbar_fmts);
|
||||
for (i = 0; i < ddi->info.fmt_cnt; i++) {
|
||||
pjmedia_format *fmt = &ddi->info.fmt[i];
|
||||
pjmedia_format_init_video(fmt, cbar_fmts[i].fmt_id,
|
||||
|
@ -228,7 +228,7 @@ static pj_status_t cbar_factory_init(pjmedia_vid_dev_factory *f)
|
|||
ddi->info.has_callback = PJ_TRUE;
|
||||
|
||||
ddi->info.caps = PJMEDIA_VID_DEV_CAP_FORMAT;
|
||||
ddi->info.fmt_cnt = sizeof(cbar_fmts)/sizeof(cbar_fmts[0]);
|
||||
ddi->info.fmt_cnt = PJ_ARRAY_SIZE(cbar_fmts);
|
||||
for (i = 0; i < ddi->info.fmt_cnt; i++) {
|
||||
pjmedia_format *fmt = &ddi->info.fmt[i];
|
||||
pjmedia_format_init_video(fmt, cbar_fmts[i].fmt_id,
|
||||
|
@ -311,7 +311,7 @@ static const struct cbar_fmt_info* get_cbar_fmt_info(pjmedia_format_id id)
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(cbar_fmts)/sizeof(cbar_fmts[0]); i++) {
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(cbar_fmts); i++) {
|
||||
if (cbar_fmts[i].fmt_id == id)
|
||||
return &cbar_fmts[i];
|
||||
}
|
||||
|
|
|
@ -328,11 +328,10 @@ static void enum_dev_cap(IBaseFilter *filter,
|
|||
if (FAILED (hr))
|
||||
continue;
|
||||
|
||||
nformat = (dshow_fmt? 1:
|
||||
sizeof(dshow_fmts)/sizeof(dshow_fmts[0]));
|
||||
nformat = (dshow_fmt ? 1 : PJ_ARRAY_SIZE(dshow_fmts));
|
||||
for (j = 0; j < nformat; j++) {
|
||||
const GUID *dshow_format = dshow_fmt;
|
||||
|
||||
|
||||
if (!dshow_format)
|
||||
dshow_format = dshow_fmts[j].dshow_format;
|
||||
if (UuidCompare(&mediatype->subtype,
|
||||
|
@ -414,7 +413,7 @@ static pj_status_t dshow_factory_refresh(pjmedia_vid_dev_factory *f)
|
|||
df->dev_pool = NULL;
|
||||
}
|
||||
|
||||
for (c = 0; c < sizeof(dshow_fmts) / sizeof(dshow_fmts[0]); c++) {
|
||||
for (c = 0; c < PJ_ARRAY_SIZE(dshow_fmts); c++) {
|
||||
dshow_fmts[c].enabled = PJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -669,7 +668,7 @@ static dshow_fmt_info* get_dshow_format_info(pjmedia_format_id id)
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(dshow_fmts)/sizeof(dshow_fmts[0]); i++) {
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(dshow_fmts); i++) {
|
||||
if (dshow_fmts[i].pjmedia_format == id && dshow_fmts[i].enabled)
|
||||
return &dshow_fmts[i];
|
||||
}
|
||||
|
|
|
@ -632,7 +632,7 @@ static sdl_fmt_info* get_sdl_format_info(pjmedia_format_id id)
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(sdl_fmts)/sizeof(sdl_fmts[0]); i++) {
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(sdl_fmts); i++) {
|
||||
if (sdl_fmts[i].fmt_id == id)
|
||||
return &sdl_fmts[i];
|
||||
}
|
||||
|
|
|
@ -305,13 +305,11 @@ pjmedia_avi_player_create_streams(pj_pool_t *pool,
|
|||
/* Normalize the endian */
|
||||
if (elem == sizeof(strf_video_hdr_t))
|
||||
data_to_host2(&avi_hdr.strf_hdr[i],
|
||||
sizeof(strf_video_hdr_sizes)/
|
||||
sizeof(strf_video_hdr_sizes[0]),
|
||||
PJ_ARRAY_SIZE(strf_video_hdr_sizes),
|
||||
strf_video_hdr_sizes);
|
||||
else if (elem == sizeof(strf_audio_hdr_t))
|
||||
data_to_host2(&avi_hdr.strf_hdr[i],
|
||||
sizeof(strf_audio_hdr_sizes)/
|
||||
sizeof(strf_audio_hdr_sizes[0]),
|
||||
PJ_ARRAY_SIZE(strf_audio_hdr_sizes),
|
||||
strf_audio_hdr_sizes);
|
||||
|
||||
/* Skip the remainder of the header */
|
||||
|
@ -395,7 +393,7 @@ pjmedia_avi_player_create_streams(pj_pool_t *pool,
|
|||
}
|
||||
|
||||
fmt_id = avi_hdr.strl_hdr[i].codec;
|
||||
for (j = sizeof(avi_fmts)/sizeof(avi_fmts[0])-1; j >= 0; j--) {
|
||||
for (j = (int)PJ_ARRAY_SIZE(avi_fmts)-1; j >= 0; j--) {
|
||||
/* Check supported video formats here */
|
||||
if (fmt_id == avi_fmts[j].fmt_id) {
|
||||
if (avi_fmts[j].eff_fmt_id)
|
||||
|
|
|
@ -588,7 +588,7 @@ static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt)
|
|||
static int get_crypto_idx(const pj_str_t* crypto_name)
|
||||
{
|
||||
int i;
|
||||
int cs_cnt = sizeof(crypto_suites)/sizeof(crypto_suites[0]);
|
||||
int cs_cnt = PJ_ARRAY_SIZE(crypto_suites);
|
||||
|
||||
/* treat unspecified crypto_name as crypto 'NULL' */
|
||||
if (crypto_name->slen == 0)
|
||||
|
@ -645,7 +645,7 @@ PJ_DEF(pj_status_t) pjmedia_srtp_enum_crypto(unsigned *count,
|
|||
|
||||
PJ_ASSERT_RETURN(count && crypto, PJ_EINVAL);
|
||||
|
||||
max = sizeof(crypto_suites) / sizeof(crypto_suites[0]) - 1;
|
||||
max = PJ_ARRAY_SIZE(crypto_suites) - 1;
|
||||
if (*count > max)
|
||||
*count = max;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ static int sdp_conform_test(pj_pool_factory *pf)
|
|||
int i, len;
|
||||
char buf[1500];
|
||||
|
||||
for (i=0; i<sizeof(sdp)/sizeof(sdp[0]); ++i) {
|
||||
for (i=0; i<PJ_ARRAY_SIZE(sdp); ++i) {
|
||||
pool = pj_pool_create(pf, "sdp", 4096, 0, NULL);
|
||||
ses = pjsdp_parse(sdp[i], strlen(sdp[i]), pool);
|
||||
len = pjsdp_print(ses, buf, sizeof(buf));
|
||||
|
|
|
@ -1602,7 +1602,6 @@ static pj_status_t cmd_answer_call(pj_cli_cmd_val *cval)
|
|||
|
||||
} else {
|
||||
int st_code;
|
||||
char contact[120];
|
||||
pj_str_t hname = { "Contact", 7 };
|
||||
pj_str_t hvalue;
|
||||
pjsip_generic_string_hdr hcontact;
|
||||
|
@ -1621,7 +1620,7 @@ static pj_status_t cmd_answer_call(pj_cli_cmd_val *cval)
|
|||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
hvalue = pj_str(contact);
|
||||
hvalue = cval->argv[2];
|
||||
pjsip_generic_string_hdr_init2(&hcontact, &hname, &hvalue);
|
||||
|
||||
pj_list_push_back(&msg_data.hdr_list, &hcontact);
|
||||
|
|
|
@ -241,9 +241,9 @@ static int aviplay(pj_pool_t *pool, const char *fname)
|
|||
pjmedia_port codec_port;
|
||||
pjmedia_vid_codec_param codec_param;
|
||||
struct codec_fmt *codecp = NULL;
|
||||
|
||||
|
||||
/* Lookup codec */
|
||||
for (i = 0; i < sizeof(codec_fmts)/sizeof(codec_fmts[0]); i++) {
|
||||
for (i = 0; i < PJ_ARRAY_SIZE(codec_fmts); i++) {
|
||||
if (vid_port->info.fmt.id == codec_fmts[i].pjmedia_id) {
|
||||
codecp = &codec_fmts[i];
|
||||
break;
|
||||
|
|
|
@ -641,8 +641,7 @@ PJ_DEF(const pj_str_t*) pjsip_get_status_text(int code)
|
|||
init_status_phrase();
|
||||
}
|
||||
|
||||
return (code>=100 &&
|
||||
code<(int)(sizeof(status_phrase)/sizeof(status_phrase[0]))) ?
|
||||
return (code>=100 && code<(int)PJ_ARRAY_SIZE(status_phrase)) ?
|
||||
&status_phrase[code] : &status_phrase[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -23,17 +23,17 @@ CPP_DIR=pjlib pjlib-util pjnath pjmedia pjsip
|
|||
.PHONY: build_test distclean rm_build_mak build_mak everything pjlib_test pjlib_util_test pjnath_test pjsip_test cpp_prep cpp_test cpp_post pjsua_test
|
||||
|
||||
distclean:
|
||||
make distclean
|
||||
$(MAKE) distclean
|
||||
|
||||
rm_build_mak:
|
||||
rm -f build.mak
|
||||
|
||||
build_mak:
|
||||
./configure
|
||||
make dep
|
||||
$(MAKE) dep
|
||||
|
||||
everything:
|
||||
make
|
||||
$(MAKE)
|
||||
|
||||
pjlib_test:
|
||||
cd pjlib/bin && ./pjlib-test-`../../config.guess`
|
||||
|
@ -49,14 +49,14 @@ pjsip_test:
|
|||
|
||||
cpp_prep:
|
||||
for dir in $(CPP_DIR); do \
|
||||
make -C $$dir/build clean; \
|
||||
$(MAKE) -C $$dir/build clean; \
|
||||
done
|
||||
|
||||
cpp_test:
|
||||
make -f c++-build.mak
|
||||
$(MAKE) -f c++-build.mak
|
||||
|
||||
cpp_post:
|
||||
make -f c++-build.mak clean
|
||||
$(MAKE) -f c++-build.mak clean
|
||||
|
||||
pjsua_test: pjsua_config_file pjsua_local_port0 pjsua_ip_addr pjsua_no_tcp pjsua_no_udp pjsua_outbound pjsua_use_ice pjsua_add_codec pjsua_clock_rate pjsua_play_file pjsua_play_tone pjsua_rec_file pjsua_rtp_port pjsua_quality pjsua_ptime pjsua_ectail
|
||||
@echo pjsua_test completed successfully
|
||||
|
|
Loading…
Reference in New Issue