当前位置: 首页>>代码示例>>C++>>正文


C++ pj_ansi_strlen函数代码示例

本文整理汇总了C++中pj_ansi_strlen函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_ansi_strlen函数的具体用法?C++ pj_ansi_strlen怎么用?C++ pj_ansi_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pj_ansi_strlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的pj_ansi_strlen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。