本文整理匯總了C++中AppendDebugLog函數的典型用法代碼示例。如果您正苦於以下問題:C++ AppendDebugLog函數的具體用法?C++ AppendDebugLog怎麽用?C++ AppendDebugLog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AppendDebugLog函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: HashNick
void ResNickMan::AddReservedNick(const char * sNick, const bool &bFromScript/* = false*/) {
uint32_t ulHash = HashNick(sNick, strlen(sNick));
if(CheckReserved(sNick, ulHash) == false) {
ReservedNick * pNewNick = new ReservedNick(sNick, ulHash);
if(pNewNick == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewNick in ResNickMan::AddReservedNick\n", 0);
return;
} else if(pNewNick->sNick == NULL) {
delete pNewNick;
AppendDebugLog("%s - [MEM] Cannot allocate pNewNick->sNick in ResNickMan::AddReservedNick\n", 0);
return;
}
if(ReservedNicks == NULL) {
ReservedNicks = pNewNick;
} else {
ReservedNicks->prev = pNewNick;
pNewNick->next = ReservedNicks;
ReservedNicks = pNewNick;
}
pNewNick->bFromScript = bFromScript;
}
}
示例2: AppendDebugLog
void classUsers::AddBot2NickList(char * Nick, const size_t &szNickLen, const bool &isOp) {
// $NickList nick$$nick2$$|
if(nickListSize < nickListLen+szNickLen+2) {
char * pOldBuf = nickList;
#ifdef _WIN32
nickList = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, nickListSize+NICKLISTSIZE+1);
#else
nickList = (char *)realloc(pOldBuf, nickListSize+NICKLISTSIZE+1);
#endif
if(nickList == NULL) {
nickList = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in classUsers::AddBot2NickList for NickList\n", (uint64_t)(nickListSize+NICKLISTSIZE+1));
return;
}
nickListSize += NICKLISTSIZE;
}
memcpy(nickList+nickListLen-1, Nick, szNickLen);
nickListLen += (uint32_t)(szNickLen+2);
nickList[nickListLen-3] = '$';
nickList[nickListLen-2] = '$';
nickList[nickListLen-1] = '|';
nickList[nickListLen] = '\0';
iZNickListLen = 0;
if(isOp == false)
return;
if(opListSize < opListLen+szNickLen+2) {
char * pOldBuf = opList;
#ifdef _WIN32
opList = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, opListSize+OPLISTSIZE+1);
#else
opList = (char *)realloc(pOldBuf, opListSize+OPLISTSIZE+1);
#endif
if(opList == NULL) {
opList = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in classUsers::AddBot2NickList for opList\n", (uint64_t)(opListSize+OPLISTSIZE+1));
return;
}
opListSize += OPLISTSIZE;
}
memcpy(opList+opListLen-1, Nick, szNickLen);
opListLen += (uint32_t)(szNickLen+2);
opList[opListLen-3] = '$';
opList[opListLen-2] = '$';
opList[opListLen-1] = '|';
opList[opListLen] = '\0';
iZOpListLen = 0;
}
示例3: while
void clsEventQueue::AddNormal(uint8_t ui8Id, char * sMsg) {
if(ui8Id != EVENT_RSTSCRIPT && ui8Id != EVENT_STOPSCRIPT) {
event * next = NormalS;
while(next != NULL) {
event * cur = next;
next = cur->next;
if(cur->ui8Id == ui8Id) {
return;
}
}
}
event * pNewEvent = new event();
if(pNewEvent == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewEvent in clsEventQueue::AddNormal\n", 0);
return;
}
if(sMsg != NULL) {
size_t szLen = strlen(sMsg);
#ifdef _WIN32
pNewEvent->sMsg = (char *)HeapAlloc(clsServerManager::hLibHeap, HEAP_NO_SERIALIZE, szLen+1);
#else
pNewEvent->sMsg = (char *)malloc(szLen+1);
#endif
if(pNewEvent->sMsg == NULL) {
delete pNewEvent;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes for pNewEvent->sMsg in clsEventQueue::AddNormal\n", (uint64_t)(szLen+1));
return;
}
memcpy(pNewEvent->sMsg, sMsg, szLen);
pNewEvent->sMsg[szLen] = '\0';
} else {
pNewEvent->sMsg = NULL;
}
pNewEvent->ui8Id = ui8Id;
if(NormalS == NULL) {
NormalS = pNewEvent;
pNewEvent->prev = NULL;
} else {
pNewEvent->prev = NormalE;
NormalE->next = pNewEvent;
}
NormalE = pNewEvent;
pNewEvent->next = NULL;
}
示例4: strlen
void classUsers::AddBot2MyInfos(char * MyInfo) {
size_t len = strlen(MyInfo);
if(myInfosTag != NULL) {
if(strstr(myInfosTag, MyInfo) == NULL ) {
if(myInfosTagSize < myInfosTagLen+len) {
char * pOldBuf = myInfosTag;
#ifdef _WIN32
myInfosTag = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, myInfosTagSize+MYINFOLISTSIZE+1);
#else
myInfosTag = (char *)realloc(pOldBuf, myInfosTagSize+MYINFOLISTSIZE+1);
#endif
if(myInfosTag == NULL) {
myInfosTag = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes for myInfosTag in classUsers::AddBot2MyInfos\n", (uint64_t)(myInfosTagSize+MYINFOLISTSIZE+1));
return;
}
myInfosTagSize += MYINFOLISTSIZE;
}
memcpy(myInfosTag+myInfosTagLen, MyInfo, len);
myInfosTagLen += (uint32_t)len;
myInfosTag[myInfosTagLen] = '\0';
iZMyInfosLen = 0;
}
}
if(myInfos != NULL) {
if(strstr(myInfos, MyInfo) == NULL ) {
if(myInfosSize < myInfosLen+len) {
char * pOldBuf = myInfos;
#ifdef _WIN32
myInfos = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, myInfosSize+MYINFOLISTSIZE+1);
#else
myInfos = (char *)realloc(pOldBuf, myInfosSize+MYINFOLISTSIZE+1);
#endif
if(myInfos == NULL) {
myInfos = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes for myInfos in classUsers::AddBot2MyInfos\n", (uint64_t)(myInfosSize+MYINFOLISTSIZE+1));
return;
}
myInfosSize += MYINFOLISTSIZE;
}
memcpy(myInfos+myInfosLen, MyInfo, len);
myInfosLen += (uint32_t)len;
myInfos[myInfosLen] = '\0';
iZMyInfosTagLen = 0;
}
}
}
示例5: QueueItem
void GlobalDataQueue::InsertQueueItem(char * sCommand, const size_t &szLen, void * pBeforeItem, const uint8_t &ui8CmdType) {
QueueItem * pNewItem = new QueueItem();
if(pNewItem == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewItem in GlobalDataQueue::InsertQueueItem\n", 0);
return;
}
#ifdef _WIN32
pNewItem->sCommand1 = (char *)HeapAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, szLen);
#else
pNewItem->sCommand1 = (char *)malloc(szLen+1);
#endif
if(pNewItem->sCommand1 == NULL) {
delete pNewItem;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes for pNewItem->sCommand1 in GlobalDataQueue::InsertQueueItem\n", (uint64_t)(szLen+1));
return;
}
memcpy(pNewItem->sCommand1, sCommand, szLen);
pNewItem->sCommand1[szLen] = '\0';
pNewItem->szLen1 = szLen;
pNewItem->sCommand2 = NULL;
pNewItem->szLen2 = 0;
pNewItem->ui8CommandType = ui8CmdType;
pNewItem->pNext = (QueueItem *)pBeforeItem;
QueueItem * pNext = pNewQueueItems[0];
if(pNext == pBeforeItem) {
pNewQueueItems[0] = pNewItem;
return;
}
while(pNext != NULL) {
QueueItem * pCur = pNext;
pNext = pCur->pNext;
if(pNext == pBeforeItem) {
pCur->pNext = pNewItem;
return;
}
}
}
示例6: sprintf
// appends data to the OpListQueue
void clsGlobalDataQueue::OpListStore(char * sNick) {
if(OpListQueue.szLen == 0) {
OpListQueue.szLen = sprintf(OpListQueue.sBuffer, "$OpList %s$$|", sNick);
} else {
int iDataLen = sprintf(msg, "%s$$|", sNick);
if(CheckSprintf(iDataLen, 128, "clsGlobalDataQueue::OpListStore2") == true) {
if(OpListQueue.szSize < OpListQueue.szLen+iDataLen) {
size_t szAllignLen = Allign256(OpListQueue.szLen+iDataLen);
char * pOldBuf = OpListQueue.sBuffer;
#ifdef _WIN32
OpListQueue.sBuffer = (char *)HeapReAlloc(clsServerManager::hLibHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, szAllignLen);
#else
OpListQueue.sBuffer = (char *)realloc(pOldBuf, szAllignLen);
#endif
if(OpListQueue.sBuffer == NULL) {
OpListQueue.sBuffer = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in clsGlobalDataQueue::OpListStore\n", (uint64_t)szAllignLen);
return;
}
OpListQueue.szSize = (uint32_t)(szAllignLen-1);
}
memcpy(OpListQueue.sBuffer+OpListQueue.szLen-1, msg, iDataLen);
OpListQueue.szLen += iDataLen-1;
OpListQueue.sBuffer[OpListQueue.szLen] = '\0';
}
}
}
示例7: UserClose
void classUsers::Add2OpList(User * u) {
if(opListSize < opListLen+u->ui8NickLen+2) {
char * pOldBuf = opList;
#ifdef _WIN32
opList = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, opListSize+OPLISTSIZE+1);
#else
opList = (char *)realloc(pOldBuf, opListSize+OPLISTSIZE+1);
#endif
if(opList == NULL) {
opList = pOldBuf;
u->ui32BoolBits |= User::BIT_ERROR;
UserClose(u);
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in classUsers::Add2OpList for opList\n", (uint64_t)(opListSize+OPLISTSIZE+1));
return;
}
opListSize += OPLISTSIZE;
}
memcpy(opList+opListLen-1, u->sNick, u->ui8NickLen);
opListLen += (uint32_t)(u->ui8NickLen+2);
opList[opListLen-3] = '$';
opList[opListLen-2] = '$';
opList[opListLen-1] = '|';
opList[opListLen] = '\0';
iZOpListLen = 0;
}
示例8: AppendDebugLog
string & string::operator+=(const string & sStr) {
if(sStr.c_str() == sEmpty) {
return *this;
}
char * oldbuf = sData;
if(sData == sEmpty) {
sData = (char *)malloc(szDataLen+sStr.size()+1);
} else {
sData = (char *)realloc(oldbuf, szDataLen+sStr.size()+1);
}
if(sData == NULL) {
sData = oldbuf;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes for sData in string::operator+=(string)\n", (uint64_t)(szDataLen+sStr.size()+1));
return *this;
}
memcpy(sData+szDataLen, sStr.c_str(), sStr.size());
szDataLen += sStr.size();
sData[szDataLen] = '\0';
return *this;
}
示例9: new
ReservedNicksManager::ReservedNick * ReservedNicksManager::ReservedNick::CreateReservedNick(const char * sNewNick, const uint32_t ui32NickHash) {
ReservedNick * pReservedNick = new (std::nothrow) ReservedNick();
if(pReservedNick == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate new pReservedNick in ReservedNick::CreateReservedNick\n");
return NULL;
}
size_t szNickLen = strlen(sNewNick);
#ifdef _WIN32
pReservedNick->m_sNick = (char *)HeapAlloc(ServerManager::m_hPtokaXHeap, HEAP_NO_SERIALIZE, szNickLen+1);
#else
pReservedNick->m_sNick = (char *)malloc(szNickLen+1);
#endif
if(pReservedNick->m_sNick == NULL) {
AppendDebugLogFormat("[MEM] Cannot allocate %zu bytes in ReservedNick::CreateReservedNick\n", szNickLen+1);
delete pReservedNick;
return NULL;
}
memcpy(pReservedNick->m_sNick, sNewNick, szNickLen);
pReservedNick->m_sNick[szNickLen] = '\0';
pReservedNick->m_ui32Hash = ui32NickHash;
return pReservedNick;
}
示例10: strlen
string & string::operator+=(const char * sTxt) {
size_t szLen = strlen(sTxt);
char * oldbuf = sData;
if(sData == sEmpty) {
sData = (char *)malloc(szDataLen+szLen+1);
} else {
sData = (char *)realloc(oldbuf, szDataLen+szLen+1);
}
if(sData == NULL) {
sData = oldbuf;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes for sData in string::operator+=(char)\n", (uint64_t)(szDataLen+szLen+1));
return *this;
}
memcpy(sData+szDataLen, sTxt, szLen);
szDataLen += szLen;
sData[szDataLen] = '\0';
return *this;
}
示例11: KillTimer
void theLoop::Looper() {
#ifdef _WIN32
KillTimer(NULL, srvLoopTimer);
#endif
// PPK ... two loop stategy for saving badwith
if(bRecv == true) {
ReceiveLoop();
} else {
SendLoop();
eventqueue->ProcessEvents();
}
if(bServerTerminated == false) {
bRecv = !bRecv;
#ifdef _WIN32
srvLoopTimer = SetTimer(NULL, 0, 100, NULL);
if(srvLoopTimer == 0) {
AppendDebugLog("%s - [ERR] Cannot start Looper in theLoop::Looper\n", 0);
exit(EXIT_FAILURE);
}
#endif
} else {
// tell the scripts about the end
ScriptManager->OnExit();
// send last possible global data
g_GlobalDataQueue->SendFinalQueue();
ServerFinalStop(true);
}
}
示例12: sprintf
void classUsers::Add2UserIP(User * cur) {
int m = sprintf(msg,"$%s %s$", cur->sNick, cur->sIP);
if(CheckSprintf(m, 1024, "classUsers::Add2UserIP") == false) {
return;
}
if(userIPListSize < userIPListLen+m) {
char * pOldBuf = userIPList;
#ifdef _WIN32
userIPList = (char *)HeapReAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, userIPListSize+IPLISTSIZE+1);
#else
userIPList = (char *)realloc(pOldBuf, userIPListSize+IPLISTSIZE+1);
#endif
if(userIPList == NULL) {
userIPList = pOldBuf;
cur->ui32BoolBits |= User::BIT_ERROR;
UserClose(cur);
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in classUsers::Add2UserIP\n", (uint64_t)(userIPListSize+IPLISTSIZE+1));
return;
}
userIPListSize += IPLISTSIZE;
}
memcpy(userIPList+userIPListLen-1, msg+1, m-1);
userIPListLen += m;
userIPList[userIPListLen-2] = '$';
userIPList[userIPListLen-1] = '|';
userIPList[userIPListLen] = '\0';
iZUserIPListLen = 0;
}
示例13: SingleDataItem
void clsGlobalDataQueue::SingleItemStore(char * sData, const size_t &szDataLen, User * pFromUser, const int32_t &i32Profile, const uint8_t &ui8Type) {
SingleDataItem * pNewItem = new SingleDataItem();
if(pNewItem == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewItem in clsGlobalDataQueue::SingleItemStore\n", 0);
return;
}
if(sData != NULL) {
#ifdef _WIN32
pNewItem->sData = (char *)HeapAlloc(clsServerManager::hLibHeap, HEAP_NO_SERIALIZE, szDataLen+1);
#else
pNewItem->sData = (char *)malloc(szDataLen+1);
#endif
if(pNewItem->sData == NULL) {
delete pNewItem;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes in clsGlobalDataQueue::SingleItemStore\n", (uint64_t)(szDataLen+1));
return;
}
memcpy(pNewItem->sData, sData, szDataLen);
pNewItem->sData[szDataLen] = '\0';
} else {
pNewItem->sData = NULL;
}
pNewItem->szDataLen = szDataLen;
pNewItem->pFromUser = pFromUser;
pNewItem->ui8Type = ui8Type;
pNewItem->pPrev = NULL;
pNewItem->pNext = NULL;
pNewItem->i32Profile = i32Profile;
if(pNewSingleItems[0] == NULL) {
pNewSingleItems[0] = pNewItem;
pNewSingleItems[1] = pNewItem;
} else {
pNewItem->pPrev = pNewSingleItems[1];
pNewSingleItems[1]->pNext = pNewItem;
pNewSingleItems[1] = pNewItem;
}
}
示例14: time
void classUsers::Add2RecTimes(User * curUser) {
time_t acc_time;
time(&acc_time);
if(ProfileMan->IsAllowed(curUser, ProfileManager::NOUSRSAMEIP) == true ||
(acc_time-curUser->LoginTime) >= SettingManager->iShorts[SETSHORT_MIN_RECONN_TIME]) {
return;
}
RecTime * pNewRecTime = new RecTime();
if(pNewRecTime == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewRecTime in classUsers::Add2RecTimes\n", 0);
return;
}
#ifdef _WIN32
pNewRecTime->sNick = (char *)HeapAlloc(hPtokaXHeap, HEAP_NO_SERIALIZE, curUser->ui8NickLen+1);
#else
pNewRecTime->sNick = (char *)malloc(curUser->ui8NickLen+1);
#endif
if(pNewRecTime->sNick == NULL) {
delete pNewRecTime;
AppendDebugLog("%s - [MEM] Cannot allocate %" PRIu64 " bytes in classUsers::Add2RecTimes\n", (uint64_t)(curUser->ui8NickLen+1));
return;
}
memcpy(pNewRecTime->sNick, curUser->sNick, curUser->ui8NickLen);
pNewRecTime->sNick[curUser->ui8NickLen] = '\0';
pNewRecTime->ui64DisConnTick = ui64ActualTick-(acc_time-curUser->LoginTime);
pNewRecTime->ui32NickHash = curUser->ui32NickHash;
memcpy(pNewRecTime->ui128IpHash, curUser->ui128IpHash, 16);
pNewRecTime->prev = NULL;
pNewRecTime->next = RecTimeList;
if(RecTimeList != NULL) {
RecTimeList->prev = pNewRecTime;
}
RecTimeList = pNewRecTime;
}
示例15: new
bool UdpDebug::New(User * pUser, const uint16_t ui16Port) {
UdpDbgItem * pNewDbg = new (std::nothrow) UdpDbgItem();
if(pNewDbg == NULL) {
AppendDebugLog("%s - [MEM] Cannot allocate pNewDbg in UdpDebug::New\n");
return false;
}
// initialize dbg item
#ifdef _WIN32
pNewDbg->m_sNick = (char *)HeapAlloc(ServerManager::m_hPtokaXHeap, HEAP_NO_SERIALIZE, pUser->m_ui8NickLen+1);
#else
pNewDbg->m_sNick = (char *)malloc(pUser->m_ui8NickLen+1);
#endif
if(pNewDbg->m_sNick == NULL) {
AppendDebugLogFormat("[MEM] Cannot allocate %" PRIu8 " bytes for sNick in UdpDebug::New\n", pUser->m_ui8NickLen+1);
delete pNewDbg;
return false;
}
memcpy(pNewDbg->m_sNick, pUser->m_sNick, pUser->m_ui8NickLen);
pNewDbg->m_sNick[pUser->m_ui8NickLen] = '\0';
pNewDbg->m_ui32Hash = pUser->m_ui32NickHash;
struct in6_addr i6addr;
memcpy(&i6addr, &pUser->m_ui128IpHash, 16);
bool bIPv6 = (IN6_IS_ADDR_V4MAPPED(&i6addr) == 0);
if(bIPv6 == true) {
((struct sockaddr_in6 *)&pNewDbg->m_sasTo)->sin6_family = AF_INET6;
((struct sockaddr_in6 *)&pNewDbg->m_sasTo)->sin6_port = htons(ui16Port);
memcpy(((struct sockaddr_in6 *)&pNewDbg->m_sasTo)->sin6_addr.s6_addr, pUser->m_ui128IpHash, 16);
pNewDbg->m_sasLen = sizeof(struct sockaddr_in6);
} else {
((struct sockaddr_in *)&pNewDbg->m_sasTo)->sin_family = AF_INET;
((struct sockaddr_in *)&pNewDbg->m_sasTo)->sin_port = htons(ui16Port);
((struct sockaddr_in *)&pNewDbg->m_sasTo)->sin_addr.s_addr = inet_addr(pUser->m_sIP);
pNewDbg->m_sasLen = sizeof(struct sockaddr_in);
}
pNewDbg->m_Socket = socket((bIPv6 == true ? AF_INET6 : AF_INET), SOCK_DGRAM, IPPROTO_UDP);
#ifdef _WIN32
if(pNewDbg->m_Socket == INVALID_SOCKET) {
int iErr = WSAGetLastError();
#else
if(pNewDbg->m_Socket == -1) {
#endif
pUser->SendFormat("UdpDebug::New1", true, "*** [ERR] %s: %s (%d).|", LanguageManager::m_Ptr->m_sTexts[LAN_UDP_SCK_CREATE_ERR],
#ifdef _WIN32
WSErrorStr(iErr), iErr);
#else
ErrnoStr(errno), errno);
#endif
delete pNewDbg;
return false;
}