From c68165979e5741aa201a9ac951e37fee4ca362cc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Aug 2013 08:01:11 +0000 Subject: we use bin2hex now instead of mir_snprintf("%02x") git-svn-id: http://svn.miranda-ng.org/main/trunk@5699 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Exchange/src/utils.cpp | 53 +++++++++++------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) (limited to 'plugins/Exchange') diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 0e5adb4831..b3b5da1217 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -45,7 +45,7 @@ int Log(char *format, ...) } va_start(vararg, format); - + tBytes = mir_vsnprintf(str, sizeof(str), format, vararg); if (tBytes > 0) { @@ -75,7 +75,7 @@ int Info(char *title, char *format, ...) str[tBytes] = 0; } va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); + return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); } #define HEX_SIZE 8 @@ -86,36 +86,9 @@ char *BinToHex(int size, PBYTE data) char buffer[32] = {0}; //should be more than enough int maxSize = size * 2 + HEX_SIZE + 1; szresult = (char *) new char[ maxSize ]; - memset(szresult, 0, maxSize); - mir_snprintf(buffer, SIZEOF(buffer), "%0*X", HEX_SIZE, size); - strcpy(szresult, buffer); - int i; - for (i = 0; i < size; i++) - { - mir_snprintf(buffer, SIZEOF(buffer), "%02X", data[i]); - strcpy(szresult + (HEX_SIZE + i * 2), buffer); - } - return szresult; -} -/* -TCHAR *BinToHex(int size, PBYTE data) -{ - TCHAR *szresult = NULL; - TCHAR buffer[32] = {0}; //should be more than enough - int maxSize = size * 2 + HEX_SIZE + 1; - szresult = (TCHAR *) new TCHAR[ maxSize ]; - memset(szresult, 0, maxSize); - mir_sntprintf(buffer,_countof(buffer), _T("%0*X"), HEX_SIZE, size); - _tcsncpy(szresult, buffer,_countof(buffer)); - int i; - for (i = 0; i < size; i++) - { - mir_sntprintf(buffer, _countof(buffer),_T("%02X"), data[i]); - _tcsncpy(szresult + (HEX_SIZE + i * 2), buffer,_countof(buffer)); - } - return szresult; + mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size); + return bin2hex(data, size, szresult + HEX_SIZE); } -*/ void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData) { @@ -179,7 +152,7 @@ void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) { RECT rParent; RECT rChild; - + if (parentPos->flags & SWP_NOSIZE) { return; @@ -212,10 +185,10 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, rTmp.right = (parentPos->x + parentPos->cx) - rParent->right; rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom; rTmp.top = parentPos->y - rParent->top; - + cx = (rTmp.left) ? -rTmp.left : rTmp.right; - cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; - + cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; + rChild.right += cx; rChild.bottom += cy; //expanded the window accordingly, now we need to enforce the anchors @@ -241,17 +214,17 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, DWORD WINAPI CheckEmailWorkerThread(LPVOID data) { EnterCriticalSection(&csCheck); - + int bForceAttempt = (int) data; - + if (!exchangeServer.IsConnected()) { exchangeServer.Connect(bForceAttempt); } exchangeServer.Check(bForceAttempt); - + LeaveCriticalSection(&csCheck); - + return 0; } @@ -260,7 +233,7 @@ int ThreadCheckEmail(int bForceAttempt) DWORD idThread; HANDLE hCheckThread = CreateThread(NULL, NULL, CheckEmailWorkerThread, (void *) bForceAttempt, 0, &idThread); CloseHandle(hCheckThread); - + return 0; } -- cgit v1.2.3