diff options
author | Riza Sulistyo <riza@teluu.com> | 2013-06-19 06:47:43 +0000 |
---|---|---|
committer | Riza Sulistyo <riza@teluu.com> | 2013-06-19 06:47:43 +0000 |
commit | d7aa4332dae06ae890053dd13239ddabee46b86c (patch) | |
tree | 34c599b317369bcc33827d5ee1200604a6599164 /pjsip-apps/src/samples | |
parent | 7949b9e53b97281cfa4526ffe5cf7c7d887b7025 (diff) |
Re #1680: Add initial support for Win64
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4537 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/samples')
-rw-r--r-- | pjsip-apps/src/samples/aectest.c | 2 | ||||
-rw-r--r-- | pjsip-apps/src/samples/aviplay.c | 4 | ||||
-rw-r--r-- | pjsip-apps/src/samples/confbench.c | 3 | ||||
-rw-r--r-- | pjsip-apps/src/samples/confsample.c | 2 | ||||
-rw-r--r-- | pjsip-apps/src/samples/icedemo.c | 10 | ||||
-rw-r--r-- | pjsip-apps/src/samples/latency.c | 3 | ||||
-rw-r--r-- | pjsip-apps/src/samples/pcaputil.c | 14 | ||||
-rw-r--r-- | pjsip-apps/src/samples/pjsip-perf.c | 24 | ||||
-rw-r--r-- | pjsip-apps/src/samples/playsine.c | 3 | ||||
-rw-r--r-- | pjsip-apps/src/samples/sipecho.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/siprtp.c | 12 | ||||
-rw-r--r-- | pjsip-apps/src/samples/streamutil.c | 6 | ||||
-rw-r--r-- | pjsip-apps/src/samples/tonegen.c | 2 | ||||
-rw-r--r-- | pjsip-apps/src/samples/util.h | 4 | ||||
-rw-r--r-- | pjsip-apps/src/samples/vid_streamutil.c | 7 |
15 files changed, 55 insertions, 46 deletions
diff --git a/pjsip-apps/src/samples/aectest.c b/pjsip-apps/src/samples/aectest.c index 4168f698..645fd88d 100644 --- a/pjsip-apps/src/samples/aectest.c +++ b/pjsip-apps/src/samples/aectest.c @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) } pj_get_timestamp(&t1); - i = pjmedia_wav_writer_port_get_pos(wav_out) / sizeof(pj_int16_t) * 1000 / + i = (int)pjmedia_wav_writer_port_get_pos(wav_out) / sizeof(pj_int16_t) * 1000 / (PJMEDIA_PIA_SRATE(&wav_out->info) * PJMEDIA_PIA_CCNT(&wav_out->info)); PJ_LOG(3,(THIS_FILE, "Processed %3d.%03ds audio", i / 1000, i % 1000)); diff --git a/pjsip-apps/src/samples/aviplay.c b/pjsip-apps/src/samples/aviplay.c index a4d92764..35b05044 100644 --- a/pjsip-apps/src/samples/aviplay.c +++ b/pjsip-apps/src/samples/aviplay.c @@ -155,7 +155,7 @@ static pj_status_t codec_get_frame(pjmedia_port *port, if (status != PJ_SUCCESS) goto on_error; status = pjmedia_vid_codec_decode(codec, 1, frame, - frame->size, &enc_frame); + (unsigned)frame->size, &enc_frame); if (status != PJ_SUCCESS) goto on_error; frame->size = frame_size; @@ -169,7 +169,7 @@ static pj_status_t codec_get_frame(pjmedia_port *port, if (status != PJ_SUCCESS) goto on_error; status = pjmedia_vid_codec_decode(codec, 1, &enc_frame, - frame->size, frame); + (unsigned)frame->size, frame); if (status != PJ_SUCCESS) goto on_error; return PJ_SUCCESS; diff --git a/pjsip-apps/src/samples/confbench.c b/pjsip-apps/src/samples/confbench.c index db9cd55f..84305f6c 100644 --- a/pjsip-apps/src/samples/confbench.c +++ b/pjsip-apps/src/samples/confbench.c @@ -144,7 +144,8 @@ static pj_status_t sine_get_frame( pjmedia_port *port, { port_data *sine = port->port_data.pdata; pj_int16_t *samples = frame->buf; - unsigned i, count, left, right; + unsigned i, left, right; + pj_size_t count; /* Get number of samples */ count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info); diff --git a/pjsip-apps/src/samples/confsample.c b/pjsip-apps/src/samples/confsample.c index 7da70e11..de9c29ff 100644 --- a/pjsip-apps/src/samples/confsample.c +++ b/pjsip-apps/src/samples/confsample.c @@ -105,7 +105,7 @@ static pj_bool_t input(const char *title, char *buf, pj_size_t len) char *p; printf("%s (empty to cancel): ", title); fflush(stdout); - if (fgets(buf, len, stdin) == NULL) + if (fgets(buf, (int)len, stdin) == NULL) return PJ_FALSE; /* Remove trailing newlines. */ diff --git a/pjsip-apps/src/samples/icedemo.c b/pjsip-apps/src/samples/icedemo.c index 943befb2..4cb9f221 100644 --- a/pjsip-apps/src/samples/icedemo.c +++ b/pjsip-apps/src/samples/icedemo.c @@ -547,7 +547,7 @@ static int print_cand(char buffer[], unsigned maxlen, *p = '\0'; - return p-buffer; + return (int)(p-buffer); } /* @@ -622,7 +622,7 @@ static int encode_session(char buffer[], unsigned maxlen) /* And encode the candidates as SDP */ for (j=0; j<cand_cnt; ++j) { - printed = print_cand(p, maxlen - (p-buffer), &cand[j]); + printed = print_cand(p, maxlen - (unsigned)(p-buffer), &cand[j]); if (printed < 0) return -PJ_ETOOSMALL; p += printed; @@ -633,7 +633,7 @@ static int encode_session(char buffer[], unsigned maxlen) return -PJ_ETOOSMALL; *p = '\0'; - return p - buffer; + return (int)(p - buffer); } @@ -727,7 +727,7 @@ static void icedemo_input_remote(void) comp0_addr[0] = '\0'; while (!done) { - int len; + pj_size_t len; char *line; printf(">"); @@ -1077,7 +1077,7 @@ static void icedemo_console(void) while (!app_quit) { char input[80], *cmd; const char *SEP = " \t\r\n"; - int len; + pj_size_t len; icedemo_print_menu(); diff --git a/pjsip-apps/src/samples/latency.c b/pjsip-apps/src/samples/latency.c index 297b80b7..c9192b52 100644 --- a/pjsip-apps/src/samples/latency.c +++ b/pjsip-apps/src/samples/latency.c @@ -51,7 +51,8 @@ static int calculate_latency(pj_pool_t *pool, pjmedia_port *wav) { pjmedia_frame frm; short *buf; - unsigned i, samples_per_frame, read, len; + unsigned i, samples_per_frame; + pj_size_t read, len; unsigned start_pos; pj_status_t status; diff --git a/pjsip-apps/src/samples/pcaputil.c b/pjsip-apps/src/samples/pcaputil.c index 81015256..bb231127 100644 --- a/pjsip-apps/src/samples/pcaputil.c +++ b/pjsip-apps/src/samples/pcaputil.c @@ -88,7 +88,7 @@ static void cleanup() pj_ssize_t pos = pjmedia_wav_writer_port_get_pos(app.wav); if (pos >= 0) { unsigned msec; - msec = pos / 2 * 1000 / PJMEDIA_PIA_SRATE(&app.wav->info); + msec = (unsigned)pos / 2 * 1000 / PJMEDIA_PIA_SRATE(&app.wav->info); printf("Written: %dm:%02ds.%03d\n", msec / 1000 / 60, (msec / 1000) % 60, @@ -162,7 +162,7 @@ static void read_rtp(pj_uint8_t *buf, pj_size_t bufsize, * We will decode it again to get the payload after we do * SRTP decoding */ - status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, sz, &r, + status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, (int)sz, &r, &p, payload_size); if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; @@ -174,7 +174,7 @@ static void read_rtp(pj_uint8_t *buf, pj_size_t bufsize, /* Decrypt SRTP */ #if PJMEDIA_HAS_SRTP if (app.srtp) { - int len = sz; + int len = (int)sz; status = pjmedia_transport_srtp_decrypt_pkt(app.srtp, PJ_TRUE, buf, &len); if (status != PJ_SUCCESS) { @@ -187,7 +187,7 @@ static void read_rtp(pj_uint8_t *buf, pj_size_t bufsize, sz = len; /* Decode RTP packet again */ - status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, sz, &r, + status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, (int)sz, &r, &p, payload_size); if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; @@ -376,8 +376,8 @@ static void pcap2wav(const pj_str_t *codec, pcm_frame.buf = pcm; pcm_frame.size = samples_per_frame * 2; - T( pjmedia_codec_decode(app.codec, &frames[i], pcm_frame.size, - &pcm_frame) ); + T( pjmedia_codec_decode(app.codec, &frames[i], + (unsigned)pcm_frame.size, &pcm_frame) ); if (app.wav) { T( pjmedia_port_put_frame(app.wav, &pcm_frame) ); } @@ -400,7 +400,7 @@ static void pcap2wav(const pj_str_t *codec, pcm_frame.size = samples_per_frame * 2; if (app.codec->op->recover) { - T( pjmedia_codec_recover(app.codec, pcm_frame.size, + T( pjmedia_codec_recover(app.codec, (unsigned)pcm_frame.size, &pcm_frame) ); } else { pj_bzero(pcm_frame.buf, pcm_frame.size); diff --git a/pjsip-apps/src/samples/pjsip-perf.c b/pjsip-apps/src/samples/pjsip-perf.c index ae4ce041..2a435cfe 100644 --- a/pjsip-apps/src/samples/pjsip-perf.c +++ b/pjsip-apps/src/samples/pjsip-perf.c @@ -67,7 +67,7 @@ #include <pjlib.h> #include <stdio.h> -#if defined(PJ_WIN32) && PJ_WIN32!=0 +#if (defined(PJ_WIN32) && PJ_WIN32!=0) || (defined(PJ_WIN64) && PJ_WIN64!=0) # include <windows.h> #endif @@ -1006,7 +1006,7 @@ static void call_on_state_changed( pjsip_inv_session *inv, } else if (inv->state == PJSIP_INV_STATE_DISCONNECTED) { report_completion(inv->cause); - inv->mod_data[mod_test.id] = (void*)1; + inv->mod_data[mod_test.id] = (void*)(pj_ssize_t)1; } } @@ -1093,7 +1093,7 @@ static pj_status_t verify_sip_url(const char *c_url) pjsip_uri *p; pj_pool_t *pool; char *url; - int len = (c_url ? pj_ansi_strlen(c_url) : 0); + pj_size_t len = (c_url ? pj_ansi_strlen(c_url) : 0); if (!len) return -1; @@ -1370,18 +1370,18 @@ static void tsx_completion_cb(void *token, pjsip_event *event) if (tsx->state==PJSIP_TSX_STATE_TERMINATED) { report_completion(tsx->status_code); - tsx->mod_data[mod_test.id] = (void*)1; + tsx->mod_data[mod_test.id] = (void*)(pj_ssize_t)1; } else if (tsx->method.id == PJSIP_INVITE_METHOD && tsx->state == PJSIP_TSX_STATE_CONFIRMED) { report_completion(tsx->status_code); - tsx->mod_data[mod_test.id] = (void*)1; + tsx->mod_data[mod_test.id] = (void*)(pj_ssize_t)1; } else if (tsx->state == PJSIP_TSX_STATE_COMPLETED) { report_completion(tsx->status_code); - tsx->mod_data[mod_test.id] = (void*)1; + tsx->mod_data[mod_test.id] = (void*)(pj_ssize_t)1; TERMINATE_TSX(tsx, tsx->status_code); } @@ -1421,7 +1421,7 @@ static pj_status_t submit_job(void) static int client_thread(void *arg) { pj_time_val end_time, last_report, now; - unsigned thread_index = (unsigned)(long)arg; + unsigned thread_index = (unsigned)(long)(pj_ssize_t)arg; unsigned cycle = 0, last_cycle = 0; pj_thread_sleep(100); @@ -1578,7 +1578,7 @@ static const char *good_number(char *buf, pj_int32_t val) static int server_thread(void *arg) { pj_time_val timeout = { 0, 1 }; - unsigned thread_index = (unsigned)(long)arg; + unsigned thread_index = (unsigned)(long)(pj_ssize_t)arg; pj_time_val last_report, next_report; pj_gettimeofday(&last_report); @@ -1639,7 +1639,7 @@ static void write_report(const char *msg) { puts(msg); -#if defined(PJ_WIN32) && PJ_WIN32!=0 +#if (defined(PJ_WIN32) && PJ_WIN32!=0) || (defined(PJ_WIN64) && PJ_WIN64!=0) OutputDebugString(msg); OutputDebugString("\n"); #endif @@ -1715,7 +1715,8 @@ int main(int argc, char *argv[]) for (i=0; i<app.thread_count; ++i) { status = pj_thread_create(app.pool, NULL, &client_thread, - (void*)(long)i, 0, 0, &app.thread[i]); + (void*)(pj_ssize_t)i, 0, 0, + &app.thread[i]); if (status != PJ_SUCCESS) { app_perror(THIS_FILE, "Unable to create thread", status); return 1; @@ -1824,7 +1825,8 @@ int main(int argc, char *argv[]) for (i=0; i<app.thread_count; ++i) { status = pj_thread_create(app.pool, NULL, &server_thread, - (void*)(long)i, 0, 0, &app.thread[i]); + (void*)(pj_ssize_t)i, 0, 0, + &app.thread[i]); if (status != PJ_SUCCESS) { app_perror(THIS_FILE, "Unable to create thread", status); return 1; diff --git a/pjsip-apps/src/samples/playsine.c b/pjsip-apps/src/samples/playsine.c index 00cabe47..92491f1a 100644 --- a/pjsip-apps/src/samples/playsine.c +++ b/pjsip-apps/src/samples/playsine.c @@ -83,7 +83,8 @@ static pj_status_t sine_get_frame( pjmedia_port *port, { port_data *sine = port->port_data.pdata; pj_int16_t *samples = frame->buf; - unsigned i, count, left, right; + unsigned i, left, right; + pj_size_t count; /* Get number of samples */ count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info); diff --git a/pjsip-apps/src/samples/sipecho.c b/pjsip-apps/src/samples/sipecho.c index c1e3bb43..6c5244d8 100644 --- a/pjsip-apps/src/samples/sipecho.c +++ b/pjsip-apps/src/samples/sipecho.c @@ -402,7 +402,8 @@ static void call_on_state_changed( pjsip_inv_session *inv, static void call_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer) { call_t *call = (call_t*) inv->mod_data[mod_sipecho.id]; - pjsip_inv_set_sdp_answer(inv, create_answer(call - app.call, inv->pool_prov, offer)); + pjsip_inv_set_sdp_answer(inv, create_answer((int)(call - app.call), + inv->pool_prov, offer)); } static void call_on_forked(pjsip_inv_session *inv, pjsip_event *e) @@ -501,7 +502,7 @@ static pj_bool_t on_rx_request( pjsip_rx_data *rdata ) &local_uri, &dlg); if (status == PJ_SUCCESS) - answer = create_answer(call-app.call, dlg->pool, sdp_info->sdp); + answer = create_answer((int)(call-app.call), dlg->pool, sdp_info->sdp); if (status == PJ_SUCCESS) status = pjsip_inv_create_uas( dlg, rdata, answer, 0, &call->inv); if (status == PJ_SUCCESS) diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c index 9d544efd..f783b6aa 100644 --- a/pjsip-apps/src/samples/siprtp.c +++ b/pjsip-apps/src/samples/siprtp.c @@ -1101,7 +1101,7 @@ static pj_status_t create_sdp( pj_pool_t *pool, } -#if defined(PJ_WIN32) && PJ_WIN32 != 0 +#if (defined(PJ_WIN32) && PJ_WIN32 != 0) || (defined(PJ_WIN64) && PJ_WIN64 != 0) #include <windows.h> static void boost_priority(void) { @@ -1195,13 +1195,13 @@ static void on_rx_rtp(void *user_data, void *pkt, pj_ssize_t size) /* Check for errors */ if (size < 0) { - app_perror(THIS_FILE, "RTP recv() error", -size); + app_perror(THIS_FILE, "RTP recv() error", (pj_status_t)-size); return; } /* Decode RTP packet. */ status = pjmedia_rtp_decode_rtp(&strm->in_sess, - pkt, size, + pkt, (int)size, &hdr, &payload, &payload_len); if (status != PJ_SUCCESS) { app_perror(THIS_FILE, "RTP decode error", status); @@ -1234,7 +1234,7 @@ static void on_rx_rtcp(void *user_data, void *pkt, pj_ssize_t size) /* Check for errors */ if (size < 0) { - app_perror(THIS_FILE, "Error receiving RTCP packet", -size); + app_perror(THIS_FILE, "Error receiving RTCP packet",(pj_status_t)-size); return; } @@ -1862,7 +1862,7 @@ static pj_bool_t simple_input(const char *title, char *buf, pj_size_t len) char *p; printf("%s (empty to cancel): ", title); fflush(stdout); - if (fgets(buf, len, stdin) == NULL) + if (fgets(buf, (int)len, stdin) == NULL) return PJ_FALSE; /* Remove trailing newlines. */ @@ -2024,7 +2024,7 @@ static void app_log_writer(int level, const char *buffer, int len) pj_log_write(level, buffer, len); if (log_file) { - int count = fwrite(buffer, len, 1, log_file); + pj_size_t count = fwrite(buffer, len, 1, log_file); PJ_UNUSED_ARG(count); fflush(log_file); } diff --git a/pjsip-apps/src/samples/streamutil.c b/pjsip-apps/src/samples/streamutil.c index 7037a94e..ee357b3d 100644 --- a/pjsip-apps/src/samples/streamutil.c +++ b/pjsip-apps/src/samples/streamutil.c @@ -360,12 +360,14 @@ int main(int argc, char *argv[]) break; case OPT_SRTP_TX_KEY: - tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, strlen(pj_optarg)); + tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, + (int)strlen(pj_optarg)); pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); break; case OPT_SRTP_RX_KEY: - tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, strlen(pj_optarg)); + tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, + (int)strlen(pj_optarg)); pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); break; #endif diff --git a/pjsip-apps/src/samples/tonegen.c b/pjsip-apps/src/samples/tonegen.c index e3d5554c..efd4a318 100644 --- a/pjsip-apps/src/samples/tonegen.c +++ b/pjsip-apps/src/samples/tonegen.c @@ -127,7 +127,7 @@ int main() f = fopen("tonegen.pcm", "wb"); for (i=0; i<8000/SAMPLES_PER_FRAME; ++i) { - int count; + pj_size_t count; pjmedia_port_get_frame(port, &frm); count = fwrite(buf, SAMPLES_PER_FRAME, 2, f); if (count != 2) diff --git a/pjsip-apps/src/samples/util.h b/pjsip-apps/src/samples/util.h index c5d8fd6c..4529fad1 100644 --- a/pjsip-apps/src/samples/util.h +++ b/pjsip-apps/src/samples/util.h @@ -155,8 +155,8 @@ void dump_pool_usage( const char *app_name, pj_caching_pool *cp ) { #if !defined(PJ_HAS_POOL_ALT_API) || PJ_HAS_POOL_ALT_API==0 pj_pool_t *p; - unsigned total_alloc = 0; - unsigned total_used = 0; + pj_size_t total_alloc = 0; + pj_size_t total_used = 0; /* Accumulate memory usage in active list. */ p = cp->used_list.next; diff --git a/pjsip-apps/src/samples/vid_streamutil.c b/pjsip-apps/src/samples/vid_streamutil.c index 10eb0d69..f9f0a0d7 100644 --- a/pjsip-apps/src/samples/vid_streamutil.c +++ b/pjsip-apps/src/samples/vid_streamutil.c @@ -302,7 +302,8 @@ static void clock_cb(const pj_timestamp *ts, void *user_data) write_frame.buf = play_file->dec_buf; write_frame.size = play_file->dec_buf_size; status = pjmedia_vid_codec_decode(decoder, 1, &read_frame, - write_frame.size, &write_frame); + (unsigned)write_frame.size, + &write_frame); if (status != PJ_SUCCESS) return; } else { @@ -494,13 +495,13 @@ int main(int argc, char *argv[]) case OPT_SRTP_TX_KEY: tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, - strlen(pj_optarg)); + (int)strlen(pj_optarg)); pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); break; case OPT_SRTP_RX_KEY: tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, - strlen(pj_optarg)); + (int)strlen(pj_optarg)); pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); break; #endif |