本文整理汇总了C++中pj_ansi_strlen函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_ansi_strlen函数的具体用法?C++ pj_ansi_strlen怎么用?C++ pj_ansi_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pj_ansi_strlen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gui_msgbox
enum gui_key gui_msgbox(const char *title, const char *message, enum gui_flag flag)
{
wchar_t buf_title[64];
wchar_t buf_msg[512];
UINT wflag = 0;
int retcode;
pj_ansi_to_unicode(title, pj_ansi_strlen(title), buf_title, 64);
pj_ansi_to_unicode(message, pj_ansi_strlen(message), buf_msg, 512);
switch (flag) {
case WITH_OK:
wflag = MB_OK;
break;
case WITH_YESNO:
wflag = MB_YESNO;
break;
case WITH_OKCANCEL:
wflag = MB_OKCANCEL;
break;
}
retcode = MessageBox(g_hWndMain, buf_msg, buf_title, wflag);
switch (retcode) {
case IDOK:
return KEY_OK;
case IDYES:
return KEY_YES;
case IDNO:
return KEY_NO;
default:
return KEY_CANCEL;
}
}
开发者ID:leprechuanese,项目名称:factsys,代码行数:35,代码来源:main_wm.c
示例2: generate_submenu
/* generate submenu and register the menu handler, then return next menu id */
static UINT generate_submenu(HMENU parent, UINT id_start, gui_menu *menu)
{
unsigned i;
UINT id = id_start;
if (!menu)
return id;
/* generate submenu */
for (i = 0; i < menu->submenu_cnt; ++i) {
if (menu->submenus[i] == NULL) {
/* add separator */
AppendMenu(parent, MF_SEPARATOR, 0, 0);
} else if (menu->submenus[i]->submenu_cnt != 0) {
/* this submenu item has children, generate popup menu */
HMENU hMenu;
wchar_t buf[64];
pj_ansi_to_unicode(menu->submenus[i]->title,
pj_ansi_strlen(menu->submenus[i]->title),
buf, 64);
hMenu = CreatePopupMenu();
AppendMenu(parent, MF_STRING|MF_ENABLED|MF_POPUP, (UINT)hMenu, buf);
id = generate_submenu(hMenu, id, menu->submenus[i]);
} else {
/* this submenu item is leaf, register the handler */
wchar_t buf[64];
pj_ansi_to_unicode(menu->submenus[i]->title,
pj_ansi_strlen(menu->submenus[i]->title),
buf, 64);
AppendMenu(parent, MF_STRING, id, buf);
if (menu->submenus[i]->handler) {
g_menu_handlers[g_menu_handler_cnt].id = id;
g_menu_handlers[g_menu_handler_cnt].handler =
menu->submenus[i]->handler;
++g_menu_handler_cnt;
}
++id;
}
}
return id;
}
开发者ID:leprechuanese,项目名称:factsys,代码行数:55,代码来源:main_wm.c
示例3: nat_detect_cb
/**
* Callback upon NAT detection completion
*/
static void nat_detect_cb (const pj_stun_nat_detect_result *res)
{
if (res->status != PJ_SUCCESS) {
char msg[250];
pj_ansi_snprintf (msg, sizeof (msg), "NAT detection failed: %s",
res->status_text);
SetCallStatus (msg, pj_ansi_strlen (msg));
} else {
char msg[250];
pj_ansi_snprintf (msg, sizeof (msg), "NAT type is %s",
res->nat_type_name);
SetCallStatus (msg, pj_ansi_strlen (msg));
}
}
开发者ID:max3903,项目名称:SFLphone,代码行数:17,代码来源:pjsua_wince.cpp
示例4: ffmpeg_log_cb
static void ffmpeg_log_cb(void* ptr, int level, const char* fmt, va_list vl)
{
const char *LOG_SENDER = "ffmpeg";
enum { LOG_LEVEL = 5 };
char buf[100];
int bufsize = sizeof(buf), len;
pj_str_t fmt_st;
/* Custom callback needs to filter log level by itself */
if (level > av_log_get_level())
return;
/* Add original ffmpeg sender to log format */
if (ptr) {
AVClass* avc = *(AVClass**)ptr;
len = pj_ansi_snprintf(buf, bufsize, "%s: ", avc->item_name(ptr));
bufsize -= len;
}
/* Copy original log format */
len = pj_ansi_strlen(fmt);
if (len > bufsize-1)
len = bufsize-1;
pj_memcpy(buf+sizeof(buf)-bufsize, fmt, len);
bufsize -= len;
/* Trim log format */
pj_strset(&fmt_st, buf, sizeof(buf)-bufsize);
pj_strrtrim(&fmt_st);
buf[fmt_st.slen] = '\0';
pj_log(LOG_SENDER, LOG_LEVEL, buf, vl);
}
开发者ID:xhook,项目名称:asterisk-v11,代码行数:33,代码来源:ffmpeg_util.c
示例5: PJ_DEF
/*
* Register new transport type to PJSIP.
*/
PJ_DEF(pj_status_t) pjsip_transport_register_type( unsigned tp_flag,
const char *tp_name,
int def_port,
int *p_tp_type)
{
unsigned i;
PJ_ASSERT_RETURN(tp_flag && tp_name && def_port, PJ_EINVAL);
PJ_ASSERT_RETURN(pj_ansi_strlen(tp_name) <
PJ_ARRAY_SIZE(transport_names[0].name_buf),
PJ_ENAMETOOLONG);
for (i=1; i<PJ_ARRAY_SIZE(transport_names); ++i) {
if (transport_names[i].type == 0)
break;
}
if (i == PJ_ARRAY_SIZE(transport_names))
return PJ_ETOOMANY;
transport_names[i].type = (pjsip_transport_type_e)i;
transport_names[i].port = (pj_uint16_t)def_port;
pj_ansi_strcpy(transport_names[i].name_buf, tp_name);
transport_names[i].name = pj_str(transport_names[i].name_buf);
transport_names[i].flag = tp_flag;
if (p_tp_type)
*p_tp_type = i;
return PJ_SUCCESS;
}
开发者ID:ambush276,项目名称:rifle,代码行数:34,代码来源:sip_transport.c
示例6: PJ_DEF
PJ_DEF(unsigned) pjmedia_sdp_attr_remove_all(unsigned *count,
pjmedia_sdp_attr *attr_array[],
const char *name)
{
unsigned i, removed = 0;
pj_str_t attr_name;
PJ_ASSERT_RETURN(count && attr_array && name, PJ_EINVAL);
attr_name.ptr = (char*)name;
attr_name.slen = pj_ansi_strlen(name);
for (i=0; i<*count; ) {
if (pj_strcmp(&attr_array[i]->name, &attr_name)==0) {
pj_array_erase(attr_array, sizeof(pjmedia_sdp_attr*),
*count, i);
--(*count);
++removed;
} else {
++i;
}
}
return removed;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:25,代码来源:sdp.c
示例7: pjnath_strerror
/*
* pjnath_strerror()
*/
static pj_str_t pjnath_strerror(pj_status_t statcode,
char *buf, pj_size_t bufsize )
{
pj_str_t errstr;
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
if (statcode >= PJNATH_ERRNO_START &&
statcode < PJNATH_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
{
/* Find the error in the table.
* Use binary search!
*/
int first = 0;
int n = PJ_ARRAY_SIZE(err_str);
while (n > 0) {
int half = n/2;
int mid = first + half;
if (err_str[mid].code < statcode) {
first = mid+1;
n -= (half+1);
} else if (err_str[mid].code > statcode) {
n = half;
} else {
first = mid;
break;
}
}
if (PJ_ARRAY_SIZE(err_str) && err_str[first].code == statcode) {
pj_str_t msg;
msg.ptr = (char*)err_str[first].msg;
msg.slen = pj_ansi_strlen(err_str[first].msg);
errstr.ptr = buf;
pj_strncpy_with_null(&errstr, &msg, bufsize);
return errstr;
}
}
#endif /* PJ_HAS_ERROR_STRING */
/* Error not found. */
errstr.ptr = buf;
errstr.slen = pj_ansi_snprintf(buf, bufsize,
"Unknown pjnath error %d",
statcode);
if (errstr.slen < 0) errstr.slen = 0;
else if (errstr.slen > (int)bufsize) errstr.slen = bufsize;
return errstr;
}
开发者ID:Jopie64,项目名称:pjsip,代码行数:61,代码来源:errno.c
示例8: SetCallStatus
static void SetCallStatus (const char *state, int len)
{
wchar_t tmp[128];
if (len==-1) len=pj_ansi_strlen (state);
pj_ansi_to_unicode (state, len, tmp, PJ_ARRAY_SIZE (tmp));
SetDlgItemText (hMainWnd, ID_CALL_STATUS, tmp);
}
开发者ID:max3903,项目名称:SFLphone,代码行数:9,代码来源:pjsua_wince.cpp
示例9: sockaddr_to_host_port
static void sockaddr_to_host_port( pj_pool_t *pool,
pjsip_host_port *host_port,
const pj_sockaddr_in *addr )
{
host_port->host.ptr = (char*) pj_pool_alloc(pool, PJ_INET6_ADDRSTRLEN+4);
pj_sockaddr_print(addr, host_port->host.ptr, PJ_INET6_ADDRSTRLEN+4, 2);
host_port->host.slen = pj_ansi_strlen(host_port->host.ptr);
host_port->port = pj_sockaddr_get_port(addr);
}
开发者ID:conght,项目名称:BLM-Lib,代码行数:9,代码来源:sip_transport_tls.c
示例10: SetURI
static void SetURI (const char *uri, int len, bool enabled=true)
{
wchar_t tmp[128];
if (len==-1) len=pj_ansi_strlen (uri);
pj_ansi_to_unicode (uri, len, tmp, PJ_ARRAY_SIZE (tmp));
SetDlgItemText (hMainWnd, ID_URI, tmp);
EnableWindow (hwndURI, enabled?TRUE:FALSE);
}
开发者ID:max3903,项目名称:SFLphone,代码行数:10,代码来源:pjsua_wince.cpp
示例11: PJ_DEF
/*
* pjmedia_videodev_strerror()
*/
PJ_DEF(pj_str_t) pjmedia_videodev_strerror(pj_status_t statcode,
char *buf, pj_size_t bufsize )
{
pj_str_t errstr;
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
/* videodev error */
if (statcode >= PJMEDIA_VIDEODEV_ERRNO_START &&
statcode < PJMEDIA_VIDEODEV_ERRNO_END)
{
/* Find the error in the table.
* Use binary search!
*/
int first = 0;
int n = PJ_ARRAY_SIZE(err_str);
while (n > 0) {
int half = n/2;
int mid = first + half;
if (err_str[mid].code < statcode) {
first = mid+1;
n -= (half+1);
} else if (err_str[mid].code > statcode) {
n = half;
} else {
first = mid;
break;
}
}
if (PJ_ARRAY_SIZE(err_str) && err_str[first].code == statcode) {
pj_str_t msg;
msg.ptr = (char*)err_str[first].msg;
msg.slen = pj_ansi_strlen(err_str[first].msg);
errstr.ptr = buf;
pj_strncpy_with_null(&errstr, &msg, bufsize);
return errstr;
}
}
#endif /* PJ_HAS_ERROR_STRING */
/* Error not found. */
errstr.ptr = buf;
errstr.slen = pj_ansi_snprintf(buf, bufsize,
"Unknown pjmedia-videodev error %d",
statcode);
return errstr;
}
开发者ID:conght,项目名称:BLM-Lib,代码行数:58,代码来源:errno.c
示例12: pjmedia_sdp_attr_find2
pjmedia_sdp_attr_find2(unsigned count,
pjmedia_sdp_attr *const attr_array[],
const char *c_name,
const pj_str_t *c_fmt)
{
pj_str_t name;
name.ptr = (char*)c_name;
name.slen = pj_ansi_strlen(c_name);
return pjmedia_sdp_attr_find(count, attr_array, &name, c_fmt);
}
开发者ID:tibastral,项目名称:symphonie,代码行数:12,代码来源:sdp.c
示例13: PJ_DEF
/*
* Convert text to IPv4/IPv6 address.
*/
PJ_DEF(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst)
{
char tempaddr[PJ_INET6_ADDRSTRLEN];
PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL);
PJ_ASSERT_RETURN(src && src->slen && dst, PJ_EINVAL);
/* Initialize output with PJ_IN_ADDR_NONE for IPv4 (to be
* compatible with pj_inet_aton()
*/
if (af==PJ_AF_INET) {
((pj_in_addr*)dst)->s_addr = PJ_INADDR_NONE;
}
/* Caution:
* this function might be called with cp->slen >= 46
* (i.e. when called with hostname to check if it's an IP addr).
*/
if (src->slen >= PJ_INET6_ADDRSTRLEN) {
return PJ_ENAMETOOLONG;
}
pj_memcpy(tempaddr, src->ptr, src->slen);
tempaddr[src->slen] = '\0';
wchar_t tempaddr16[PJ_INET6_ADDRSTRLEN];
pj_ansi_to_unicode(tempaddr, pj_ansi_strlen(tempaddr),
tempaddr16, sizeof(tempaddr16));
TBuf<PJ_INET6_ADDRSTRLEN> ip_addr((const TText*)tempaddr16);
TInetAddr addr;
addr.Init(KAfInet6);
if (addr.Input(ip_addr) == KErrNone) {
if (af==PJ_AF_INET) {
/* Success (Symbian IP address is in host byte order) */
pj_uint32_t ip = pj_htonl(addr.Address());
pj_memcpy(dst, &ip, 4);
} else if (af==PJ_AF_INET6) {
const TIp6Addr & ip6 = addr.Ip6Address();
pj_memcpy(dst, ip6.u.iAddr8, 16);
} else {
pj_assert(!"Unexpected!");
return PJ_EBUG;
}
return PJ_SUCCESS;
} else {
/* Error */
return PJ_EINVAL;
}
}
开发者ID:avble,项目名称:natClientEx,代码行数:55,代码来源:sock_symbian.cpp
示例14: send_request
/* Send request */
static void send_request(const pjsip_method *method,
int cseq,
const pj_str_t *branch,
pj_bool_t with_offer)
{
pjsip_tx_data *tdata;
pj_str_t dummy_sdp_str =
{
"v=0\r\n"
"o=- 3360842071 3360842071 IN IP4 192.168.0.68\r\n"
"s=pjmedia\r\n"
"c=IN IP4 192.168.0.68\r\n"
"t=0 0\r\n"
"m=audio 4000 RTP/AVP 0 101\r\n"
"a=rtcp:4001 IN IP4 192.168.0.68\r\n"
"a=rtpmap:0 PCMU/8000\r\n"
"a=sendrecv\r\n"
"a=rtpmap:101 telephone-event/8000\r\n"
"a=fmtp:101 0-15\r\n",
0
};
pj_status_t status;
status = pjsip_dlg_create_request(dlg, method, cseq, &tdata);
pj_assert(status == PJ_SUCCESS);
if (branch) {
pjsip_via_hdr *via;
via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
pj_strdup(tdata->pool, &via->branch_param, branch);
}
if (with_offer) {
pjsip_msg_body *body;
pj_str_t mime_application = { "application", 11};
pj_str_t mime_sdp = {"sdp", 3};
dummy_sdp_str.slen = pj_ansi_strlen(dummy_sdp_str.ptr);
body = pjsip_msg_body_create(tdata->pool,
&mime_application, &mime_sdp,
&dummy_sdp_str);
tdata->msg->body = body;
}
status = pjsip_dlg_send_request(dlg, tdata, -1, NULL);
pj_assert(status == PJ_SUCCESS);
}
开发者ID:deveck,项目名称:Deveck.TAM,代码行数:50,代码来源:invtester.c
示例15: ui_echo
static void ui_echo(char menuin[])
{
if (pj_ansi_strnicmp(menuin, "echo", 4)==0) {
pj_str_t tmp;
tmp.ptr = menuin+5;
tmp.slen = pj_ansi_strlen(menuin)-6;
if (tmp.slen < 1) {
puts("Usage: echo [0|1]");
return;
}
cmd_echo = *tmp.ptr != '0' || tmp.slen!=1;
}
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:15,代码来源:pjsua_app_legacy.c
示例16: mod_stateful_on_rx_request
static pj_bool_t mod_stateful_on_rx_request(pjsip_rx_data *rdata)
{
const pj_str_t stateful_user = { "1", 1 };
pjsip_uri *uri;
pjsip_sip_uri *sip_uri;
uri = pjsip_uri_get_uri(rdata->msg_info.msg->line.req.uri);
/* Only want to receive SIP/SIPS scheme */
if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri))
return PJ_FALSE;
sip_uri = (pjsip_sip_uri*) uri;
/* Check for matching user part */
if (pj_strcmp(&sip_uri->user, &stateful_user)!=0)
return PJ_FALSE;
/*
* Yes, this is for us.
* Respond statefully with 200/OK.
*/
switch (rdata->msg_info.msg->line.req.method.id) {
case PJSIP_INVITE_METHOD:
{
pjsip_msg_body *body;
if (dummy_sdp_str.slen == 0)
dummy_sdp_str.slen = pj_ansi_strlen(dummy_sdp_str.ptr);
body = pjsip_msg_body_create(rdata->tp_info.pool,
&mime_application, &mime_sdp,
&dummy_sdp_str);
pjsip_endpt_respond(app.sip_endpt, &mod_stateful_server, rdata,
200, NULL, NULL, body, NULL);
}
break;
case PJSIP_ACK_METHOD:
return PJ_TRUE;
default:
pjsip_endpt_respond(app.sip_endpt, &mod_stateful_server, rdata,
200, NULL, NULL, NULL, NULL);
break;
}
app.server.cur_state.stateful_cnt++;
return PJ_TRUE;
}
开发者ID:ClearwaterCore,项目名称:pjsip-upstream,代码行数:48,代码来源:pjsip-perf.c
示例17: pj_ansi_strlen
/* Util to find child node with the specified substring */
static pj_xml_node *find_node(const pj_xml_node *parent,
const char *part_name)
{
const pj_xml_node *node = parent->node_head.next,
*head = (pj_xml_node*) &parent->node_head;
pj_ssize_t part_len = pj_ansi_strlen(part_name);
while (node != head) {
if (substring_match(node, part_name, part_len))
return (pj_xml_node*) node;
node = node->next;
}
return NULL;
}
开发者ID:Archipov,项目名称:android-client,代码行数:17,代码来源:rpid.c
示例18: substring_match
/* Comparison function to find node name substring */
static pj_bool_t substring_match(const pj_xml_node *node,
const char *part_name,
pj_ssize_t part_len)
{
pj_str_t end_name;
if (part_len < 1)
part_len = pj_ansi_strlen(part_name);
if (node->name.slen < part_len)
return PJ_FALSE;
end_name.ptr = node->name.ptr + (node->name.slen - part_len);
end_name.slen = part_len;
return pj_strnicmp2(&end_name, part_name, part_len)==0;
}
开发者ID:Archipov,项目名称:android-client,代码行数:18,代码来源:rpid.c
示例19: init_media
/*
* Init media stack.
*/
static pj_status_t init_media()
{
unsigned i;
pj_uint16_t rtp_port;
pj_status_t status;
/* Initialize media endpoint so that at least error subsystem is properly
* initialized.
*/
status = pjmedia_endpt_create(&app.cp.factory,
pjsip_endpt_get_ioqueue(app.sip_endpt), 0,
&app.med_endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
/* Must register all codecs to be supported */
pjmedia_codec_register_audio_codecs(app.med_endpt, NULL);
/* Init dummy socket addresses */
app.skinfo_cnt = 0;
for (i=0, rtp_port=4000; i<PJ_ARRAY_SIZE(app.skinfo); ++i, rtp_port+=2) {
pjmedia_sock_info *skinfo;
skinfo = &app.skinfo[i];
pj_sockaddr_in_init(&skinfo->rtp_addr_name.ipv4, &app.local_addr,
(pj_uint16_t)rtp_port);
pj_sockaddr_in_init(&skinfo->rtp_addr_name.ipv4, &app.local_addr,
(pj_uint16_t)(rtp_port+1));
app.skinfo_cnt++;
}
/* Generate dummy SDP */
dummy_sdp_str.slen = pj_ansi_strlen(dummy_sdp_str.ptr);
status = pjmedia_sdp_parse(app.pool, dummy_sdp_str.ptr, dummy_sdp_str.slen,
&app.dummy_sdp);
if (status != PJ_SUCCESS) {
app_perror(THIS_FILE, "Error parsing dummy SDP", status);
return status;
}
/* Done */
return PJ_SUCCESS;
}
开发者ID:ClearwaterCore,项目名称:pjsip-upstream,代码行数:49,代码来源:pjsip-perf.c
示例20: alsa_stream_set_cap
/* API: set capability */
static pj_status_t alsa_stream_set_cap(pjmedia_aud_stream *strm,
pjmedia_aud_dev_cap cap,
const void *value)
{
struct alsa_factory *af = ((struct alsa_stream*)strm)->af;
if (cap==PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING &&
pj_ansi_strlen(af->pb_mixer_name))
{
pj_ssize_t min, max;
snd_mixer_t *handle;
snd_mixer_selem_id_t *sid;
snd_mixer_elem_t* elem;
unsigned vol = *(unsigned*)value;
if (snd_mixer_open(&handle, 0) < 0)
return PJMEDIA_EAUD_SYSERR;
if (snd_mixer_attach(handle, "default") < 0)
return PJMEDIA_EAUD_SYSERR;
if (snd_mixer_selem_register(handle, NULL, NULL) < 0)
return PJMEDIA_EAUD_SYSERR;
if (snd_mixer_load(handle) < 0)
return PJMEDIA_EAUD_SYSERR;
snd_mixer_selem_id_alloca(&sid);
snd_mixer_selem_id_set_index(sid, 0);
snd_mixer_selem_id_set_name(sid, af->pb_mixer_name);
elem = snd_mixer_find_selem(handle, sid);
if (!elem)
return PJMEDIA_EAUD_SYSERR;
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
if (snd_mixer_selem_set_playback_volume_all(elem, vol * max / 100) < 0)
return PJMEDIA_EAUD_SYSERR;
snd_mixer_close(handle);
return PJ_SUCCESS;
}
return PJMEDIA_EAUD_INVCAP;
}
开发者ID:waspxyz,项目名称:pjproject-2.7.2,代码行数:45,代码来源:alsa_dev.c
注:本文中的pj_ansi_strlen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论