firemail

标题: PL_strnpbrk [打印本页]

作者: hechengjin    时间: 2015-10-15 09:22
标题: PL_strnpbrk
struct nsLocalMailCopyState
{
    char *m_dataBuffer;
}
nsLocalMailCopyState *mCopyState;

char *start = mCopyState->m_dataBuffer + 1;
  
char *endBuffer = mCopyState->m_dataBuffer + mCopyState->m_leftOver + 1;

char *end = PL_strnpbrk(start, "\r\n", endBuffer - start);


如:
start指向下面字符串
Received: from hechengjin (114.255.44.132) by Bjmail2.kingsoft.cn
(192.168.12.58) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 9 Oct 2015

则end指向下面字符串
\r\n
(192.168.12.58) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 9 Oct 2015



PR_IMPLEMENT(char *)
PL_strnpbrk(const char *s, const char *list, PRUint32 max)
{
    const char *p;

    if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;

    for( ; max && *s; s++, max-- )
        for( p = list; *p; p++ )
            if( *s == *p )
                return (char *)s;

    return (char *)0;
}







欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3