BOOL FileTransferSocket::connect(const CString &linkaddr, UInt16 port) { BOOL bRet = m_pLinkSocket->connect(linkaddr, port); PTR_NULL(bRet); return TRUE; }
CImPdu* DoLoginServer::doLogin() { m_pImPdu = 0; PTR_NULL(m_pLinkSocket); //登录服务器地址 module::TTConfig* pCfg = module::getSysConfigModule()->getSystemConfig(); BOOL bRet = m_pLinkSocket->connect(pCfg->loginServIP, pCfg->loginServPort); PTR_NULL(bRet); if(_waitConnectedNotify()) { //请求消息服务器信息 CImPduMsgServRequest pduMsgServReq; m_pImPdu = _sendPacketAndWaitResponse(&pduMsgServReq); } return m_pImPdu; }
static inline char *__get_ch_part_end(char *begin, char *end, char ch) { char *part_end = memchr(begin, ch, end - begin); if (PTR_NULL(part_end)) { part_end = end; } return part_end; }
int32_t split_sp_pos(char *subject, int32_t len, split_node_t *split_list, int32_t max_split_num) { char *ptr = NULL; int32_t index = 0; char *begin = search_sense(subject, len); char *end = subject + len; if (unlikely(begin == NULL || max_split_num <= 0)) { return 0; } bool get_quotation = false; bool insert_ok; while (begin < end) { ptr = __get_sp_part_end(begin, end, &get_quotation); /* begin -> ptr */ if (!get_quotation) { insert_ok = __split_insert_one_part(subject, begin, ptr - begin, split_list + index, false); } else { insert_ok = __split_insert_one_part(subject, begin + 1, ptr - begin - 2, split_list + index, false); } if (insert_ok && (++index) == max_split_num) { break; } ptr = search_sense(ptr, end - ptr); if (PTR_NULL(ptr)) { ptr = end; } begin = ptr; } return index; }
static inline char *__get_sp_part_end(char *begin, char *end, bool *get_quotation) { char *part_end = NULL; if (begin[0] == '"' && end - begin > 1) { begin++; part_end = memchr(begin, (int32_t)('"'), end - begin); if (PTR_NOT_NULL(part_end)) { *get_quotation = true; return (part_end + 1); } } *get_quotation = false; part_end = search_nosense(begin, end - begin); if (PTR_NULL(part_end)) { part_end = end; } return part_end; }